Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #630 from JupiterOne/INT-9927-2
Browse files Browse the repository at this point in the history
INT-9927: propagate run service metadata to entity
  • Loading branch information
gastonyelmini authored Nov 28, 2023
2 parents 1147cdd + a5b94a6 commit 6929d18
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/steps/cloud-run/__snapshots__/converters.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,15 @@ exports[`#createCloudRunServiceEntity should convert to entity 1`] = `
"function": [
"workload-management",
],
"metaClientName": "cloud-console",
"metaCreator": "user@email.com",
"metaIngress": "all",
"metaIngressStatus": "all",
"metaLastModifier": "user@email.com",
"metaLaunchStage": "BETA",
"metaMaxScale": "100",
"metaSandbox": "gvisor",
"metaUserImage": "us-docker.pkg.dev/cloudrun/container/hello",
"name": "example-cloud-run-service",
"webLink": "https://console.cloud.google.com/run/detail/us-central1/example-cloud-run-service",
}
Expand Down
27 changes: 27 additions & 0 deletions src/steps/cloud-run/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ exports[`#fetchCloudRunConfigurations should collect data 1`] = `
"function": [
"workload-management",
],
"metaClientName": "cloud-console",
"metaCreator": "user@email.com",
"metaIngress": "all",
"metaIngressStatus": "all",
"metaLastModifier": "user@email.com",
"metaLaunchStage": "BETA",
"metaMaxScale": "100",
"metaSandbox": "gvisor",
"metaUserImage": "us-docker.pkg.dev/cloudrun/container/hello",
"name": "example-cloud-run-service",
"webLink": "https://console.cloud.google.com/run/detail/us-central1/example-cloud-run-service",
},
Expand Down Expand Up @@ -368,6 +377,15 @@ exports[`#fetchCloudRunRoutes should collect data 1`] = `
"function": [
"workload-management",
],
"metaClientName": "cloud-console",
"metaCreator": "user@email.com",
"metaIngress": "all",
"metaIngressStatus": "all",
"metaLastModifier": "user@email.com",
"metaLaunchStage": "BETA",
"metaMaxScale": "100",
"metaSandbox": "gvisor",
"metaUserImage": "us-docker.pkg.dev/cloudrun/container/hello",
"name": "example-cloud-run-service",
"webLink": "https://console.cloud.google.com/run/detail/us-central1/example-cloud-run-service",
},
Expand Down Expand Up @@ -594,6 +612,15 @@ exports[`#fetchCloudRunServices should collect data 1`] = `
"function": [
"workload-management",
],
"metaClientName": "cloud-console",
"metaCreator": "user@email.com",
"metaIngress": "all",
"metaIngressStatus": "all",
"metaLastModifier": "user@email.com",
"metaLaunchStage": "BETA",
"metaMaxScale": "100",
"metaSandbox": "gvisor",
"metaUserImage": "us-docker.pkg.dev/cloudrun/container/hello",
"name": "example-cloud-run-service",
"webLink": "https://console.cloud.google.com/run/detail/us-central1/example-cloud-run-service",
},
Expand Down
3 changes: 3 additions & 0 deletions src/steps/cloud-run/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export function createCloudRunServiceEntity(
webLink = `/run?project=${projectId}`;
}

const metadataProperties = parseMetadata(data);

return createIntegrationEntity({
entityData: {
source: data,
Expand All @@ -66,6 +68,7 @@ export function createCloudRunServiceEntity(
category: ['infrastructure'],
createdOn: parseTimePropertyValue(data.metadata?.creationTimestamp),
webLink: getGoogleCloudConsoleWebLink(webLink),
...metadataProperties.filteredProperties,
},
},
});
Expand Down
6 changes: 3 additions & 3 deletions src/steps/cloud-run/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('#fetchCloudRunServices', () => {
).toMatchGraphObjectSchema({
_class: ['Service'],
schema: {
additionalProperties: false,
additionalProperties: true,
properties: {
_type: { const: 'google_cloud_run_service' },
_rawData: {
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('#fetchCloudRunRoutes', () => {
).toMatchGraphObjectSchema({
_class: ['Service'],
schema: {
additionalProperties: false,
additionalProperties: true,
properties: {
_type: { const: 'google_cloud_run_service' },
_rawData: {
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('#fetchCloudRunConfigurations', () => {
).toMatchGraphObjectSchema({
_class: ['Service'],
schema: {
additionalProperties: false,
additionalProperties: true,
properties: {
_type: { const: 'google_cloud_run_service' },
_rawData: {
Expand Down

0 comments on commit 6929d18

Please sign in to comment.