diff --git a/src/getStepStartStates.ts b/src/getStepStartStates.ts index 0ae30cbc..45be9af0 100644 --- a/src/getStepStartStates.ts +++ b/src/getStepStartStates.ts @@ -161,7 +161,7 @@ import { STEP_SPANNER_INSTANCE_DATABASES, } from './steps/spanner/constants'; import { SqlAdminSteps, STEP_SQL_ADMIN_INSTANCES } from './steps/sql-admin'; -import { STEP_CLOUD_STORAGE_BUCKETS } from './steps/storage'; +import { StorageStepsSpec } from './steps/storage/constants'; import { IntegrationConfig, SerializedIntegrationConfig } from './types'; import { deserializeIntegrationConfig } from './utils/integrationConfig'; import { isMasterOrganizationInstance } from './utils/isMasterOrganizationInstance'; @@ -305,7 +305,7 @@ function getDefaultStepStartStates(params: { [STEP_CLOUD_FUNCTIONS_SERVICE_ACCOUNT_RELATIONSHIPS]: { disabled: false }, [STEP_CLOUD_FUNCTIONS_SOURCE_REPO_RELATIONSHIPS]: { disabled: false }, [STEP_CLOUD_FUNCTIONS_STORAGE_BUCKET_RELATIONSHIPS]: { disabled: false }, - [STEP_CLOUD_STORAGE_BUCKETS]: { disabled: false }, + [StorageStepsSpec.FETCH_STORAGE_BUCKETS.id]: { disabled: false }, [STEP_IAM_CUSTOM_ROLES]: { disabled: false }, [STEP_IAM_CUSTOM_ROLE_SERVICE_API_RELATIONSHIPS]: { disabled: false }, [STEP_IAM_MANAGED_ROLES]: { disabled: false }, @@ -601,7 +601,7 @@ async function getStepStartStatesUsingServiceEnablements(params: { [STEP_CLOUD_FUNCTIONS_STORAGE_BUCKET_RELATIONSHIPS]: createStepStartState( ServiceUsageName.CLOUD_FUNCTIONS, ), - [STEP_CLOUD_STORAGE_BUCKETS]: createStepStartState( + [StorageStepsSpec.FETCH_STORAGE_BUCKETS.id]: createStepStartState( ServiceUsageName.STORAGE, ServiceUsageName.STORAGE_COMPONENT, ServiceUsageName.STORAGE_API, diff --git a/src/index.test.ts b/src/index.test.ts index c2b2e1b8..c1624b85 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -169,7 +169,6 @@ import { STEP_SPANNER_INSTANCE_DATABASES, } from './steps/spanner/constants'; import { SqlAdminSteps, STEP_SQL_ADMIN_INSTANCES } from './steps/sql-admin'; -import { STEP_CLOUD_STORAGE_BUCKETS } from './steps/storage'; import { IntegrationConfig } from './types'; import { STEP_CLOUD_FUNCTIONS, @@ -177,6 +176,7 @@ import { STEP_CLOUD_FUNCTIONS_SOURCE_REPO_RELATIONSHIPS, STEP_CLOUD_FUNCTIONS_STORAGE_BUCKET_RELATIONSHIPS, } from './steps/functions'; +import { StorageStepsSpec } from './steps/storage/constants'; interface ValidateInvocationInvalidConfigTestParams { instanceConfig?: Partial; @@ -334,7 +334,7 @@ describe('#getStepStartStates success', () => { [STEP_CLOUD_FUNCTIONS_STORAGE_BUCKET_RELATIONSHIPS]: { disabled: false, }, - [STEP_CLOUD_STORAGE_BUCKETS]: { + [StorageStepsSpec.FETCH_STORAGE_BUCKETS.id]: { disabled: false, }, [STEP_IAM_CUSTOM_ROLES]: { diff --git a/src/steps/app-engine/index.ts b/src/steps/app-engine/index.ts index a5e9dee1..85e6ff47 100644 --- a/src/steps/app-engine/index.ts +++ b/src/steps/app-engine/index.ts @@ -40,16 +40,13 @@ import { createAppEngineVersionEntity, } from './converters'; import { getCloudStorageBucketKey } from '../storage/converters'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - STEP_CLOUD_STORAGE_BUCKETS, -} from '../storage'; import { IAM_SERVICE_ACCOUNT_ENTITY_TYPE, GOOGLE_USER_ENTITY_TYPE, STEP_IAM_SERVICE_ACCOUNTS, } from '../iam/constants'; import { isServiceAccountEmail } from '../../utils/iam'; +import { StorageEntitiesSpec, StorageStepsSpec } from '../storage/constants'; async function withAppEngineErrorHandling( logger: IntegrationLogger, @@ -404,10 +401,13 @@ export const appEngineSteps: IntegrationStep[] = [ _class: RelationshipClass.USES, _type: RELATIONSHIP_TYPE_APP_ENGINE_APPLICATION_USES_BUCKET, sourceType: ENTITY_TYPE_APP_ENGINE_APPLICATION, - targetType: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + targetType: StorageEntitiesSpec.STORAGE_BUCKET._type, }, ], - dependsOn: [STEP_APP_ENGINE_APPLICATION, STEP_CLOUD_STORAGE_BUCKETS], + dependsOn: [ + STEP_APP_ENGINE_APPLICATION, + StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, + ], executionHandler: buildAppEngineApplicationUsesBucketRelationships, }, { diff --git a/src/steps/cloud-asset/index.test.ts b/src/steps/cloud-asset/index.test.ts index 4a34b56a..1a1d06c7 100644 --- a/src/steps/cloud-asset/index.test.ts +++ b/src/steps/cloud-asset/index.test.ts @@ -37,13 +37,11 @@ import { fetchBigQueryDatasets, BIG_QUERY_DATASET_ENTITY_TYPE, } from '../big-query'; -import { - fetchStorageBuckets, - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, -} from '../storage'; +import { fetchStorageBuckets } from '../storage'; import { CLOUD_FUNCTION_ENTITY_TYPE, fetchCloudFunctions } from '../functions'; import { IAM_MANAGED_ROLES_DATA_JOB_STATE_KEY } from '../../utils/iam'; import { fetchApiServices } from '../service-usage'; +import { StorageEntitiesSpec } from '../storage/constants'; /* eslint-disable no-console */ expect.extend({ @@ -660,7 +658,7 @@ describe('#fetchIamBindings', () => { await fetchStorageBuckets(context); const storageBuckets = context.jobState.collectedEntities.filter( - (e) => e._type === CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + (e) => e._type === StorageEntitiesSpec.STORAGE_BUCKET._type, ); expect(storageBuckets.length).toBeGreaterThan(0); diff --git a/src/steps/cloud-build/constants.ts b/src/steps/cloud-build/constants.ts index 2bf865b9..b275d47d 100644 --- a/src/steps/cloud-build/constants.ts +++ b/src/steps/cloud-build/constants.ts @@ -1,6 +1,6 @@ import { RelationshipClass } from '@jupiterone/integration-sdk-core'; import { CloudSourceRepositoriesEntitiesSpec } from '../cloud-source-repositories/constants'; -import { CLOUD_STORAGE_BUCKET_ENTITY_TYPE } from '../storage'; +import { StorageEntitiesSpec } from '../storage/constants'; export const CloudBuildEntitiesSpec = { BUILD: { @@ -52,7 +52,7 @@ export const CloudBuildRelationshipsSpec = { _type: 'google_cloud_build_uses_storage_bucket', _class: RelationshipClass.USES, sourceType: CloudBuildEntitiesSpec.BUILD._type, - targetType: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + targetType: StorageEntitiesSpec.STORAGE_BUCKET._type, }, BUILD_USES_SOURCE_REPOSITORY: { _type: 'google_cloud_build_uses_source_repository', diff --git a/src/steps/cloud-build/steps/build-cloud-build-uses-storage-bucket-relationships.ts b/src/steps/cloud-build/steps/build-cloud-build-uses-storage-bucket-relationships.ts index a244ded5..215b32f3 100644 --- a/src/steps/cloud-build/steps/build-cloud-build-uses-storage-bucket-relationships.ts +++ b/src/steps/cloud-build/steps/build-cloud-build-uses-storage-bucket-relationships.ts @@ -6,7 +6,7 @@ import { } from '@jupiterone/integration-sdk-core'; import { cloudbuild_v1 } from 'googleapis'; import { IntegrationConfig, IntegrationStepContext } from '../../../types'; -import { STEP_CLOUD_STORAGE_BUCKETS } from '../../storage'; +import { StorageStepsSpec } from '../../storage/constants'; import { CloudBuildEntitiesSpec, CloudBuildRelationshipsSpec, @@ -20,7 +20,7 @@ export const buildCloudBuildUsesStorageBucketRelationshipsStep: IntegrationStep< relationships: [CloudBuildRelationshipsSpec.BUILD_USES_STORAGE_BUCKET], dependsOn: [ CloudBuildStepsSpec.FETCH_BUILDS.id, - STEP_CLOUD_STORAGE_BUCKETS, + StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, ], executionHandler: async function (context: IntegrationStepContext) { const { jobState } = context; diff --git a/src/steps/compute/index.test.ts b/src/steps/compute/index.test.ts index b64e17f5..66fb8fdd 100644 --- a/src/steps/compute/index.test.ts +++ b/src/steps/compute/index.test.ts @@ -38,10 +38,7 @@ import { buildComputeBackendBucketHasBucketRelationships, buildImageUsesKmsRelationships, } from '.'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - fetchStorageBuckets, -} from '../storage'; +import { fetchStorageBuckets } from '../storage'; import { integrationConfig } from '../../../test/config'; import { ENTITY_TYPE_COMPUTE_DISK, @@ -109,6 +106,7 @@ import { fetchIamServiceAccounts } from '../iam'; import { fetchKmsCryptoKeys, fetchKmsKeyRings } from '../kms'; import { filterGraphObjects } from '../../../test/helpers/filterGraphObjects'; import { separateDirectMappedRelationships } from '../../../test/helpers/separateDirectMappedRelationships'; +import { StorageEntitiesSpec } from '../storage/constants'; const tempNewAccountConfig = { ...integrationConfig, @@ -1510,7 +1508,7 @@ describe('#fetchComputeBackendBuckets', () => { expect( context.jobState.collectedEntities.filter( - (e) => e._type === CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + (e) => e._type === StorageEntitiesSpec.STORAGE_BUCKET._type, ), ).toMatchGraphObjectSchema({ _class: ['DataStore'], diff --git a/src/steps/compute/index.ts b/src/steps/compute/index.ts index 5a542d5b..003aba74 100644 --- a/src/steps/compute/index.ts +++ b/src/steps/compute/index.ts @@ -179,10 +179,6 @@ import { getFirewallRelationshipDirection, processFirewallRuleRelationshipTargets, } from '../../utils/firewall'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - STEP_CLOUD_STORAGE_BUCKETS, -} from '../storage'; import { getCloudStorageBucketKey } from '../storage/converters'; import { publishMissingPermissionEvent } from '../../utils/events'; import { parseRegionNameFromRegionUrl } from '../../google-cloud/regions'; @@ -201,6 +197,7 @@ import { setNetworkPeerings, setPeeredNetworks, } from '../../utils/jobState'; +import { StorageEntitiesSpec, StorageStepsSpec } from '../storage/constants'; export * from './constants'; @@ -1028,7 +1025,7 @@ export async function fetchComputeAddresses( await client.iterateComputeAddresses(async (address) => { const addressEntity = await jobState.addEntity( - createComputeAddressEntity(address, client.projectId) + createComputeAddressEntity(address, client.projectId), ); // Subnetwork -> HAS -> Compute Address @@ -2578,10 +2575,13 @@ export const computeSteps: IntegrationStep[] = [ _class: RelationshipClass.HAS, _type: RELATIONSHIP_TYPE_BACKEND_BUCKET_HAS_STORAGE_BUCKET, sourceType: ENTITY_TYPE_COMPUTE_BACKEND_BUCKET, - targetType: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + targetType: StorageEntitiesSpec.STORAGE_BUCKET._type, }, ], - dependsOn: [STEP_COMPUTE_BACKEND_BUCKETS, STEP_CLOUD_STORAGE_BUCKETS], + dependsOn: [ + STEP_COMPUTE_BACKEND_BUCKETS, + StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, + ], executionHandler: buildComputeBackendBucketHasBucketRelationships, }, { diff --git a/src/steps/dataproc/index.test.ts b/src/steps/dataproc/index.test.ts index f8b398e3..fb8b7bf0 100644 --- a/src/steps/dataproc/index.test.ts +++ b/src/steps/dataproc/index.test.ts @@ -18,13 +18,11 @@ import { RELATIONSHIP_TYPE_DATAPROC_CLUSTER_USES_STORAGE_BUCKET, } from './constants'; import { fetchKmsCryptoKeys, fetchKmsKeyRings } from '../kms'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - fetchStorageBuckets, -} from '../storage'; +import { fetchStorageBuckets } from '../storage'; import { ENTITY_TYPE_COMPUTE_IMAGE, fetchComputeImages } from '../compute'; import { separateDirectMappedRelationships } from '../../../test/helpers/separateDirectMappedRelationships'; import { omitNewRegionsFromTests } from '../../../test/regions'; +import { StorageEntitiesSpec } from '../storage/constants'; beforeAll(() => omitNewRegionsFromTests()); @@ -416,7 +414,7 @@ describe('#createClusterStorageRelationships', () => { expect( context.jobState.collectedEntities.filter( - (e) => e._type === CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + (e) => e._type === StorageEntitiesSpec.STORAGE_BUCKET._type, ), ).toMatchGraphObjectSchema({ _class: ['DataStore'], diff --git a/src/steps/dataproc/index.ts b/src/steps/dataproc/index.ts index 7f2eefa5..c1307450 100644 --- a/src/steps/dataproc/index.ts +++ b/src/steps/dataproc/index.ts @@ -11,10 +11,7 @@ import { IntegrationConfig, IntegrationStepContext } from '../../types'; import { getKmsGraphObjectKeyFromKmsKeyName } from '../../utils/kms'; import { ENTITY_TYPE_COMPUTE_IMAGE, STEP_COMPUTE_IMAGES } from '../compute'; import { ENTITY_TYPE_KMS_KEY, STEP_CLOUD_KMS_KEYS } from '../kms'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - STEP_CLOUD_STORAGE_BUCKETS, -} from '../storage'; +import { StorageEntitiesSpec, StorageStepsSpec } from '../storage/constants'; import { getCloudStorageBucketKey } from '../storage/converters'; import { DataProcClient } from './client'; import { @@ -240,10 +237,13 @@ export const dataprocSteps: IntegrationStep[] = [ _class: RelationshipClass.USES, _type: RELATIONSHIP_TYPE_DATAPROC_CLUSTER_USES_STORAGE_BUCKET, sourceType: ENTITY_TYPE_DATAPROC_CLUSTER, - targetType: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + targetType: StorageEntitiesSpec.STORAGE_BUCKET._type, }, ], - dependsOn: [STEP_DATAPROC_CLUSTERS, STEP_CLOUD_STORAGE_BUCKETS], + dependsOn: [ + STEP_DATAPROC_CLUSTERS, + StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, + ], executionHandler: createClusterStorageRelationships, }, ]; diff --git a/src/steps/functions/__recordings__/build-cloud-function-source-repo-relationships_912814797/recording.har b/src/steps/functions/__recordings__/build-cloud-function-source-repo-relationships_912814797/recording.har index 78d89b73..69a130ce 100644 --- a/src/steps/functions/__recordings__/build-cloud-function-source-repo-relationships_912814797/recording.har +++ b/src/steps/functions/__recordings__/build-cloud-function-source-repo-relationships_912814797/recording.har @@ -62,11 +62,11 @@ "url": "https://www.googleapis.com/oauth2/v4/token" }, "response": { - "bodySize": 384, + "bodySize": 438, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 384, + "size": 438, "text": "{\"access_token\":\"[REDACTED]\",\"expires_in\":9999,\"token_type\":\"Bearer\"}" }, "cookies": [], @@ -81,7 +81,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:25 GMT" + "value": "Fri, 04 Nov 2022 16:30:09 GMT" }, { "name": "server", @@ -118,8 +118,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:25.395Z", - "time": 119, + "startedDateTime": "2022-11-04T16:30:09.289Z", + "time": 126, "timings": { "blocked": -1, "connect": -1, @@ -127,7 +127,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 119 + "wait": 126 } }, { @@ -141,7 +141,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -180,11 +180,11 @@ "url": "https://cloudfunctions.googleapis.com/v1/projects/j1-gc-integration-dev-v3/locations/-/functions" }, "response": { - "bodySize": 1420, + "bodySize": 1437, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 1420, + "size": 1437, "text": "{\"functions\":[{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/function-1\",\"sourceRepository\":{\"url\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/nacho/moveable-aliases/master/paths/\",\"deployedUrl\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/nacho/revisions//paths/\"},\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/function-1\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"UNKNOWN\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-11-01T19:38:17.683Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/gaston-delete\",\"sourceRepository\":{\"url\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/gaston/moveable-aliases/master/paths/\",\"deployedUrl\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/gaston/revisions//paths/\"},\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/gaston-delete\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"UNKNOWN\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-10-31T12:04:14.816Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/gaston-delete-2\",\"sourceArchiveUrl\":\"gs://gaston-delete/carpeta sin título.zip\",\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/gaston-delete-2\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"OFFLINE\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-11-04T13:15:28.330Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"buildId\":\"e7790f72-962e-4bef-aac1-3f49efe41066\",\"buildName\":\"projects/167984947943/locations/us-central1/builds/e7790f72-962e-4bef-aac1-3f49efe41066\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/j1-gc-integration-dev-v3testfunction\",\"description\":\"Test function\",\"sourceArchiveUrl\":\"gs://j1-gc-integration-dev-v3cloudfunctions/http_trigger.zip\",\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/j1-gc-integration-dev-v3testfunction\",\"securityLevel\":\"SECURE_OPTIONAL\"},\"status\":\"ACTIVE\",\"entryPoint\":\"handler\",\"timeout\":\"60s\",\"availableMemoryMb\":128,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2021-05-31T16:36:15.024Z\",\"versionId\":\"1\",\"environmentVariables\":{\"TEST_ENV_VAR\":\"test-env-var-val\"},\"runtime\":\"nodejs10\",\"ingressSettings\":\"ALLOW_ALL\",\"buildId\":\"468a40b5-ba13-41aa-84d8-0ffb43a9c153\",\"buildName\":\"projects/167984947943/locations/us-central1/builds/468a40b5-ba13-41aa-84d8-0ffb43a9c153\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/j1-gc-integration-dev-v3testfunctionwithsa\",\"description\":\"Test function with service account\",\"sourceArchiveUrl\":\"gs://j1-gc-integration-dev-v3cloudfunctions/http_trigger.zip\",\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/j1-gc-integration-dev-v3testfunctionwithsa\",\"securityLevel\":\"SECURE_OPTIONAL\"},\"status\":\"ACTIVE\",\"entryPoint\":\"handler\",\"timeout\":\"60s\",\"availableMemoryMb\":128,\"serviceAccountEmail\":\"j1-gc-integration-dev-f-sa@j1-gc-integration-dev-v3.iam.gserviceaccount.com\",\"updateTime\":\"2021-05-31T16:36:14.851Z\",\"versionId\":\"1\",\"environmentVariables\":{\"TEST_ENV_VAR\":\"test-env-var-val\"},\"runtime\":\"nodejs10\",\"ingressSettings\":\"ALLOW_ALL\",\"buildId\":\"f90313dc-1de2-4181-8709-9865b6507e04\",\"buildName\":\"projects/167984947943/locations/us-central1/builds/f90313dc-1de2-4181-8709-9865b6507e04\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/nacho\",\"sourceRepository\":{\"url\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/default/moveable-aliases/master/paths/\",\"deployedUrl\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/default/revisions//paths/\"},\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/nacho\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"UNKNOWN\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-11-01T19:37:28.455Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"}]}" }, "cookies": [], @@ -199,7 +199,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:26 GMT" + "value": "Fri, 04 Nov 2022 16:30:10 GMT" }, { "name": "server", @@ -236,8 +236,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:25.520Z", - "time": 708, + "startedDateTime": "2022-11-04T16:30:09.420Z", + "time": 1006, "timings": { "blocked": -1, "connect": -1, @@ -245,7 +245,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 708 + "wait": 1006 } }, { @@ -303,11 +303,11 @@ "url": "https://www.googleapis.com/oauth2/v4/token" }, "response": { - "bodySize": 445, + "bodySize": 489, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 445, + "size": 489, "text": "{\"access_token\":\"[REDACTED]\",\"expires_in\":9999,\"token_type\":\"Bearer\"}" }, "cookies": [], @@ -322,7 +322,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:26 GMT" + "value": "Fri, 04 Nov 2022 16:30:10 GMT" }, { "name": "server", @@ -359,8 +359,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:26.238Z", - "time": 116, + "startedDateTime": "2022-11-04T16:30:10.433Z", + "time": 157, "timings": { "blocked": -1, "connect": -1, @@ -368,7 +368,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 116 + "wait": 157 } }, { @@ -382,7 +382,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -421,11 +421,11 @@ "url": "https://sourcerepo.googleapis.com/v1/projects/j1-gc-integration-dev-v3/repos" }, "response": { - "bodySize": 253, + "bodySize": 284, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 253, + "size": 284, "text": "{\"repos\":[{\"name\":\"projects/j1-gc-integration-dev-v3/repos/gaston\",\"url\":\"https://source.developers.google.com/p/j1-gc-integration-dev-v3/r/gaston\"},{\"name\":\"projects/j1-gc-integration-dev-v3/repos/nacho\",\"url\":\"https://source.developers.google.com/p/j1-gc-integration-dev-v3/r/nacho\"}]}" }, "cookies": [], @@ -440,7 +440,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:27 GMT" + "value": "Fri, 04 Nov 2022 16:30:11 GMT" }, { "name": "server", @@ -477,8 +477,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:26.361Z", - "time": 979, + "startedDateTime": "2022-11-04T16:30:10.595Z", + "time": 1057, "timings": { "blocked": -1, "connect": -1, @@ -486,7 +486,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 979 + "wait": 1057 } } ], diff --git a/src/steps/functions/__recordings__/build-cloud-function-storage-bucket-relationships_1146849873/recording.har b/src/steps/functions/__recordings__/build-cloud-function-storage-bucket-relationships_1146849873/recording.har index c9d3a93e..3d5c6476 100644 --- a/src/steps/functions/__recordings__/build-cloud-function-storage-bucket-relationships_1146849873/recording.har +++ b/src/steps/functions/__recordings__/build-cloud-function-storage-bucket-relationships_1146849873/recording.har @@ -62,11 +62,11 @@ "url": "https://www.googleapis.com/oauth2/v4/token" }, "response": { - "bodySize": 452, + "bodySize": 398, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 452, + "size": 398, "text": "{\"access_token\":\"[REDACTED]\",\"expires_in\":9999,\"token_type\":\"Bearer\"}" }, "cookies": [], @@ -81,7 +81,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:27 GMT" + "value": "Fri, 04 Nov 2022 16:30:11 GMT" }, { "name": "server", @@ -118,8 +118,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:27.358Z", - "time": 112, + "startedDateTime": "2022-11-04T16:30:11.671Z", + "time": 159, "timings": { "blocked": -1, "connect": -1, @@ -127,7 +127,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 112 + "wait": 159 } }, { @@ -141,7 +141,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -180,11 +180,11 @@ "url": "https://cloudfunctions.googleapis.com/v1/projects/j1-gc-integration-dev-v3/locations/-/functions" }, "response": { - "bodySize": 1437, + "bodySize": 1403, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 1437, + "size": 1403, "text": "{\"functions\":[{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/function-1\",\"sourceRepository\":{\"url\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/nacho/moveable-aliases/master/paths/\",\"deployedUrl\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/nacho/revisions//paths/\"},\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/function-1\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"UNKNOWN\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-11-01T19:38:17.683Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/gaston-delete\",\"sourceRepository\":{\"url\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/gaston/moveable-aliases/master/paths/\",\"deployedUrl\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/gaston/revisions//paths/\"},\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/gaston-delete\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"UNKNOWN\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-10-31T12:04:14.816Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/gaston-delete-2\",\"sourceArchiveUrl\":\"gs://gaston-delete/carpeta sin título.zip\",\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/gaston-delete-2\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"OFFLINE\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-11-04T13:15:28.330Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"buildId\":\"e7790f72-962e-4bef-aac1-3f49efe41066\",\"buildName\":\"projects/167984947943/locations/us-central1/builds/e7790f72-962e-4bef-aac1-3f49efe41066\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/j1-gc-integration-dev-v3testfunction\",\"description\":\"Test function\",\"sourceArchiveUrl\":\"gs://j1-gc-integration-dev-v3cloudfunctions/http_trigger.zip\",\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/j1-gc-integration-dev-v3testfunction\",\"securityLevel\":\"SECURE_OPTIONAL\"},\"status\":\"ACTIVE\",\"entryPoint\":\"handler\",\"timeout\":\"60s\",\"availableMemoryMb\":128,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2021-05-31T16:36:15.024Z\",\"versionId\":\"1\",\"environmentVariables\":{\"TEST_ENV_VAR\":\"test-env-var-val\"},\"runtime\":\"nodejs10\",\"ingressSettings\":\"ALLOW_ALL\",\"buildId\":\"468a40b5-ba13-41aa-84d8-0ffb43a9c153\",\"buildName\":\"projects/167984947943/locations/us-central1/builds/468a40b5-ba13-41aa-84d8-0ffb43a9c153\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/j1-gc-integration-dev-v3testfunctionwithsa\",\"description\":\"Test function with service account\",\"sourceArchiveUrl\":\"gs://j1-gc-integration-dev-v3cloudfunctions/http_trigger.zip\",\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/j1-gc-integration-dev-v3testfunctionwithsa\",\"securityLevel\":\"SECURE_OPTIONAL\"},\"status\":\"ACTIVE\",\"entryPoint\":\"handler\",\"timeout\":\"60s\",\"availableMemoryMb\":128,\"serviceAccountEmail\":\"j1-gc-integration-dev-f-sa@j1-gc-integration-dev-v3.iam.gserviceaccount.com\",\"updateTime\":\"2021-05-31T16:36:14.851Z\",\"versionId\":\"1\",\"environmentVariables\":{\"TEST_ENV_VAR\":\"test-env-var-val\"},\"runtime\":\"nodejs10\",\"ingressSettings\":\"ALLOW_ALL\",\"buildId\":\"f90313dc-1de2-4181-8709-9865b6507e04\",\"buildName\":\"projects/167984947943/locations/us-central1/builds/f90313dc-1de2-4181-8709-9865b6507e04\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"},{\"name\":\"projects/j1-gc-integration-dev-v3/locations/us-central1/functions/nacho\",\"sourceRepository\":{\"url\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/default/moveable-aliases/master/paths/\",\"deployedUrl\":\"https://source.developers.google.com/projects/j1-gc-integration-dev-v3/repos/default/revisions//paths/\"},\"httpsTrigger\":{\"url\":\"https://us-central1-j1-gc-integration-dev-v3.cloudfunctions.net/nacho\",\"securityLevel\":\"SECURE_ALWAYS\"},\"status\":\"UNKNOWN\",\"entryPoint\":\"helloWorld\",\"timeout\":\"60s\",\"availableMemoryMb\":256,\"serviceAccountEmail\":\"j1-gc-integration-dev-v3@appspot.gserviceaccount.com\",\"updateTime\":\"2022-11-01T19:37:28.455Z\",\"versionId\":\"1\",\"labels\":{\"deployment-tool\":\"console-cloud\"},\"runtime\":\"nodejs16\",\"maxInstances\":3000,\"ingressSettings\":\"ALLOW_ALL\",\"dockerRegistry\":\"CONTAINER_REGISTRY\"}]}" }, "cookies": [], @@ -199,7 +199,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:28 GMT" + "value": "Fri, 04 Nov 2022 16:30:12 GMT" }, { "name": "server", @@ -236,8 +236,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:27.477Z", - "time": 1016, + "startedDateTime": "2022-11-04T16:30:11.835Z", + "time": 902, "timings": { "blocked": -1, "connect": -1, @@ -245,7 +245,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 1016 + "wait": 902 } }, { @@ -303,11 +303,11 @@ "url": "https://www.googleapis.com/oauth2/v4/token" }, "response": { - "bodySize": 489, + "bodySize": 387, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 489, + "size": 387, "text": "{\"access_token\":\"[REDACTED]\",\"expires_in\":9999,\"token_type\":\"Bearer\"}" }, "cookies": [], @@ -322,7 +322,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:28 GMT" + "value": "Fri, 04 Nov 2022 16:30:13 GMT" }, { "name": "server", @@ -359,8 +359,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:28.502Z", - "time": 116, + "startedDateTime": "2022-11-04T16:30:12.744Z", + "time": 113, "timings": { "blocked": -1, "connect": -1, @@ -368,7 +368,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 116 + "wait": 113 } }, { @@ -382,7 +382,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -421,11 +421,11 @@ "url": "https://orgpolicy.googleapis.com/v2/projects/j1-gc-integration-dev-v3/policies/storage.publicAccessPrevention:getEffectivePolicy" }, "response": { - "bodySize": 202, + "bodySize": 192, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 202, + "size": 192, "text": "{\"name\":\"projects/167984947943/policies/storage.publicAccessPrevention\",\"spec\":{\"rules\":[{\"enforce\":true}]}}" }, "cookies": [], @@ -440,7 +440,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:29 GMT" + "value": "Fri, 04 Nov 2022 16:30:14 GMT" }, { "name": "server", @@ -477,8 +477,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:28.625Z", - "time": 1077, + "startedDateTime": "2022-11-04T16:30:12.865Z", + "time": 1216, "timings": { "blocked": -1, "connect": -1, @@ -486,7 +486,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 1077 + "wait": 1216 } }, { @@ -544,11 +544,11 @@ "url": "https://www.googleapis.com/oauth2/v4/token" }, "response": { - "bodySize": 485, + "bodySize": 428, "content": { "encoding": "utf-8", "mimeType": "application/json; charset=UTF-8", - "size": 485, + "size": 428, "text": "{\"access_token\":\"[REDACTED]\",\"expires_in\":9999,\"token_type\":\"Bearer\"}" }, "cookies": [], @@ -563,7 +563,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:29 GMT" + "value": "Fri, 04 Nov 2022 16:30:14 GMT" }, { "name": "server", @@ -600,8 +600,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:29.710Z", - "time": 120, + "startedDateTime": "2022-11-04T16:30:14.092Z", + "time": 115, "timings": { "blocked": -1, "connect": -1, @@ -609,7 +609,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 120 + "wait": 115 } }, { @@ -623,7 +623,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -685,7 +685,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:31 GMT" + "value": "Fri, 04 Nov 2022 16:30:15 GMT" }, { "name": "vary", @@ -697,7 +697,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:31 GMT" + "value": "Fri, 04 Nov 2022 16:30:15 GMT" }, { "name": "content-length", @@ -722,8 +722,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:29.837Z", - "time": 1499, + "startedDateTime": "2022-11-04T16:30:14.215Z", + "time": 1345, "timings": { "blocked": -1, "connect": -1, @@ -731,7 +731,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 1499 + "wait": 1345 } }, { @@ -745,7 +745,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -806,7 +806,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:32 GMT" + "value": "Fri, 04 Nov 2022 16:30:16 GMT" }, { "name": "vary", @@ -818,7 +818,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:32 GMT" + "value": "Fri, 04 Nov 2022 16:30:16 GMT" }, { "name": "content-length", @@ -837,14 +837,14 @@ "value": "close" } ], - "headersSize": 587, + "headersSize": 581, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:31.342Z", - "time": 1118, + "startedDateTime": "2022-11-04T16:30:15.566Z", + "time": 1078, "timings": { "blocked": -1, "connect": -1, @@ -852,7 +852,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 1118 + "wait": 1078 } }, { @@ -866,7 +866,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -927,7 +927,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:32 GMT" + "value": "Fri, 04 Nov 2022 16:30:17 GMT" }, { "name": "vary", @@ -939,7 +939,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:32 GMT" + "value": "Fri, 04 Nov 2022 16:30:17 GMT" }, { "name": "content-length", @@ -958,14 +958,14 @@ "value": "close" } ], - "headersSize": 587, + "headersSize": 579, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:32.462Z", - "time": 409, + "startedDateTime": "2022-11-04T16:30:16.655Z", + "time": 376, "timings": { "blocked": -1, "connect": -1, @@ -973,7 +973,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 409 + "wait": 376 } }, { @@ -987,7 +987,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1048,7 +1048,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:34 GMT" + "value": "Fri, 04 Nov 2022 16:30:18 GMT" }, { "name": "vary", @@ -1060,7 +1060,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:34 GMT" + "value": "Fri, 04 Nov 2022 16:30:18 GMT" }, { "name": "content-length", @@ -1085,8 +1085,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:32.873Z", - "time": 1128, + "startedDateTime": "2022-11-04T16:30:17.038Z", + "time": 1237, "timings": { "blocked": -1, "connect": -1, @@ -1094,7 +1094,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 1128 + "wait": 1237 } }, { @@ -1108,7 +1108,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1169,7 +1169,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:34 GMT" + "value": "Fri, 04 Nov 2022 16:30:18 GMT" }, { "name": "vary", @@ -1181,7 +1181,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:34 GMT" + "value": "Fri, 04 Nov 2022 16:30:18 GMT" }, { "name": "content-length", @@ -1200,14 +1200,14 @@ "value": "close" } ], - "headersSize": 581, + "headersSize": 587, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:34.009Z", - "time": 397, + "startedDateTime": "2022-11-04T16:30:18.280Z", + "time": 392, "timings": { "blocked": -1, "connect": -1, @@ -1215,7 +1215,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 397 + "wait": 392 } }, { @@ -1229,7 +1229,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1290,7 +1290,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:34 GMT" + "value": "Fri, 04 Nov 2022 16:30:19 GMT" }, { "name": "vary", @@ -1302,7 +1302,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:34 GMT" + "value": "Fri, 04 Nov 2022 16:30:19 GMT" }, { "name": "content-length", @@ -1321,14 +1321,14 @@ "value": "close" } ], - "headersSize": 581, + "headersSize": 587, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:34.412Z", - "time": 408, + "startedDateTime": "2022-11-04T16:30:18.680Z", + "time": 449, "timings": { "blocked": -1, "connect": -1, @@ -1336,7 +1336,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 408 + "wait": 449 } }, { @@ -1350,7 +1350,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1411,7 +1411,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:35 GMT" + "value": "Fri, 04 Nov 2022 16:30:19 GMT" }, { "name": "vary", @@ -1423,7 +1423,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:35 GMT" + "value": "Fri, 04 Nov 2022 16:30:19 GMT" }, { "name": "content-length", @@ -1442,14 +1442,14 @@ "value": "close" } ], - "headersSize": 581, + "headersSize": 587, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:34.825Z", - "time": 396, + "startedDateTime": "2022-11-04T16:30:19.137Z", + "time": 583, "timings": { "blocked": -1, "connect": -1, @@ -1457,7 +1457,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 396 + "wait": 583 } }, { @@ -1471,7 +1471,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1532,7 +1532,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:35 GMT" + "value": "Fri, 04 Nov 2022 16:30:20 GMT" }, { "name": "vary", @@ -1544,7 +1544,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:35 GMT" + "value": "Fri, 04 Nov 2022 16:30:20 GMT" }, { "name": "content-length", @@ -1563,14 +1563,14 @@ "value": "close" } ], - "headersSize": 581, + "headersSize": 587, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:35.226Z", - "time": 411, + "startedDateTime": "2022-11-04T16:30:19.724Z", + "time": 386, "timings": { "blocked": -1, "connect": -1, @@ -1578,7 +1578,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 411 + "wait": 386 } }, { @@ -1592,7 +1592,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1653,7 +1653,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:36 GMT" + "value": "Fri, 04 Nov 2022 16:30:20 GMT" }, { "name": "vary", @@ -1665,7 +1665,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:36 GMT" + "value": "Fri, 04 Nov 2022 16:30:20 GMT" }, { "name": "content-length", @@ -1684,14 +1684,14 @@ "value": "close" } ], - "headersSize": 581, + "headersSize": 587, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:35.644Z", - "time": 361, + "startedDateTime": "2022-11-04T16:30:20.118Z", + "time": 409, "timings": { "blocked": -1, "connect": -1, @@ -1699,7 +1699,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 361 + "wait": 409 } }, { @@ -1713,7 +1713,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1774,7 +1774,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:36 GMT" + "value": "Fri, 04 Nov 2022 16:30:21 GMT" }, { "name": "vary", @@ -1786,7 +1786,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:36 GMT" + "value": "Fri, 04 Nov 2022 16:30:21 GMT" }, { "name": "content-length", @@ -1805,14 +1805,14 @@ "value": "close" } ], - "headersSize": 581, + "headersSize": 587, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:36.012Z", - "time": 392, + "startedDateTime": "2022-11-04T16:30:20.535Z", + "time": 449, "timings": { "blocked": -1, "connect": -1, @@ -1820,7 +1820,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 392 + "wait": 449 } }, { @@ -1834,7 +1834,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -1895,7 +1895,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:36 GMT" + "value": "Fri, 04 Nov 2022 16:30:21 GMT" }, { "name": "vary", @@ -1907,7 +1907,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:36 GMT" + "value": "Fri, 04 Nov 2022 16:30:21 GMT" }, { "name": "content-length", @@ -1926,14 +1926,14 @@ "value": "close" } ], - "headersSize": 587, + "headersSize": 579, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:36.410Z", - "time": 407, + "startedDateTime": "2022-11-04T16:30:20.991Z", + "time": 438, "timings": { "blocked": -1, "connect": -1, @@ -1941,7 +1941,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 407 + "wait": 438 } }, { @@ -1955,7 +1955,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -2016,7 +2016,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:37 GMT" + "value": "Fri, 04 Nov 2022 16:30:21 GMT" }, { "name": "vary", @@ -2028,7 +2028,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:37 GMT" + "value": "Fri, 04 Nov 2022 16:30:21 GMT" }, { "name": "content-length", @@ -2053,8 +2053,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:36.823Z", - "time": 381, + "startedDateTime": "2022-11-04T16:30:21.435Z", + "time": 380, "timings": { "blocked": -1, "connect": -1, @@ -2062,7 +2062,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 381 + "wait": 380 } }, { @@ -2076,7 +2076,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -2137,7 +2137,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:37 GMT" + "value": "Fri, 04 Nov 2022 16:30:22 GMT" }, { "name": "vary", @@ -2149,7 +2149,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:37 GMT" + "value": "Fri, 04 Nov 2022 16:30:22 GMT" }, { "name": "content-length", @@ -2174,8 +2174,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:37.210Z", - "time": 474, + "startedDateTime": "2022-11-04T16:30:21.821Z", + "time": 393, "timings": { "blocked": -1, "connect": -1, @@ -2183,7 +2183,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 474 + "wait": 393 } }, { @@ -2197,7 +2197,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -2258,7 +2258,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:38 GMT" + "value": "Fri, 04 Nov 2022 16:30:22 GMT" }, { "name": "vary", @@ -2270,7 +2270,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:38 GMT" + "value": "Fri, 04 Nov 2022 16:30:22 GMT" }, { "name": "content-length", @@ -2289,14 +2289,14 @@ "value": "close" } ], - "headersSize": 587, + "headersSize": 579, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:37.690Z", - "time": 404, + "startedDateTime": "2022-11-04T16:30:22.220Z", + "time": 507, "timings": { "blocked": -1, "connect": -1, @@ -2304,7 +2304,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 404 + "wait": 507 } }, { @@ -2318,7 +2318,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -2379,7 +2379,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:38 GMT" + "value": "Fri, 04 Nov 2022 16:30:23 GMT" }, { "name": "vary", @@ -2391,7 +2391,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:38 GMT" + "value": "Fri, 04 Nov 2022 16:30:23 GMT" }, { "name": "content-length", @@ -2410,14 +2410,14 @@ "value": "close" } ], - "headersSize": 581, + "headersSize": 587, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:38.101Z", - "time": 295, + "startedDateTime": "2022-11-04T16:30:22.733Z", + "time": 834, "timings": { "blocked": -1, "connect": -1, @@ -2425,7 +2425,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 295 + "wait": 834 } }, { @@ -2439,7 +2439,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -2500,7 +2500,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:38 GMT" + "value": "Fri, 04 Nov 2022 16:30:24 GMT" }, { "name": "vary", @@ -2512,7 +2512,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:38 GMT" + "value": "Fri, 04 Nov 2022 16:30:24 GMT" }, { "name": "content-length", @@ -2537,8 +2537,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:38.402Z", - "time": 513, + "startedDateTime": "2022-11-04T16:30:23.575Z", + "time": 338, "timings": { "blocked": -1, "connect": -1, @@ -2546,7 +2546,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 513 + "wait": 338 } }, { @@ -2560,7 +2560,7 @@ { "_fromType": "array", "name": "x-goog-api-client", - "value": "gdcl/5.0.2 gl-node/16.13.2 auth/7.1.1" + "value": "gdcl/5.0.2 gl-node/12.16.1 auth/7.1.1" }, { "_fromType": "array", @@ -2621,7 +2621,7 @@ }, { "name": "date", - "value": "Tue, 08 Nov 2022 15:57:39 GMT" + "value": "Fri, 04 Nov 2022 16:30:24 GMT" }, { "name": "vary", @@ -2633,7 +2633,7 @@ }, { "name": "expires", - "value": "Tue, 08 Nov 2022 15:57:39 GMT" + "value": "Fri, 04 Nov 2022 16:30:24 GMT" }, { "name": "content-length", @@ -2658,8 +2658,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-11-08T15:57:38.921Z", - "time": 401, + "startedDateTime": "2022-11-04T16:30:23.918Z", + "time": 673, "timings": { "blocked": -1, "connect": -1, @@ -2667,7 +2667,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 401 + "wait": 673 } } ], diff --git a/src/steps/functions/constants.ts b/src/steps/functions/constants.ts index 53512c98..cb6f674e 100644 --- a/src/steps/functions/constants.ts +++ b/src/steps/functions/constants.ts @@ -1,7 +1,7 @@ import { RelationshipClass } from '@jupiterone/integration-sdk-core'; import { CloudSourceRepositoriesEntitiesSpec } from '../cloud-source-repositories/constants'; import { IAM_SERVICE_ACCOUNT_ENTITY_TYPE } from '../iam'; -import { CLOUD_STORAGE_BUCKET_ENTITY_TYPE } from '../storage/constants'; +import { StorageEntitiesSpec } from '../storage/constants'; export const CLOUD_FUNCTION_ENTITY_CLASS = 'Function'; export const CLOUD_FUNCTION_ENTITY_TYPE = 'google_cloud_function'; @@ -58,6 +58,6 @@ export const FunctionsRelationshipsSpec = { _type: 'google_cloud_function_uses_storage_bucket', _class: RelationshipClass.USES, sourceType: FunctionEntitiesSpec.CLOUD_FUNCTION._type, - targetType: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + targetType: StorageEntitiesSpec.STORAGE_BUCKET._type, }, }; diff --git a/src/steps/functions/index.ts b/src/steps/functions/index.ts index a0538605..239324ab 100644 --- a/src/steps/functions/index.ts +++ b/src/steps/functions/index.ts @@ -15,8 +15,8 @@ import { } from './constants'; import { CloudSourceRepositoriesStepsSpec } from '../cloud-source-repositories/constants'; import { cloudfunctions_v1 } from 'googleapis'; -import { STEP_CLOUD_STORAGE_BUCKETS } from '../storage'; import { getCloudStorageBucketKey } from '../storage/converters'; +import { StorageStepsSpec } from '../storage/constants'; export * from './constants'; @@ -185,7 +185,7 @@ export const functionsSteps: IntegrationStep[] = [ name: FunctionStepsSpec.CLOUD_FUNCTIONS_STORAGE_BUCKET_RELATIONSHIP.name, dependsOn: [ FunctionStepsSpec.FETCH_CLOUD_FUNCTIONS.id, - STEP_CLOUD_STORAGE_BUCKETS, + StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, ], entities: [], relationships: [ diff --git a/src/steps/logging/index.test.ts b/src/steps/logging/index.test.ts index 0989afa0..0864edd7 100644 --- a/src/steps/logging/index.test.ts +++ b/src/steps/logging/index.test.ts @@ -1,10 +1,7 @@ import { createMockStepExecutionContext } from '@jupiterone/integration-sdk-testing'; import { fetchSinks, fetchMetrics, buildSinkUsesBucketRelationships } from '.'; import { fetchAlertPolicies } from '../monitoring'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - fetchStorageBuckets, -} from '../storage'; +import { fetchStorageBuckets } from '../storage'; import { integrationConfig } from '../../../test/config'; import { Recording, setupGoogleCloudRecording } from '../../../test/recording'; import { IntegrationConfig } from '../../types'; @@ -16,6 +13,7 @@ import { RELATIONSHIP_TYPE_PROJECT_SINK_USES_STORAGE_BUCKET, } from './constants'; import { MONITORING_ALERT_POLICY_TYPE } from '../monitoring/constants'; +import { StorageEntitiesSpec } from '../storage/constants'; const tempNewAccountConfig = { ...integrationConfig, @@ -61,7 +59,7 @@ describe('#fetchProjectSinks', () => { expect( context.jobState.collectedEntities.filter( - (e) => e._type === CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + (e) => e._type === StorageEntitiesSpec.STORAGE_BUCKET._type, ), ).toMatchGraphObjectSchema({ _class: ['DataStore'], diff --git a/src/steps/logging/index.ts b/src/steps/logging/index.ts index 396c5fe6..07102d83 100644 --- a/src/steps/logging/index.ts +++ b/src/steps/logging/index.ts @@ -5,10 +5,6 @@ import { RelationshipClass, } from '@jupiterone/integration-sdk-core'; import { IntegrationConfig, IntegrationStepContext } from '../../types'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - STEP_CLOUD_STORAGE_BUCKETS, -} from '../storage'; import { LoggingClient } from './client'; import { LOGGING_METRIC_ENTITY_CLASS, @@ -31,6 +27,7 @@ import { STEP_MONITORING_ALERT_POLICIES, } from '../monitoring/constants'; import { logging_v2 } from 'googleapis'; +import { StorageEntitiesSpec, StorageStepsSpec } from '../storage/constants'; export async function fetchSinks( context: IntegrationStepContext, @@ -166,10 +163,13 @@ export const loggingSteps: IntegrationStep[] = [ _class: RelationshipClass.USES, _type: RELATIONSHIP_TYPE_PROJECT_SINK_USES_STORAGE_BUCKET, sourceType: LOGGING_PROJECT_SINK_ENTITY_TYPE, - targetType: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + targetType: StorageEntitiesSpec.STORAGE_BUCKET._type, }, ], - dependsOn: [STEP_LOGGING_PROJECT_SINKS, STEP_CLOUD_STORAGE_BUCKETS], + dependsOn: [ + STEP_LOGGING_PROJECT_SINKS, + StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, + ], executionHandler: buildSinkUsesBucketRelationships, }, { diff --git a/src/steps/privateca/index.ts b/src/steps/privateca/index.ts index 7e587a8a..154f9303 100644 --- a/src/steps/privateca/index.ts +++ b/src/steps/privateca/index.ts @@ -24,8 +24,7 @@ import { createCertificateEntity, } from './converters'; import { getCloudStorageBucketKey } from '../storage/converters'; -import { STEP_CLOUD_STORAGE_BUCKETS } from '../storage'; -import { CLOUD_STORAGE_BUCKET_ENTITY_TYPE } from '../storage/constants'; +import { StorageEntitiesSpec, StorageStepsSpec } from '../storage/constants'; function isCertificateAuthorityPolicyPublicAccess( caPolicy: privateca_v1beta1.Schema$Policy, @@ -184,12 +183,12 @@ export const privateCaSteps: IntegrationStep[] = [ _type: RELATIONSHIP_TYPE_PRIVATE_CA_CERTIFICATE_AUTHORITY_USES_STORAGE_BUCKET, sourceType: ENTITY_TYPE_PRIVATE_CA_CERTIFICATE_AUTHORITY, - targetType: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + targetType: StorageEntitiesSpec.STORAGE_BUCKET._type, }, ], dependsOn: [ STEP_PRIVATE_CA_CERTIFICATE_AUTHORITIES, - STEP_CLOUD_STORAGE_BUCKETS, + StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, ], executionHandler: buildCertificateAuthorityBucketRelationships, }, diff --git a/src/steps/storage/constants.ts b/src/steps/storage/constants.ts index 19fdb911..da257521 100644 --- a/src/steps/storage/constants.ts +++ b/src/steps/storage/constants.ts @@ -1,4 +1,14 @@ -export const CLOUD_STORAGE_BUCKET_ENTITY_CLASS = 'DataStore'; -export const CLOUD_STORAGE_BUCKET_ENTITY_TYPE = 'google_storage_bucket'; +export const StorageStepsSpec = { + FETCH_STORAGE_BUCKETS: { + id: 'fetch-cloud-storage-buckets', + name: 'Cloud Storage Buckets', + }, +}; -export const STEP_CLOUD_STORAGE_BUCKETS = 'fetch-cloud-storage-buckets'; +export const StorageEntitiesSpec = { + STORAGE_BUCKET: { + resourceName: 'Cloud Storage Bucket', + _type: 'google_storage_bucket', + _class: 'DataStore', + }, +}; diff --git a/src/steps/storage/converters.ts b/src/steps/storage/converters.ts index 7a390b76..be3fe176 100644 --- a/src/steps/storage/converters.ts +++ b/src/steps/storage/converters.ts @@ -1,9 +1,6 @@ import { storage_v1 } from 'googleapis'; import { parseTimePropertyValue } from '@jupiterone/integration-sdk-core'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - CLOUD_STORAGE_BUCKET_ENTITY_CLASS, -} from './constants'; +import { StorageEntitiesSpec } from './constants'; import { createGoogleCloudIntegrationEntity } from '../../utils/entity'; import { isMemberPublic } from '../../utils/iam'; @@ -102,8 +99,8 @@ export function createCloudStorageBucketEntity({ entityData: { source: data, assign: { - _class: CLOUD_STORAGE_BUCKET_ENTITY_CLASS, - _type: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + _class: StorageEntitiesSpec.STORAGE_BUCKET._class, + _type: StorageEntitiesSpec.STORAGE_BUCKET._type, _key: getCloudStorageBucketKey(data.id as string), id: data.id as string, name: data.name, diff --git a/src/steps/storage/index.ts b/src/steps/storage/index.ts index 4634c34e..39d3f12f 100644 --- a/src/steps/storage/index.ts +++ b/src/steps/storage/index.ts @@ -2,17 +2,11 @@ import { IntegrationStep } from '@jupiterone/integration-sdk-core'; import { CloudStorageClient } from './client'; import { IntegrationConfig, IntegrationStepContext } from '../../types'; import { createCloudStorageBucketEntity } from './converters'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - STEP_CLOUD_STORAGE_BUCKETS, - CLOUD_STORAGE_BUCKET_ENTITY_CLASS, -} from './constants'; +import { StorageStepsSpec, StorageEntitiesSpec } from './constants'; import { storage_v1 } from 'googleapis'; import { publishUnprocessedBucketsEvent } from '../../utils/events'; import { OrgPolicyClient } from '../orgpolicy/client'; -export * from './constants'; - export async function fetchStorageBuckets( context: IntegrationStepContext, ): Promise { @@ -87,15 +81,9 @@ export async function fetchStorageBuckets( export const storageSteps: IntegrationStep[] = [ { - id: STEP_CLOUD_STORAGE_BUCKETS, - name: 'Cloud Storage Buckets', - entities: [ - { - resourceName: 'Cloud Storage Bucket', - _type: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, - _class: CLOUD_STORAGE_BUCKET_ENTITY_CLASS, - }, - ], + id: StorageStepsSpec.FETCH_STORAGE_BUCKETS.id, + name: StorageStepsSpec.FETCH_STORAGE_BUCKETS.name, + entities: [StorageEntitiesSpec.STORAGE_BUCKET], relationships: [], dependsOn: [], executionHandler: fetchStorageBuckets, diff --git a/src/utils/entity.test.ts b/src/utils/entity.test.ts index 336f1bb8..691047cc 100644 --- a/src/utils/entity.test.ts +++ b/src/utils/entity.test.ts @@ -1,10 +1,7 @@ import { parseTimePropertyValue } from '@jupiterone/integration-sdk-core'; import { storage_v1 } from 'googleapis'; import { getMockStorageBucket } from '../../test/mocks'; -import { - CLOUD_STORAGE_BUCKET_ENTITY_CLASS, - CLOUD_STORAGE_BUCKET_ENTITY_TYPE, -} from '../steps/storage'; +import { StorageEntitiesSpec } from '../steps/storage/constants'; import { getCloudStorageBucketKey, getCloudStorageBucketWebLink, @@ -19,8 +16,8 @@ function getMockStorageBucketEntityBuilderInput( entityData: { source: data, assign: { - _class: CLOUD_STORAGE_BUCKET_ENTITY_CLASS, - _type: CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + _class: StorageEntitiesSpec.STORAGE_BUCKET._class, + _type: StorageEntitiesSpec.STORAGE_BUCKET._type, _key: getCloudStorageBucketKey(data.id as string), id: data.id as string, name: data.name, diff --git a/src/utils/iamBindings/resourceKindToTypeMap.ts b/src/utils/iamBindings/resourceKindToTypeMap.ts index 11583486..20944226 100644 --- a/src/utils/iamBindings/resourceKindToTypeMap.ts +++ b/src/utils/iamBindings/resourceKindToTypeMap.ts @@ -83,7 +83,7 @@ import { SQL_ADMIN_POSTGRES_INSTANCE_ENTITY_TYPE, SQL_ADMIN_SQL_SERVER_INSTANCE_ENTITY_TYPE, } from '../../steps/sql-admin'; -import { CLOUD_STORAGE_BUCKET_ENTITY_TYPE } from '../../steps/storage'; +import { StorageEntitiesSpec } from '../../steps/storage/constants'; // Indicates JupiterOne is not ingesting that resource yet. export const NONE = 'NO_DIRECT_J1_RESOURCE_YET'; @@ -169,7 +169,7 @@ export const GOOGLE_RESOURCE_KIND_TO_J1_TYPE_MAP: { 'appengine.googleapis.com/Service': ENTITY_TYPE_APP_ENGINE_SERVICE, 'appengine.googleapis.com/Version': ENTITY_TYPE_APP_ENGINE_VERSION, 'cloudbilling.googleapis.com/BillingAccount': ENTITY_TYPE_BILLING_ACCOUNT, - 'storage.googleapis.com/Bucket': CLOUD_STORAGE_BUCKET_ENTITY_TYPE, + 'storage.googleapis.com/Bucket': StorageEntitiesSpec.STORAGE_BUCKET._type, 'osconfig.googleapis.com/PatchDeployment': NONE, 'dns.googleapis.com/ManagedZone': DNS_MANAGED_ZONE_ENTITY_TYPE, 'dns.googleapis.com/Policy': DNS_POLICY_ENTITY_TYPE, diff --git a/src/utils/iamBindings/typeToKeyGeneratorMap.ts b/src/utils/iamBindings/typeToKeyGeneratorMap.ts index 37c6f025..f284aac5 100644 --- a/src/utils/iamBindings/typeToKeyGeneratorMap.ts +++ b/src/utils/iamBindings/typeToKeyGeneratorMap.ts @@ -77,7 +77,6 @@ import { ENTITY_TYPE_SPANNER_INSTANCE, ENTITY_TYPE_SPANNER_INSTANCE_DATABASE, } from '../../steps/spanner/constants'; -import { CLOUD_STORAGE_BUCKET_ENTITY_TYPE } from '../../steps/storage'; import { getCloudStorageBucketKey } from '../../steps/storage/converters'; import { StepExecutionContext } from '@jupiterone/integration-sdk-core'; import { getProjectNameFromId } from '../jobState'; @@ -95,6 +94,7 @@ import { SQL_ADMIN_POSTGRES_INSTANCE_ENTITY_TYPE, SQL_ADMIN_SQL_SERVER_INSTANCE_ENTITY_TYPE, } from '../../steps/sql-admin'; +import { StorageEntitiesSpec } from '../../steps/storage/constants'; /** * A map of JupiterOne types to a function which can generate their _key @@ -137,7 +137,7 @@ export const J1_TYPE_TO_KEY_GENERATOR_MAP: { [ENTITY_TYPE_APP_ENGINE_APPLICATION]: fullPathKeyMap, [ENTITY_TYPE_APP_ENGINE_SERVICE]: fullPathKeyMap, [ENTITY_TYPE_APP_ENGINE_VERSION]: fullPathKeyMap, - [CLOUD_STORAGE_BUCKET_ENTITY_TYPE]: customPrefixAndIdKeyMap( + [StorageEntitiesSpec.STORAGE_BUCKET._type]: customPrefixAndIdKeyMap( getCloudStorageBucketKey, ), [DNS_MANAGED_ZONE_ENTITY_TYPE]: finalIdentifierKeyMap,