@oneuptime/common 14.0.104 → 14.0.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/CloudAccount.d.mts +1 -0
- package/Models/DatabaseModels/CloudAccount.d.ts +1 -0
- package/Models/DatabaseModels/CloudAccount.js +21 -0
- package/Models/DatabaseModels/CloudBudget.d.mts +1 -0
- package/Models/DatabaseModels/CloudBudget.d.ts +1 -0
- package/Models/DatabaseModels/CloudBudget.js +38 -3
- package/Models/DatabaseModels/CloudCostRecommendation.d.mts +2 -0
- package/Models/DatabaseModels/CloudCostRecommendation.d.ts +2 -0
- package/Models/DatabaseModels/CloudCostRecommendation.js +30 -2
- package/Models/DatabaseModels/DetectionRule.js +8 -7
- package/Types/AI/ResourceAiAccessApi.d.mts +1 -0
- package/Types/AI/ResourceAiAccessApi.d.ts +1 -0
- package/Types/AI/ResourceAiAccessApi.js +6 -1
- package/Types/AI/ResourceAiAccessApi.mjs +1 -0
- package/Types/AI/ResourceAiAccessPermissions.d.mts +2 -0
- package/Types/AI/ResourceAiAccessPermissions.d.ts +2 -0
- package/Types/AI/ResourceAiAccessPermissions.js +13 -0
- package/Types/AI/ResourceAiAccessPermissions.mjs +2 -0
- package/Types/Cloud/CloudCost.d.mts +8 -0
- package/Types/Cloud/CloudCost.d.ts +8 -0
- package/Types/Cloud/CloudCost.js +37 -0
- package/Types/Cloud/CloudCost.mjs +1 -0
- package/Types/Cloud/CloudCostAnomaly.d.mts +34 -0
- package/Types/Cloud/CloudCostAnomaly.d.ts +34 -0
- package/Types/Cloud/CloudCostAnomaly.js +236 -0
- package/Types/Cloud/CloudCostAnomaly.mjs +18 -0
- package/Types/Cloud/CloudLogGroups.d.mts +6 -1
- package/Types/Cloud/CloudLogGroups.d.ts +6 -1
- package/Types/Cloud/CloudLogGroups.js +59 -3
- package/Types/Cloud/CloudLogGroups.mjs +1 -0
- package/Types/Cloud/CloudPlatform.js +9 -8
- package/Types/Cloud/CloudRightSizing.d.mts +140 -0
- package/Types/Cloud/CloudRightSizing.d.ts +140 -0
- package/Types/Cloud/CloudRightSizing.js +867 -0
- package/Types/Cloud/CloudRightSizing.mjs +53 -0
- package/Types/CloudConnection/CloudAiAgentKey.d.mts +65 -0
- package/Types/CloudConnection/CloudAiAgentKey.d.ts +65 -0
- package/Types/CloudConnection/CloudAiAgentKey.js +289 -0
- package/Types/CloudConnection/CloudAiAgentKey.mjs +18 -0
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.mts +5 -2
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.ts +5 -2
- package/Types/CloudConnection/CloudAiAgentSetupCommands.js +114 -43
- package/Types/CloudConnection/CloudAiAgentSetupCommands.mjs +4 -1
- package/Types/CloudConnection/CloudStream.d.mts +4 -0
- package/Types/CloudConnection/CloudStream.d.ts +4 -0
- package/Types/CloudConnection/CloudStream.js +18 -1
- package/Types/CloudConnection/CloudStream.mjs +4 -0
- package/Types/CloudConnection/CloudStreamTemplate.d.mts +2 -0
- package/Types/CloudConnection/CloudStreamTemplate.d.ts +2 -0
- package/Types/CloudConnection/CloudStreamTemplate.js +89 -6
- package/Types/CloudConnection/CloudStreamTemplate.mjs +2 -0
- package/Types/InstallScripts/InstallScripts.js +1 -1
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.mts +6 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.ts +6 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.js +11 -1
- package/Types/ResourceAiAgent/CloudAiAgentNames.mjs +3 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.d.mts +3 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.d.ts +3 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.js +13 -2
- package/Types/ResourceAiAgent/ResourceAiAccess.mjs +2 -0
- package/Types/SecurityCase/SecurityCaseContext.d.mts +2 -1
- package/Types/SecurityCase/SecurityCaseContext.d.ts +2 -1
- package/Types/SecurityCase/SecurityConnection.d.mts +2 -1
- package/Types/SecurityCase/SecurityConnection.d.ts +2 -1
- package/Types/SecurityEvent/RealTimeDetection.d.mts +14 -5
- package/Types/SecurityEvent/RealTimeDetection.d.ts +14 -5
- package/Types/SecurityEvent/RealTimeDetection.js +75 -25
- package/Types/SecurityEvent/RealTimeDetection.mjs +3 -3
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.mts +4 -2
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.ts +4 -2
- package/Types/SecurityPlaybook/SecurityPlaybookAction.js +22 -3
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.mts +7 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.ts +7 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStep.js +96 -39
- package/Types/SecurityPlaybook/SecurityPlaybookStep.mjs +2 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.d.mts +17 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.d.ts +17 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.js +174 -33
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.mjs +7 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.mts +5 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.ts +5 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.js +10 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.mjs +1 -0
- package/Utils/Telemetry/CloudChangeTitle.d.mts +37 -0
- package/Utils/Telemetry/CloudChangeTitle.d.ts +37 -0
- package/Utils/Telemetry/CloudChangeTitle.js +315 -3
- package/Utils/Telemetry/CloudChangeTitle.mjs +13 -0
- package/package.json +1 -1
|
@@ -36,15 +36,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.GCP_CLOUD_AI_AGENT_KEY_READER = exports.GCP_CLOUD_AI_AGENT_VM_REFUSED_MESSAGE = exports.GCP_CLOUD_AI_AGENT_RUN_DIRECTORY = exports.GCP_CLOUD_AI_AGENT_LOG_WRITER_ROLE = exports.GCP_CLOUD_AI_AGENT_STARTUP_FILE = exports.GCP_CLOUD_AI_AGENT_SUBNET_RANGE = exports.GCP_CLOUD_AI_AGENT_IMAGE_PROJECT = exports.GCP_CLOUD_AI_AGENT_IMAGE_FAMILY = exports.GCP_CLOUD_AI_AGENT_BOOT_DISK_TYPE = exports.GCP_CLOUD_AI_AGENT_BOOT_DISK_GB = exports.GCP_CLOUD_AI_AGENT_MACHINE_TYPE = exports.AWS_CLOUD_AI_AGENT_LOG_RETENTION_DAYS = exports.GCP_CLOUD_AI_AGENT_DEPLOY_RETRY_MESSAGE = exports.GCP_CLOUD_AI_AGENT_DEPLOY_RETRY_SECONDS = exports.GCP_CLOUD_AI_AGENT_DEPLOY_ATTEMPTS = exports.GCP_SECRET_ACCESSOR_ROLE = exports.GCP_CLOUD_AI_AGENT_KEY_FILE_END = exports.GCP_CLOUD_AI_AGENT_SECRET_NAME = exports.AZURE_CLOUD_AI_AGENT_SECRET_NAME = exports.GCP_CLOUD_AI_AGENT_KEY_FILE = exports.GCP_CLOUD_AI_AGENT_ENV_FILE = exports.AWS_CLOUD_AI_AGENT_TEMPLATE_FILE = exports.CLOUD_AI_AGENT_HEALTH_HOST_ENV = exports.
|
|
39
|
+
exports.GCP_CLOUD_AI_AGENT_KEY_READER = exports.GCP_CLOUD_AI_AGENT_VM_REFUSED_MESSAGE = exports.GCP_CLOUD_AI_AGENT_RUN_DIRECTORY = exports.GCP_CLOUD_AI_AGENT_LOG_WRITER_ROLE = exports.GCP_CLOUD_AI_AGENT_STARTUP_FILE = exports.GCP_CLOUD_AI_AGENT_SUBNET_RANGE = exports.GCP_CLOUD_AI_AGENT_IMAGE_PROJECT = exports.GCP_CLOUD_AI_AGENT_IMAGE_FAMILY = exports.GCP_CLOUD_AI_AGENT_BOOT_DISK_TYPE = exports.GCP_CLOUD_AI_AGENT_BOOT_DISK_GB = exports.GCP_CLOUD_AI_AGENT_MACHINE_TYPE = exports.AWS_CLOUD_AI_AGENT_LOG_RETENTION_DAYS = exports.GCP_CLOUD_AI_AGENT_DEPLOY_RETRY_MESSAGE = exports.GCP_CLOUD_AI_AGENT_DEPLOY_RETRY_SECONDS = exports.GCP_CLOUD_AI_AGENT_DEPLOY_ATTEMPTS = exports.GCP_TOKEN_CREATOR_ROLE = exports.GCP_SECRET_ACCESSOR_ROLE = exports.GCP_CLOUD_AI_AGENT_KEY_FILE_END = exports.GCP_CLOUD_AI_AGENT_SECRET_NAME = exports.AZURE_CLOUD_AI_AGENT_SECRET_NAME = exports.GCP_CLOUD_AI_AGENT_KEY_FILE = exports.GCP_CLOUD_AI_AGENT_ENV_FILE = exports.AWS_CLOUD_AI_AGENT_TEMPLATE_FILE = exports.CLOUD_AI_AGENT_HEALTH_HOST_ENV = exports.CLOUD_AI_AGENT_KEY_ENV = exports.CLOUD_AI_AGENT_ONEUPTIME_URL_ENV = exports.CLOUD_AI_AGENT_STARTED_MESSAGE = exports.CLOUD_AI_AGENT_SIZES = exports.CLOUD_AI_AGENT_DEFAULT_REGIONS = exports.CLOUD_AI_AGENT_IMAGE_TAG = exports.CLOUD_AI_AGENT_DEFAULT_FIXES_MODE = exports.CLOUD_AI_AGENT_FIXES_MODES = void 0;
|
|
40
40
|
exports.getCloudAiAgentChangeOperations = getCloudAiAgentChangeOperations;
|
|
41
41
|
exports.isReadableCloudAiAgentProtectedTarget = isReadableCloudAiAgentProtectedTarget;
|
|
42
42
|
exports.getCloudAiAgentMaxProtectedTargets = getCloudAiAgentMaxProtectedTargets;
|
|
43
43
|
exports.describeCloudAiAgentSetupProblem = describeCloudAiAgentSetupProblem;
|
|
44
44
|
exports.getCloudAiAgentImage = getCloudAiAgentImage;
|
|
45
45
|
exports.getAwsCloudAiAgentWriteRoleArn = getAwsCloudAiAgentWriteRoleArn;
|
|
46
|
+
exports.getGcpCloudAiAgentWriteServiceAccount = getGcpCloudAiAgentWriteServiceAccount;
|
|
46
47
|
exports.getCloudAiAgentEnvironment = getCloudAiAgentEnvironment;
|
|
47
48
|
exports.getCloudAiAgentRolePermissions = getCloudAiAgentRolePermissions;
|
|
49
|
+
exports.getGcpCloudAiAgentReaderPermissions = getGcpCloudAiAgentReaderPermissions;
|
|
48
50
|
exports.getAwsCloudAiAgentTemplate = getAwsCloudAiAgentTemplate;
|
|
49
51
|
exports.getAwsCloudAiAgentSetupCommand = getAwsCloudAiAgentSetupCommand;
|
|
50
52
|
exports.getAzureCloudAiAgentRoleName = getAzureCloudAiAgentRoleName;
|
|
@@ -61,6 +63,7 @@ const AiResourceType_1 = __importStar(require("../ResourceAiAgent/AiResourceType
|
|
|
61
63
|
const CloudAiAgentNames_1 = require("../ResourceAiAgent/CloudAiAgentNames");
|
|
62
64
|
const ResourceAiAccess_1 = require("../ResourceAiAgent/ResourceAiAccess");
|
|
63
65
|
const ShellWord_1 = require("../Runbook/ShellWord");
|
|
66
|
+
const CloudAiAgentKey_1 = require("./CloudAiAgentKey");
|
|
64
67
|
const CloudOperationCatalog_1 = require("../../Utils/AiRemediation/Resource/CloudOperationCatalog");
|
|
65
68
|
/*
|
|
66
69
|
* "Ask me first" (the default), "Fix safe problems on its own", and under
|
|
@@ -96,19 +99,17 @@ exports.CLOUD_AI_AGENT_STARTED_MESSAGE = "The Cloud AI agent is starting. It con
|
|
|
96
99
|
/*
|
|
97
100
|
* Variables the agent's Config reads (agents/ResourceAIAgent/Config.ts:
|
|
98
101
|
* ONEUPTIME_URL_ENV and HEALTH_HOST_ENV; the health port is PORT, which
|
|
99
|
-
* Cloud Run sets from --port). The key goes in the
|
|
100
|
-
* RESOURCE_AI_AGENT_API_KEY_ENVS that names an
|
|
102
|
+
* Cloud Run sets from --port). The key goes in the first of
|
|
103
|
+
* RESOURCE_AI_AGENT_API_KEY_ENVS, the one that names an agent's own key.
|
|
101
104
|
*/
|
|
102
105
|
exports.CLOUD_AI_AGENT_ONEUPTIME_URL_ENV = "ONEUPTIME_URL";
|
|
103
|
-
exports.
|
|
104
|
-
return name === "ONEUPTIME_TELEMETRY_INGESTION_KEY";
|
|
105
|
-
}) || "ONEUPTIME_TELEMETRY_INGESTION_KEY";
|
|
106
|
+
exports.CLOUD_AI_AGENT_KEY_ENV = ResourceAiAccess_1.RESOURCE_AI_AGENT_KEY_ENV;
|
|
106
107
|
exports.CLOUD_AI_AGENT_HEALTH_HOST_ENV = "ONEUPTIME_AI_AGENT_HEALTH_HOST";
|
|
107
108
|
// What the commands write in the shell's directory, and the secrets' names.
|
|
108
109
|
exports.AWS_CLOUD_AI_AGENT_TEMPLATE_FILE = `${CloudAiAgentNames_1.CLOUD_AI_AGENT_NAME}.json`;
|
|
109
110
|
exports.GCP_CLOUD_AI_AGENT_ENV_FILE = `${CloudAiAgentNames_1.CLOUD_AI_AGENT_NAME}.env.yaml`;
|
|
110
111
|
exports.GCP_CLOUD_AI_AGENT_KEY_FILE = `${CloudAiAgentNames_1.CLOUD_AI_AGENT_NAME}.key`;
|
|
111
|
-
exports.AZURE_CLOUD_AI_AGENT_SECRET_NAME = "
|
|
112
|
+
exports.AZURE_CLOUD_AI_AGENT_SECRET_NAME = "agent-key";
|
|
112
113
|
exports.GCP_CLOUD_AI_AGENT_SECRET_NAME = `${CloudAiAgentNames_1.CLOUD_AI_AGENT_NAME}-key`;
|
|
113
114
|
/*
|
|
114
115
|
* The line that ends the key file's here-document in the Google Cloud
|
|
@@ -118,6 +119,12 @@ exports.GCP_CLOUD_AI_AGENT_SECRET_NAME = `${CloudAiAgentNames_1.CLOUD_AI_AGENT_N
|
|
|
118
119
|
exports.GCP_CLOUD_AI_AGENT_KEY_FILE_END = "KEY ENDS";
|
|
119
120
|
// What lets the Google Cloud agent's service account read its one secret.
|
|
120
121
|
exports.GCP_SECRET_ACCESSOR_ROLE = "roles/secretmanager.secretAccessor";
|
|
122
|
+
/*
|
|
123
|
+
* What lets the agent's own service account ask for a token of the write
|
|
124
|
+
* account: granted on the write account alone, never the project, so it
|
|
125
|
+
* acts as no other account of the project.
|
|
126
|
+
*/
|
|
127
|
+
exports.GCP_TOKEN_CREATOR_ROLE = "roles/iam.serviceAccountTokenCreator";
|
|
121
128
|
/*
|
|
122
129
|
* Cloud Run checks, as it deploys, that the service account may read the
|
|
123
130
|
* key's secret, and access granted a moment before can take a minute or
|
|
@@ -200,6 +207,9 @@ exports.GCP_CLOUD_AI_AGENT_KEY_READER = [
|
|
|
200
207
|
// The role's title on Azure and Google Cloud.
|
|
201
208
|
const ROLE_TITLE = "OneUptime AI Agent";
|
|
202
209
|
const ROLE_DESCRIPTION = "What the OneUptime Cloud AI agent may change: the operations turned on for it";
|
|
210
|
+
// Google Cloud's second role: what the agent's own account reads.
|
|
211
|
+
const READER_ROLE_TITLE = "OneUptime AI Agent (reads)";
|
|
212
|
+
const READER_ROLE_DESCRIPTION = "What the OneUptime Cloud AI agent reads before and without a change; its changes run as its write account";
|
|
203
213
|
// The read every agent runs for Test connection.
|
|
204
214
|
const WHOAMI = "whoami";
|
|
205
215
|
// The cloud each CloudProvider is in the catalog, and the agent's resource type.
|
|
@@ -248,8 +258,6 @@ const TAG_KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_.:+@-]{0,127}$/;
|
|
|
248
258
|
const TAG_VALUE_PATTERN = /^[A-Za-z0-9_.:/+@-]{1,256}$/;
|
|
249
259
|
const GCP_LABEL_KEY_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/;
|
|
250
260
|
const GCP_LABEL_VALUE_PATTERN = /^[a-z0-9_-]{1,63}$/;
|
|
251
|
-
// The longest ingestion key taken.
|
|
252
|
-
const MAX_INGESTION_KEY_LENGTH = 256;
|
|
253
261
|
function isLetterOrDigit(char) {
|
|
254
262
|
return ((char >= "a" && char <= "z") ||
|
|
255
263
|
(char >= "A" && char <= "Z") ||
|
|
@@ -271,8 +279,6 @@ function holdsOnly(value, others) {
|
|
|
271
279
|
* commands write holds one.
|
|
272
280
|
*/
|
|
273
281
|
const URL_CHARACTERS = "-._~:/?#[]@$&'()*+,;=%";
|
|
274
|
-
// What an ingestion key may hold.
|
|
275
|
-
const KEY_CHARACTERS = "-._~+/=:";
|
|
276
282
|
/*
|
|
277
283
|
* What a protected-target pattern may hold: what an ARN, an Azure resource
|
|
278
284
|
* ID or a Google Cloud resource name holds, and "*". Never a comma (the
|
|
@@ -421,18 +427,21 @@ function readSetup(options) {
|
|
|
421
427
|
if (urlProblem) {
|
|
422
428
|
return urlProblem;
|
|
423
429
|
}
|
|
424
|
-
const key = typeof options.ingestionKey === "string" ? options.ingestionKey.trim() : "";
|
|
425
|
-
if (!key ||
|
|
426
|
-
key.length > MAX_INGESTION_KEY_LENGTH ||
|
|
427
|
-
!holdsOnly(key, KEY_CHARACTERS)) {
|
|
428
|
-
return "The ingestion key is not one OneUptime issues: copy it again from Project Settings, under Telemetry Ingestion Keys.";
|
|
429
|
-
}
|
|
430
430
|
const cloudAccountId = typeof options.cloudAccountId === "string"
|
|
431
431
|
? options.cloudAccountId.trim().toLowerCase()
|
|
432
432
|
: "";
|
|
433
433
|
if (!UUID_PATTERN.test(cloudAccountId)) {
|
|
434
434
|
return "The cloud account's OneUptime id is not an id: open the account's page under Cloud → Accounts and set the agent up from there.";
|
|
435
435
|
}
|
|
436
|
+
// The account's own key, and this account's: no other key is written.
|
|
437
|
+
const key = typeof options.agentKey === "string" ? options.agentKey.trim() : "";
|
|
438
|
+
const parsedKey = (0, CloudAiAgentKey_1.parseCloudAiAgentKey)(key);
|
|
439
|
+
if (!parsedKey) {
|
|
440
|
+
return "The agent's key is not one OneUptime made: open Let AI fix problems on the account's page again, which makes a new one.";
|
|
441
|
+
}
|
|
442
|
+
if (parsedKey.cloudAccountId !== cloudAccountId) {
|
|
443
|
+
return "This key was made for another cloud account's agent: open Let AI fix problems on this account's own page, which makes one for it.";
|
|
444
|
+
}
|
|
436
445
|
const accountId = typeof options.accountId === "string"
|
|
437
446
|
? provider === CloudPlatform_1.CloudProvider.Azure
|
|
438
447
|
? options.accountId.trim().toLowerCase()
|
|
@@ -480,7 +489,7 @@ function readSetup(options) {
|
|
|
480
489
|
return {
|
|
481
490
|
provider,
|
|
482
491
|
oneuptimeUrl: url,
|
|
483
|
-
|
|
492
|
+
agentKey: key,
|
|
484
493
|
cloudAccountId,
|
|
485
494
|
accountId,
|
|
486
495
|
fixesMode: options.fixesMode,
|
|
@@ -524,6 +533,13 @@ function getCloudAiAgentImage(imageTag = exports.CLOUD_AI_AGENT_IMAGE_TAG) {
|
|
|
524
533
|
function getAwsCloudAiAgentWriteRoleArn(accountId) {
|
|
525
534
|
return `arn:aws:iam::${accountId}:role/${CloudAiAgentNames_1.AWS_CLOUD_AI_AGENT_WRITE_ROLE_NAME}`;
|
|
526
535
|
}
|
|
536
|
+
// The Google Cloud write account, whose token each change asks for.
|
|
537
|
+
function getGcpCloudAiAgentWriteServiceAccount(projectId) {
|
|
538
|
+
return (0, CloudAiAgentNames_1.getGcpServiceAccountEmail)({
|
|
539
|
+
serviceAccountId: CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID,
|
|
540
|
+
projectId,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
527
543
|
function environmentOf(setup) {
|
|
528
544
|
const variable = (name, value, isSecret = false) => {
|
|
529
545
|
return { name, value, isSecret };
|
|
@@ -531,7 +547,7 @@ function environmentOf(setup) {
|
|
|
531
547
|
const environment = [
|
|
532
548
|
variable(ResourceAiAccess_1.RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV, AiResourceType_1.AI_RESOURCE_TYPE_INFO[RESOURCE_TYPES[setup.provider]].agentAlias),
|
|
533
549
|
variable(exports.CLOUD_AI_AGENT_ONEUPTIME_URL_ENV, setup.oneuptimeUrl),
|
|
534
|
-
variable(exports.
|
|
550
|
+
variable(exports.CLOUD_AI_AGENT_KEY_ENV, setup.agentKey, true),
|
|
535
551
|
variable(ResourceAiAccess_1.RESOURCE_AI_CLOUD_ACCOUNT_ID_ENV, setup.cloudAccountId),
|
|
536
552
|
variable(ResourceAiAccess_1.RESOURCE_AI_ALLOW_WRITES_ENV, "true"),
|
|
537
553
|
variable(AgentAiSettings_1.AI_INVESTIGATION_ENV, "true"),
|
|
@@ -550,6 +566,10 @@ function environmentOf(setup) {
|
|
|
550
566
|
if (setup.provider === CloudPlatform_1.CloudProvider.AWS) {
|
|
551
567
|
environment.push(variable(ResourceAiAccess_1.RESOURCE_AI_AWS_WRITE_ROLE_ARN_ENV, getAwsCloudAiAgentWriteRoleArn(setup.accountId)));
|
|
552
568
|
}
|
|
569
|
+
// The account each change runs as, through a token for that change alone.
|
|
570
|
+
if (setup.provider === CloudPlatform_1.CloudProvider.GCP) {
|
|
571
|
+
environment.push(variable(ResourceAiAccess_1.RESOURCE_AI_GCP_WRITE_SERVICE_ACCOUNT_ENV, getGcpCloudAiAgentWriteServiceAccount(setup.accountId)));
|
|
572
|
+
}
|
|
553
573
|
// The one subscription the agent acts in, so it never has to guess among several.
|
|
554
574
|
if (setup.provider === CloudPlatform_1.CloudProvider.Azure) {
|
|
555
575
|
environment.push(variable(AiResourceType_1.AI_RESOURCE_TYPE_INFO[AiResourceType_1.default.AzureSubscription]
|
|
@@ -572,7 +592,7 @@ function environmentOf(setup) {
|
|
|
572
592
|
}
|
|
573
593
|
/*
|
|
574
594
|
* Every variable the agent needs, for a team that runs it its own way: the
|
|
575
|
-
* same the cloud's command gives it. The
|
|
595
|
+
* same the cloud's command gives it. The agent's key is the one secret.
|
|
576
596
|
*/
|
|
577
597
|
function getCloudAiAgentEnvironment(options) {
|
|
578
598
|
return environmentOf(checkedSetup(options));
|
|
@@ -624,6 +644,20 @@ const GCP_OPERATION_READS = [
|
|
|
624
644
|
["compute", ["compute.zoneOperations.get", "compute.regionOperations.get"]],
|
|
625
645
|
["run", ["run.operations.get"]],
|
|
626
646
|
];
|
|
647
|
+
// The verbs of a Google Cloud permission (service.resource.verb) that only read.
|
|
648
|
+
const GCP_READ_VERBS = ["get", "list"];
|
|
649
|
+
/*
|
|
650
|
+
* What the Google Cloud agent's own service account holds: the reads of the
|
|
651
|
+
* changes turned on (what a dry run reads, and what the agent reads before
|
|
652
|
+
* a change to check it), never a change - each change runs as the write
|
|
653
|
+
* account (getCloudAiAgentRolePermissions), through a token for that change
|
|
654
|
+
* alone. Sorted, each once.
|
|
655
|
+
*/
|
|
656
|
+
function getGcpCloudAiAgentReaderPermissions(enabledOperations) {
|
|
657
|
+
return getCloudAiAgentRolePermissions(CloudPlatform_1.CloudProvider.GCP, enabledOperations).filter((permission) => {
|
|
658
|
+
return GCP_READ_VERBS.includes(permission.substring(permission.lastIndexOf(".") + 1));
|
|
659
|
+
});
|
|
660
|
+
}
|
|
627
661
|
/*
|
|
628
662
|
* What the agent reads to check a required tag where the resource's own
|
|
629
663
|
* read does not return its tags (a Lambda function's, an SQS queue's).
|
|
@@ -719,7 +753,7 @@ function getAwsTemplate(setup) {
|
|
|
719
753
|
return variable.isSecret;
|
|
720
754
|
})
|
|
721
755
|
.map((variable) => {
|
|
722
|
-
return { Name: variable.name, ValueFrom: { Ref: "
|
|
756
|
+
return { Name: variable.name, ValueFrom: { Ref: "AgentKeySecret" } };
|
|
723
757
|
});
|
|
724
758
|
const size = exports.CLOUD_AI_AGENT_SIZES[CloudPlatform_1.CloudProvider.AWS];
|
|
725
759
|
const ecsTasks = { Service: "ecs-tasks.amazonaws.com" };
|
|
@@ -735,11 +769,11 @@ function getAwsTemplate(setup) {
|
|
|
735
769
|
Type: "List<AWS::EC2::Subnet::Id>",
|
|
736
770
|
Description: "The default VPC's default subnets.",
|
|
737
771
|
},
|
|
738
|
-
|
|
772
|
+
AgentKey: {
|
|
739
773
|
Type: "String",
|
|
740
774
|
NoEcho: true,
|
|
741
775
|
MinLength: 1,
|
|
742
|
-
Description: "The
|
|
776
|
+
Description: "The key the agent registers with: this account's own, which connects its agent and nothing else.",
|
|
743
777
|
},
|
|
744
778
|
},
|
|
745
779
|
Resources: {
|
|
@@ -757,12 +791,17 @@ function getAwsTemplate(setup) {
|
|
|
757
791
|
RetentionInDays: exports.AWS_CLOUD_AI_AGENT_LOG_RETENTION_DAYS,
|
|
758
792
|
},
|
|
759
793
|
},
|
|
760
|
-
|
|
761
|
-
|
|
794
|
+
/*
|
|
795
|
+
* The key the agent registers with, which only ECS reads, as the task
|
|
796
|
+
* starts. A secret of its own name: the one an earlier version of this
|
|
797
|
+
* template kept the project's ingestion key in (IngestionKeySecret) is
|
|
798
|
+
* removed with the update that makes this one.
|
|
799
|
+
*/
|
|
800
|
+
AgentKeySecret: {
|
|
762
801
|
Type: "AWS::SecretsManager::Secret",
|
|
763
802
|
Properties: {
|
|
764
|
-
Description: "The
|
|
765
|
-
SecretString: { Ref: "
|
|
803
|
+
Description: "The key the OneUptime Cloud AI agent registers with: this account's own.",
|
|
804
|
+
SecretString: { Ref: "AgentKey" },
|
|
766
805
|
},
|
|
767
806
|
},
|
|
768
807
|
// What ECS pulls the image, writes the logs and reads the key with.
|
|
@@ -786,14 +825,14 @@ function getAwsTemplate(setup) {
|
|
|
786
825
|
],
|
|
787
826
|
Policies: [
|
|
788
827
|
{
|
|
789
|
-
PolicyName: "
|
|
828
|
+
PolicyName: "ReadTheAgentKey",
|
|
790
829
|
PolicyDocument: {
|
|
791
830
|
Version: "2012-10-17",
|
|
792
831
|
Statement: [
|
|
793
832
|
{
|
|
794
833
|
Effect: "Allow",
|
|
795
834
|
Action: "secretsmanager:GetSecretValue",
|
|
796
|
-
Resource: { Ref: "
|
|
835
|
+
Resource: { Ref: "AgentKeySecret" },
|
|
797
836
|
},
|
|
798
837
|
],
|
|
799
838
|
},
|
|
@@ -957,7 +996,7 @@ function getAwsTemplate(setup) {
|
|
|
957
996
|
/*
|
|
958
997
|
* The CloudFormation template the AWS command deploys, as JSON: also what a
|
|
959
998
|
* team that keeps its infrastructure in CloudFormation deploys itself, with
|
|
960
|
-
* VpcId, SubnetIds and
|
|
999
|
+
* VpcId, SubnetIds and AgentKey as its parameters.
|
|
961
1000
|
*/
|
|
962
1001
|
function getAwsCloudAiAgentTemplate(options) {
|
|
963
1002
|
return JSON.stringify(getAwsTemplate(checkedSetup(options, CloudPlatform_1.CloudProvider.AWS)));
|
|
@@ -989,7 +1028,7 @@ function writeAwsCommand(setup) {
|
|
|
989
1028
|
` echo "This Region has no default VPC with default subnets for the agent to run in. Run the command in a Region that has one, or create it with: aws ec2 create-default-vpc"`,
|
|
990
1029
|
"else",
|
|
991
1030
|
` [ "$(aws cloudformation describe-stacks ${stack} --query "Stacks[0].StackStatus" --output text 2> /dev/null)" = ROLLBACK_COMPLETE ] && aws cloudformation delete-stack ${stack} && aws cloudformation wait stack-delete-complete ${stack}`,
|
|
992
|
-
` aws cloudformation deploy ${stack} --template-file ${exports.AWS_CLOUD_AI_AGENT_TEMPLATE_FILE} --capabilities CAPABILITY_NAMED_IAM --no-fail-on-empty-changeset --parameter-overrides VpcId="$VPC" SubnetIds="$SUBNETS"
|
|
1031
|
+
` aws cloudformation deploy ${stack} --template-file ${exports.AWS_CLOUD_AI_AGENT_TEMPLATE_FILE} --capabilities CAPABILITY_NAMED_IAM --no-fail-on-empty-changeset --parameter-overrides VpcId="$VPC" SubnetIds="$SUBNETS" AgentKey=${(0, ShellWord_1.shellQuote)(setup.agentKey)} && echo "${exports.CLOUD_AI_AGENT_STARTED_MESSAGE}"`,
|
|
993
1032
|
"fi",
|
|
994
1033
|
].join("\n");
|
|
995
1034
|
}
|
|
@@ -1060,7 +1099,7 @@ function writeAzureCommand(setup) {
|
|
|
1060
1099
|
`az containerapp create ${subscription} --name ${CloudAiAgentNames_1.AZURE_CLOUD_AI_AGENT_APP_NAME} ${group}`,
|
|
1061
1100
|
`--environment ${CloudAiAgentNames_1.AZURE_CLOUD_AI_AGENT_ENVIRONMENT_NAME} --image ${setup.image}`,
|
|
1062
1101
|
`--cpu ${size.vcpu} --memory ${size.memoryGiB}Gi --min-replicas 1 --max-replicas 1 --system-assigned`,
|
|
1063
|
-
`--secrets ${exports.AZURE_CLOUD_AI_AGENT_SECRET_NAME}=${(0, ShellWord_1.shellQuote)(setup.
|
|
1102
|
+
`--secrets ${exports.AZURE_CLOUD_AI_AGENT_SECRET_NAME}=${(0, ShellWord_1.shellQuote)(setup.agentKey)}`,
|
|
1064
1103
|
`--env-vars ${variables.join(" ")}`,
|
|
1065
1104
|
"--output none &&",
|
|
1066
1105
|
].join(" "),
|
|
@@ -1079,8 +1118,9 @@ const GCP_PERMISSION_APIS = {
|
|
|
1079
1118
|
/*
|
|
1080
1119
|
* The APIs the Google Cloud command turns on: what the agent runs on
|
|
1081
1120
|
* (Compute Engine and Cloud Logging for its VM, or Cloud Run), IAM and
|
|
1082
|
-
* Resource Manager (the
|
|
1083
|
-
*
|
|
1121
|
+
* Resource Manager (the roles, the service accounts and their bindings),
|
|
1122
|
+
* IAM Credentials (each change's token of the write account), Secret
|
|
1123
|
+
* Manager (the key), and those of the operations turned on.
|
|
1084
1124
|
*/
|
|
1085
1125
|
function getGcpCloudAiAgentServices(enabledOperations, gcpHost = CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_DEFAULT_HOST) {
|
|
1086
1126
|
const services = [
|
|
@@ -1088,6 +1128,7 @@ function getGcpCloudAiAgentServices(enabledOperations, gcpHost = CloudAiAgentNam
|
|
|
1088
1128
|
? ["run.googleapis.com"]
|
|
1089
1129
|
: ["compute.googleapis.com", "logging.googleapis.com"]),
|
|
1090
1130
|
"iam.googleapis.com",
|
|
1131
|
+
"iamcredentials.googleapis.com",
|
|
1091
1132
|
"cloudresourcemanager.googleapis.com",
|
|
1092
1133
|
"secretmanager.googleapis.com",
|
|
1093
1134
|
];
|
|
@@ -1101,10 +1142,15 @@ function getGcpCloudAiAgentServices(enabledOperations, gcpHost = CloudAiAgentNam
|
|
|
1101
1142
|
}
|
|
1102
1143
|
/*
|
|
1103
1144
|
* Google Cloud, in Cloud Shell, in the project the command was written for
|
|
1104
|
-
* (every call names it): the APIs
|
|
1105
|
-
* exactly these permissions)
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1145
|
+
* (every call names it): the APIs; the two roles (created, or updated to
|
|
1146
|
+
* exactly these permissions) - the changes' for the write account, their
|
|
1147
|
+
* reads alone for the agent's own; the two service accounts (created when
|
|
1148
|
+
* they are not there) and their bindings, with the agent's own account
|
|
1149
|
+
* allowed to ask for a token of the write account and of no other (and no
|
|
1150
|
+
* longer holding the changes' role, as an agent set up before did); the key
|
|
1151
|
+
* as a new version of a Secret Manager secret only the agent's own account
|
|
1152
|
+
* may read - every older version destroyed once the new one is in - then
|
|
1153
|
+
* the agent on its host:
|
|
1108
1154
|
*
|
|
1109
1155
|
* - compute-engine (the default): a network of its own whose firewall
|
|
1110
1156
|
* lets nothing in (a VPC denies every connection in until a rule
|
|
@@ -1130,6 +1176,8 @@ function getGcpCloudAiAgentSetupCommand(options) {
|
|
|
1130
1176
|
}
|
|
1131
1177
|
// The service account the agent runs as, in the command's shell.
|
|
1132
1178
|
const GCP_MEMBER = `${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID}@$PROJECT_ID.iam.gserviceaccount.com`;
|
|
1179
|
+
// The service account its changes run as.
|
|
1180
|
+
const GCP_WRITE_MEMBER = `${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID}@$PROJECT_ID.iam.gserviceaccount.com`;
|
|
1133
1181
|
const GCP_PROJECT_FLAG = '--project "$PROJECT_ID"';
|
|
1134
1182
|
/*
|
|
1135
1183
|
* Whether an API is on in the project, as a shell condition: a list call
|
|
@@ -1140,7 +1188,7 @@ const GCP_PROJECT_FLAG = '--project "$PROJECT_ID"';
|
|
|
1140
1188
|
function gcpApiIsOn(api) {
|
|
1141
1189
|
return `gcloud services list ${GCP_PROJECT_FLAG} --enabled --filter "config.name=${api}" --format "value(config.name)" --quiet 2> /dev/null | grep -q .`;
|
|
1142
1190
|
}
|
|
1143
|
-
// What both hosts share: the APIs, the
|
|
1191
|
+
// What both hosts share: the APIs, the roles and their accounts, and the key.
|
|
1144
1192
|
function writeGcpCommandStart(setup) {
|
|
1145
1193
|
// The same title, description and permissions whether it creates or updates.
|
|
1146
1194
|
const role = [
|
|
@@ -1148,21 +1196,44 @@ function writeGcpCommandStart(setup) {
|
|
|
1148
1196
|
`--description ${(0, ShellWord_1.shellQuote)(ROLE_DESCRIPTION)}`,
|
|
1149
1197
|
'--permissions "$PERMISSIONS" --stage GA --quiet',
|
|
1150
1198
|
].join(" ");
|
|
1199
|
+
const readerRole = [
|
|
1200
|
+
`--title ${(0, ShellWord_1.shellQuote)(READER_ROLE_TITLE)}`,
|
|
1201
|
+
`--description ${(0, ShellWord_1.shellQuote)(READER_ROLE_DESCRIPTION)}`,
|
|
1202
|
+
'--permissions "$READ_PERMISSIONS" --stage GA --quiet',
|
|
1203
|
+
].join(" ");
|
|
1151
1204
|
const secret = exports.GCP_CLOUD_AI_AGENT_SECRET_NAME;
|
|
1152
1205
|
return [
|
|
1153
1206
|
`PROJECT_ID=${setup.accountId}`,
|
|
1154
1207
|
`PERMISSIONS=${(0, ShellWord_1.shellQuote)(getCloudAiAgentRolePermissions(CloudPlatform_1.CloudProvider.GCP, setup.operations).join(","))}`,
|
|
1208
|
+
`READ_PERMISSIONS=${(0, ShellWord_1.shellQuote)(getGcpCloudAiAgentReaderPermissions(setup.operations).join(","))}`,
|
|
1155
1209
|
`gcloud services enable ${getGcpCloudAiAgentServices(setup.operations, setup.gcpHost).join(" ")} ${GCP_PROJECT_FLAG}`,
|
|
1156
1210
|
`gcloud iam roles create ${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_ROLE_ID} ${GCP_PROJECT_FLAG} ${role} > /dev/null 2>&1 || gcloud iam roles update ${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_ROLE_ID} ${GCP_PROJECT_FLAG} ${role} > /dev/null`,
|
|
1211
|
+
`gcloud iam roles create ${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_READER_ROLE_ID} ${GCP_PROJECT_FLAG} ${readerRole} > /dev/null 2>&1 || gcloud iam roles update ${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_READER_ROLE_ID} ${GCP_PROJECT_FLAG} ${readerRole} > /dev/null`,
|
|
1157
1212
|
`gcloud iam service-accounts create ${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID} ${GCP_PROJECT_FLAG} --display-name ${(0, ShellWord_1.shellQuote)("OneUptime Cloud AI agent")} > /dev/null 2>&1 || true`,
|
|
1158
|
-
`gcloud
|
|
1213
|
+
`gcloud iam service-accounts create ${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID} ${GCP_PROJECT_FLAG} --display-name ${(0, ShellWord_1.shellQuote)("OneUptime Cloud AI agent: changes")} > /dev/null 2>&1 || true`,
|
|
1214
|
+
// The changes' role is the write account's; the agent's own account reads.
|
|
1215
|
+
`gcloud projects add-iam-policy-binding "$PROJECT_ID" --member "serviceAccount:${GCP_WRITE_MEMBER}" --role "projects/$PROJECT_ID/roles/${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_ROLE_ID}" --condition=None > /dev/null`,
|
|
1216
|
+
`gcloud projects add-iam-policy-binding "$PROJECT_ID" --member "serviceAccount:${GCP_MEMBER}" --role "projects/$PROJECT_ID/roles/${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_READER_ROLE_ID}" --condition=None > /dev/null`,
|
|
1217
|
+
// A token of the write account, for a change: the agent's own account may ask for one, on that account alone.
|
|
1218
|
+
`gcloud iam service-accounts add-iam-policy-binding "${GCP_WRITE_MEMBER}" ${GCP_PROJECT_FLAG} --member "serviceAccount:${GCP_MEMBER}" --role ${exports.GCP_TOKEN_CREATOR_ROLE} --condition=None > /dev/null`,
|
|
1219
|
+
// An agent set up before held the changes' role itself: no longer.
|
|
1220
|
+
`gcloud projects remove-iam-policy-binding "$PROJECT_ID" --member "serviceAccount:${GCP_MEMBER}" --role "projects/$PROJECT_ID/roles/${CloudAiAgentNames_1.GCP_CLOUD_AI_AGENT_ROLE_ID}" --condition=None > /dev/null 2>&1 || true`,
|
|
1159
1221
|
// The key: a secret only the agent's service account may read.
|
|
1160
1222
|
`cat > ${exports.GCP_CLOUD_AI_AGENT_KEY_FILE} <<'${exports.GCP_CLOUD_AI_AGENT_KEY_FILE_END}'`,
|
|
1161
|
-
setup.
|
|
1223
|
+
setup.agentKey,
|
|
1162
1224
|
exports.GCP_CLOUD_AI_AGENT_KEY_FILE_END,
|
|
1163
1225
|
`gcloud secrets create ${secret} ${GCP_PROJECT_FLAG} --replication-policy automatic > /dev/null 2>&1 || true`,
|
|
1164
|
-
`tr -d '\\n' < ${exports.GCP_CLOUD_AI_AGENT_KEY_FILE} | gcloud secrets versions add ${secret} ${GCP_PROJECT_FLAG} --data-file=-
|
|
1226
|
+
`KEY_VERSION=$(tr -d '\\n' < ${exports.GCP_CLOUD_AI_AGENT_KEY_FILE} | gcloud secrets versions add ${secret} ${GCP_PROJECT_FLAG} --data-file=- --format "value(name.basename())")`,
|
|
1165
1227
|
`rm ${exports.GCP_CLOUD_AI_AGENT_KEY_FILE}`,
|
|
1228
|
+
/*
|
|
1229
|
+
* Every older version of the secret is destroyed once the new one is in:
|
|
1230
|
+
* the agent reads the latest, and an older one holds a key that no
|
|
1231
|
+
* longer connects anything (or, from before agents had keys of their
|
|
1232
|
+
* own, the project's ingestion key) for its service account to read.
|
|
1233
|
+
* Only when the new version was added: a run that failed to add it
|
|
1234
|
+
* leaves the one that works.
|
|
1235
|
+
*/
|
|
1236
|
+
`if [ -n "$KEY_VERSION" ]; then for VERSION in $(gcloud secrets versions list ${secret} ${GCP_PROJECT_FLAG} --filter "state:ENABLED OR state:DISABLED" --format "value(name.basename())" --quiet); do [ "$VERSION" = "$KEY_VERSION" ] || gcloud secrets versions destroy "$VERSION" --secret ${secret} ${GCP_PROJECT_FLAG} --quiet > /dev/null; done; fi`,
|
|
1166
1237
|
`gcloud secrets add-iam-policy-binding ${secret} ${GCP_PROJECT_FLAG} --member "serviceAccount:${GCP_MEMBER}" --role ${exports.GCP_SECRET_ACCESSOR_ROLE} --condition=None > /dev/null`,
|
|
1167
1238
|
];
|
|
1168
1239
|
}
|
|
@@ -1184,7 +1255,7 @@ function writeGcpStartupScript(setup) {
|
|
|
1184
1255
|
const variables = environmentOf(setup);
|
|
1185
1256
|
const keyVariable = ((_a = variables.find((variable) => {
|
|
1186
1257
|
return variable.isSecret;
|
|
1187
|
-
})) === null || _a === void 0 ? void 0 : _a.name) || exports.
|
|
1258
|
+
})) === null || _a === void 0 ? void 0 : _a.name) || exports.CLOUD_AI_AGENT_KEY_ENV;
|
|
1188
1259
|
const run = exports.GCP_CLOUD_AI_AGENT_RUN_DIRECTORY;
|
|
1189
1260
|
/*
|
|
1190
1261
|
* No #! line: the guest environment runs a startup script with bash, and
|
|
@@ -7,7 +7,7 @@ export const CLOUD_AI_AGENT_DEFAULT_REGIONS = commonJsModule.CLOUD_AI_AGENT_DEFA
|
|
|
7
7
|
export const CLOUD_AI_AGENT_FIXES_MODES = commonJsModule.CLOUD_AI_AGENT_FIXES_MODES;
|
|
8
8
|
export const CLOUD_AI_AGENT_HEALTH_HOST_ENV = commonJsModule.CLOUD_AI_AGENT_HEALTH_HOST_ENV;
|
|
9
9
|
export const CLOUD_AI_AGENT_IMAGE_TAG = commonJsModule.CLOUD_AI_AGENT_IMAGE_TAG;
|
|
10
|
-
export const
|
|
10
|
+
export const CLOUD_AI_AGENT_KEY_ENV = commonJsModule.CLOUD_AI_AGENT_KEY_ENV;
|
|
11
11
|
export const CLOUD_AI_AGENT_ONEUPTIME_URL_ENV = commonJsModule.CLOUD_AI_AGENT_ONEUPTIME_URL_ENV;
|
|
12
12
|
export const CLOUD_AI_AGENT_SIZES = commonJsModule.CLOUD_AI_AGENT_SIZES;
|
|
13
13
|
export const CLOUD_AI_AGENT_STARTED_MESSAGE = commonJsModule.CLOUD_AI_AGENT_STARTED_MESSAGE;
|
|
@@ -30,6 +30,7 @@ export const GCP_CLOUD_AI_AGENT_STARTUP_FILE = commonJsModule.GCP_CLOUD_AI_AGENT
|
|
|
30
30
|
export const GCP_CLOUD_AI_AGENT_SUBNET_RANGE = commonJsModule.GCP_CLOUD_AI_AGENT_SUBNET_RANGE;
|
|
31
31
|
export const GCP_CLOUD_AI_AGENT_VM_REFUSED_MESSAGE = commonJsModule.GCP_CLOUD_AI_AGENT_VM_REFUSED_MESSAGE;
|
|
32
32
|
export const GCP_SECRET_ACCESSOR_ROLE = commonJsModule.GCP_SECRET_ACCESSOR_ROLE;
|
|
33
|
+
export const GCP_TOKEN_CREATOR_ROLE = commonJsModule.GCP_TOKEN_CREATOR_ROLE;
|
|
33
34
|
export const describeCloudAiAgentSetupProblem = commonJsModule.describeCloudAiAgentSetupProblem;
|
|
34
35
|
export const getAwsCloudAiAgentSetupCommand = commonJsModule.getAwsCloudAiAgentSetupCommand;
|
|
35
36
|
export const getAwsCloudAiAgentTemplate = commonJsModule.getAwsCloudAiAgentTemplate;
|
|
@@ -43,7 +44,9 @@ export const getCloudAiAgentImage = commonJsModule.getCloudAiAgentImage;
|
|
|
43
44
|
export const getCloudAiAgentMaxProtectedTargets = commonJsModule.getCloudAiAgentMaxProtectedTargets;
|
|
44
45
|
export const getCloudAiAgentRolePermissions = commonJsModule.getCloudAiAgentRolePermissions;
|
|
45
46
|
export const getCloudAiAgentSetupCommand = commonJsModule.getCloudAiAgentSetupCommand;
|
|
47
|
+
export const getGcpCloudAiAgentReaderPermissions = commonJsModule.getGcpCloudAiAgentReaderPermissions;
|
|
46
48
|
export const getGcpCloudAiAgentServices = commonJsModule.getGcpCloudAiAgentServices;
|
|
47
49
|
export const getGcpCloudAiAgentSetupCommand = commonJsModule.getGcpCloudAiAgentSetupCommand;
|
|
48
50
|
export const getGcpCloudAiAgentStartupScript = commonJsModule.getGcpCloudAiAgentStartupScript;
|
|
51
|
+
export const getGcpCloudAiAgentWriteServiceAccount = commonJsModule.getGcpCloudAiAgentWriteServiceAccount;
|
|
49
52
|
export const isReadableCloudAiAgentProtectedTarget = commonJsModule.isReadableCloudAiAgentProtectedTarget;
|
|
@@ -11,6 +11,9 @@ export declare const CLOUD_STREAM_MAX_REQUEST_BYTES: number;
|
|
|
11
11
|
export declare const CLOUD_STREAM_MAX_DECODED_BYTES: number;
|
|
12
12
|
export declare const CLOUD_STREAM_MAX_RECORD_DECODED_BYTES: number;
|
|
13
13
|
export declare const CLOUD_STREAM_REQUESTS_PER_MINUTE: number;
|
|
14
|
+
export declare const CLOUD_STREAM_KEYED_CONNECTIONS_REFRESH_MS: number;
|
|
15
|
+
export declare const CLOUD_STREAM_KEYED_CONNECTIONS_MISS_REFRESH_MS: number;
|
|
16
|
+
export declare const CLOUD_STREAM_MAX_KEYED_CONNECTIONS: number;
|
|
14
17
|
export declare const CLOUD_STREAM_BUFFER_SIZE_MIB: number;
|
|
15
18
|
export declare const CLOUD_STREAM_BUFFER_INTERVAL_SECONDS: number;
|
|
16
19
|
export declare const CLOUD_STREAM_RETRY_DURATION_SECONDS: number;
|
|
@@ -102,6 +105,7 @@ export interface CloudStreamKeyHashes {
|
|
|
102
105
|
previous?: Array<CloudStreamPreviousKeyHash> | undefined;
|
|
103
106
|
}
|
|
104
107
|
export declare const CLOUD_STREAM_MAX_PREVIOUS_KEYS: number;
|
|
108
|
+
export declare const CLOUD_STREAM_KEY_WRITE_ATTEMPTS: number;
|
|
105
109
|
export declare function readCloudStreamKeyHashes(value: unknown): CloudStreamKeyHashes;
|
|
106
110
|
export declare function getLiveCloudStreamKeyHashes(data: {
|
|
107
111
|
hashes: CloudStreamKeyHashes;
|
|
@@ -11,6 +11,9 @@ export declare const CLOUD_STREAM_MAX_REQUEST_BYTES: number;
|
|
|
11
11
|
export declare const CLOUD_STREAM_MAX_DECODED_BYTES: number;
|
|
12
12
|
export declare const CLOUD_STREAM_MAX_RECORD_DECODED_BYTES: number;
|
|
13
13
|
export declare const CLOUD_STREAM_REQUESTS_PER_MINUTE: number;
|
|
14
|
+
export declare const CLOUD_STREAM_KEYED_CONNECTIONS_REFRESH_MS: number;
|
|
15
|
+
export declare const CLOUD_STREAM_KEYED_CONNECTIONS_MISS_REFRESH_MS: number;
|
|
16
|
+
export declare const CLOUD_STREAM_MAX_KEYED_CONNECTIONS: number;
|
|
14
17
|
export declare const CLOUD_STREAM_BUFFER_SIZE_MIB: number;
|
|
15
18
|
export declare const CLOUD_STREAM_BUFFER_INTERVAL_SECONDS: number;
|
|
16
19
|
export declare const CLOUD_STREAM_RETRY_DURATION_SECONDS: number;
|
|
@@ -102,6 +105,7 @@ export interface CloudStreamKeyHashes {
|
|
|
102
105
|
previous?: Array<CloudStreamPreviousKeyHash> | undefined;
|
|
103
106
|
}
|
|
104
107
|
export declare const CLOUD_STREAM_MAX_PREVIOUS_KEYS: number;
|
|
108
|
+
export declare const CLOUD_STREAM_KEY_WRITE_ATTEMPTS: number;
|
|
105
109
|
export declare function readCloudStreamKeyHashes(value: unknown): CloudStreamKeyHashes;
|
|
106
110
|
export declare function getLiveCloudStreamKeyHashes(data: {
|
|
107
111
|
hashes: CloudStreamKeyHashes;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CLOUD_STREAM_MAX_PREVIOUS_KEYS = exports.CLOUD_STREAM_REFUSAL_REASONS = exports.CloudStreamRefusalReason = exports.CLOUD_STREAM_MAX_KEY_LENGTH = exports.CLOUD_STREAM_KEY_SECRET_LENGTH = exports.CLOUD_STREAM_KEY_PREFIX = exports.CLOUD_STREAM_MAX_NAME_LENGTH = exports.CLOUD_STREAM_MAX_LOG_GROUPS_PER_SOURCE = exports.CLOUD_STREAM_MAX_NAMESPACES_PER_SOURCE = exports.CLOUD_STREAM_MAX_SOURCES = exports.CLOUD_STREAM_SOURCE_RETENTION_MS = exports.CLOUD_STREAM_ACTIVE_WINDOW_MS = exports.CLOUD_STREAM_PREVIOUS_KEY_GRACE_MS = exports.CLOUD_STREAM_FAILED_DELIVERY_DAYS = exports.CLOUD_STREAM_RETRY_DURATION_SECONDS = exports.CLOUD_STREAM_BUFFER_INTERVAL_SECONDS = exports.CLOUD_STREAM_BUFFER_SIZE_MIB = exports.CLOUD_STREAM_REQUESTS_PER_MINUTE = exports.CLOUD_STREAM_MAX_RECORD_DECODED_BYTES = exports.CLOUD_STREAM_MAX_DECODED_BYTES = exports.CLOUD_STREAM_MAX_REQUEST_BYTES = exports.FIREHOSE_MAX_RECORD_DATA_LENGTH = exports.FIREHOSE_MAX_RECORDS = exports.FIREHOSE_PROTOCOL_VERSION_HEADER = exports.FIREHOSE_SOURCE_ARN_HEADER = exports.FIREHOSE_REQUEST_ID_HEADER = exports.FIREHOSE_ACCESS_KEY_HEADER = exports.CLOUD_STREAM_LOGS_PATH = exports.CLOUD_STREAM_METRICS_PATH = exports.CLOUD_STREAM_URL_PREFIX = void 0;
|
|
6
|
+
exports.CLOUD_STREAM_KEY_WRITE_ATTEMPTS = exports.CLOUD_STREAM_MAX_PREVIOUS_KEYS = exports.CLOUD_STREAM_REFUSAL_REASONS = exports.CloudStreamRefusalReason = exports.CLOUD_STREAM_MAX_KEY_LENGTH = exports.CLOUD_STREAM_KEY_SECRET_LENGTH = exports.CLOUD_STREAM_KEY_PREFIX = exports.CLOUD_STREAM_MAX_NAME_LENGTH = exports.CLOUD_STREAM_MAX_LOG_GROUPS_PER_SOURCE = exports.CLOUD_STREAM_MAX_NAMESPACES_PER_SOURCE = exports.CLOUD_STREAM_MAX_SOURCES = exports.CLOUD_STREAM_SOURCE_RETENTION_MS = exports.CLOUD_STREAM_ACTIVE_WINDOW_MS = exports.CLOUD_STREAM_PREVIOUS_KEY_GRACE_MS = exports.CLOUD_STREAM_FAILED_DELIVERY_DAYS = exports.CLOUD_STREAM_RETRY_DURATION_SECONDS = exports.CLOUD_STREAM_BUFFER_INTERVAL_SECONDS = exports.CLOUD_STREAM_BUFFER_SIZE_MIB = exports.CLOUD_STREAM_MAX_KEYED_CONNECTIONS = exports.CLOUD_STREAM_KEYED_CONNECTIONS_MISS_REFRESH_MS = exports.CLOUD_STREAM_KEYED_CONNECTIONS_REFRESH_MS = exports.CLOUD_STREAM_REQUESTS_PER_MINUTE = exports.CLOUD_STREAM_MAX_RECORD_DECODED_BYTES = exports.CLOUD_STREAM_MAX_DECODED_BYTES = exports.CLOUD_STREAM_MAX_REQUEST_BYTES = exports.FIREHOSE_MAX_RECORD_DATA_LENGTH = exports.FIREHOSE_MAX_RECORDS = exports.FIREHOSE_PROTOCOL_VERSION_HEADER = exports.FIREHOSE_SOURCE_ARN_HEADER = exports.FIREHOSE_REQUEST_ID_HEADER = exports.FIREHOSE_ACCESS_KEY_HEADER = exports.CLOUD_STREAM_LOGS_PATH = exports.CLOUD_STREAM_METRICS_PATH = exports.CLOUD_STREAM_URL_PREFIX = void 0;
|
|
7
7
|
exports.buildCloudStreamKey = buildCloudStreamKey;
|
|
8
8
|
exports.parseCloudStreamKey = parseCloudStreamKey;
|
|
9
9
|
exports.getCloudStreamEndpoints = getCloudStreamEndpoints;
|
|
@@ -85,6 +85,17 @@ exports.CLOUD_STREAM_MAX_RECORD_DECODED_BYTES = 8 * 1024 * 1024;
|
|
|
85
85
|
* batch again later.
|
|
86
86
|
*/
|
|
87
87
|
exports.CLOUD_STREAM_REQUESTS_PER_MINUTE = 600;
|
|
88
|
+
/*
|
|
89
|
+
* Which connections hold a stream key, as each server knows them
|
|
90
|
+
* (CloudStreamKeyedConnections): read all at once, again at most once a
|
|
91
|
+
* minute - and at most every 10 seconds when a delivery names one it does
|
|
92
|
+
* not know, so a key made on another server is known within seconds. A
|
|
93
|
+
* delivery naming any other connection is refused without a read. Past the
|
|
94
|
+
* most kept, each delivery's connection is read instead.
|
|
95
|
+
*/
|
|
96
|
+
exports.CLOUD_STREAM_KEYED_CONNECTIONS_REFRESH_MS = 60 * 1000;
|
|
97
|
+
exports.CLOUD_STREAM_KEYED_CONNECTIONS_MISS_REFRESH_MS = 10 * 1000;
|
|
98
|
+
exports.CLOUD_STREAM_MAX_KEYED_CONNECTIONS = 50000;
|
|
88
99
|
// What the template sets each Firehose stream to.
|
|
89
100
|
exports.CLOUD_STREAM_BUFFER_SIZE_MIB = 1;
|
|
90
101
|
exports.CLOUD_STREAM_BUFFER_INTERVAL_SECONDS = 60;
|
|
@@ -447,6 +458,12 @@ function getCloudStreamState(data) {
|
|
|
447
458
|
* stop the key the streams deliver with.
|
|
448
459
|
*/
|
|
449
460
|
exports.CLOUD_STREAM_MAX_PREVIOUS_KEYS = 3;
|
|
461
|
+
/*
|
|
462
|
+
* How many times a new key is written when other keys of the connection are
|
|
463
|
+
* written at the same moment: each try reads the hashes again and rotates
|
|
464
|
+
* the newer ones, so two admins making a key at once both keep theirs.
|
|
465
|
+
*/
|
|
466
|
+
exports.CLOUD_STREAM_KEY_WRITE_ATTEMPTS = 5;
|
|
450
467
|
function isSha256Hex(value) {
|
|
451
468
|
return typeof value === "string" && value.length === 64 && isLowerHex(value);
|
|
452
469
|
}
|
|
@@ -3,10 +3,14 @@ export const CLOUD_STREAM_ACTIVE_WINDOW_MS = commonJsModule.CLOUD_STREAM_ACTIVE_
|
|
|
3
3
|
export const CLOUD_STREAM_BUFFER_INTERVAL_SECONDS = commonJsModule.CLOUD_STREAM_BUFFER_INTERVAL_SECONDS;
|
|
4
4
|
export const CLOUD_STREAM_BUFFER_SIZE_MIB = commonJsModule.CLOUD_STREAM_BUFFER_SIZE_MIB;
|
|
5
5
|
export const CLOUD_STREAM_FAILED_DELIVERY_DAYS = commonJsModule.CLOUD_STREAM_FAILED_DELIVERY_DAYS;
|
|
6
|
+
export const CLOUD_STREAM_KEYED_CONNECTIONS_MISS_REFRESH_MS = commonJsModule.CLOUD_STREAM_KEYED_CONNECTIONS_MISS_REFRESH_MS;
|
|
7
|
+
export const CLOUD_STREAM_KEYED_CONNECTIONS_REFRESH_MS = commonJsModule.CLOUD_STREAM_KEYED_CONNECTIONS_REFRESH_MS;
|
|
6
8
|
export const CLOUD_STREAM_KEY_PREFIX = commonJsModule.CLOUD_STREAM_KEY_PREFIX;
|
|
7
9
|
export const CLOUD_STREAM_KEY_SECRET_LENGTH = commonJsModule.CLOUD_STREAM_KEY_SECRET_LENGTH;
|
|
10
|
+
export const CLOUD_STREAM_KEY_WRITE_ATTEMPTS = commonJsModule.CLOUD_STREAM_KEY_WRITE_ATTEMPTS;
|
|
8
11
|
export const CLOUD_STREAM_LOGS_PATH = commonJsModule.CLOUD_STREAM_LOGS_PATH;
|
|
9
12
|
export const CLOUD_STREAM_MAX_DECODED_BYTES = commonJsModule.CLOUD_STREAM_MAX_DECODED_BYTES;
|
|
13
|
+
export const CLOUD_STREAM_MAX_KEYED_CONNECTIONS = commonJsModule.CLOUD_STREAM_MAX_KEYED_CONNECTIONS;
|
|
10
14
|
export const CLOUD_STREAM_MAX_KEY_LENGTH = commonJsModule.CLOUD_STREAM_MAX_KEY_LENGTH;
|
|
11
15
|
export const CLOUD_STREAM_MAX_LOG_GROUPS_PER_SOURCE = commonJsModule.CLOUD_STREAM_MAX_LOG_GROUPS_PER_SOURCE;
|
|
12
16
|
export const CLOUD_STREAM_MAX_NAMESPACES_PER_SOURCE = commonJsModule.CLOUD_STREAM_MAX_NAMESPACES_PER_SOURCE;
|
|
@@ -72,6 +72,8 @@ export declare function getCloudStreamCommandRegions(data: {
|
|
|
72
72
|
logGroups?: Array<CloudStreamLogGroup> | undefined;
|
|
73
73
|
metrics: CloudStreamMetricsMode;
|
|
74
74
|
}): Array<string>;
|
|
75
|
+
export declare const AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP: number;
|
|
76
|
+
export declare const CLOUD_STREAM_COMMAND_STOPPED: string;
|
|
75
77
|
export declare function getAwsCloudStreamCommand(data: {
|
|
76
78
|
options: CloudStreamTemplateOptions;
|
|
77
79
|
regions: Array<string>;
|
|
@@ -72,6 +72,8 @@ export declare function getCloudStreamCommandRegions(data: {
|
|
|
72
72
|
logGroups?: Array<CloudStreamLogGroup> | undefined;
|
|
73
73
|
metrics: CloudStreamMetricsMode;
|
|
74
74
|
}): Array<string>;
|
|
75
|
+
export declare const AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP: number;
|
|
76
|
+
export declare const CLOUD_STREAM_COMMAND_STOPPED: string;
|
|
75
77
|
export declare function getAwsCloudStreamCommand(data: {
|
|
76
78
|
options: CloudStreamTemplateOptions;
|
|
77
79
|
regions: Array<string>;
|