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 #553 from JupiterOne/INT-5918-cloud-function-relat…
Browse files Browse the repository at this point in the history
…ionship

feat(INT-5918): add cloud function source repo relationship
  • Loading branch information
gastonyelmini authored Nov 2, 2022
2 parents ca2cca1 + 488b726 commit 4f7ccfa
Show file tree
Hide file tree
Showing 11 changed files with 666 additions and 43 deletions.
1 change: 1 addition & 0 deletions docs/jupiterone.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ The following relationships are created:
| `internet` | **ALLOWS** | `google_compute_firewall` |
| `google_cloud_folder` | **HAS** | `google_cloud_folder` |
| `google_cloud_function` | **USES** | `google_iam_service_account` |
| `google_cloud_function` | **USES** | `google_cloud_source_repository` |
| `google_cloud_organization` | **HAS** | `google_cloud_folder` |
| `google_cloud_project` | **HAS** | `google_cloud_api_service` |
| `google_cloud_project` | **HAS** | `google_billing_budget` |
Expand Down
2 changes: 1 addition & 1 deletion docs/spec/src/steps/services/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const functionSteps: StepSpec<IntegrationInstanceConfig>[] = [
},
],
dependsOn: ['fetch-cloud-functions', 'fetch-cloud-source-repositories'],
implemented: false,
implemented: true,
},
{
/**
Expand Down
5 changes: 5 additions & 0 deletions src/getStepStartStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ import * as enablement from './steps/enablement';
import {
STEP_CLOUD_FUNCTIONS,
STEP_CLOUD_FUNCTIONS_SERVICE_ACCOUNT_RELATIONSHIPS,
STEP_CLOUD_FUNCTIONS_SOURCE_REPO_RELATIONSHIPS,
} from './steps/functions';
import {
STEP_IAM_CUSTOM_ROLES,
Expand Down Expand Up @@ -301,6 +302,7 @@ function getDefaultStepStartStates(params: {
[STEP_CREATE_API_SERVICE_ANY_RESOURCE_RELATIONSHIPS]: { disabled: false },
[STEP_CLOUD_FUNCTIONS]: { disabled: false },
[STEP_CLOUD_FUNCTIONS_SERVICE_ACCOUNT_RELATIONSHIPS]: { disabled: false },
[STEP_CLOUD_FUNCTIONS_SOURCE_REPO_RELATIONSHIPS]: { disabled: false },
[STEP_CLOUD_STORAGE_BUCKETS]: { disabled: false },
[STEP_IAM_CUSTOM_ROLES]: { disabled: false },
[STEP_IAM_CUSTOM_ROLE_SERVICE_API_RELATIONSHIPS]: { disabled: false },
Expand Down Expand Up @@ -591,6 +593,9 @@ async function getStepStartStatesUsingServiceEnablements(params: {
[STEP_CLOUD_FUNCTIONS_SERVICE_ACCOUNT_RELATIONSHIPS]: createStepStartState(
ServiceUsageName.CLOUD_FUNCTIONS,
),
[STEP_CLOUD_FUNCTIONS_SOURCE_REPO_RELATIONSHIPS]: createStepStartState(
ServiceUsageName.CLOUD_FUNCTIONS,
),
[STEP_CLOUD_STORAGE_BUCKETS]: createStepStartState(
ServiceUsageName.STORAGE,
ServiceUsageName.STORAGE_COMPONENT,
Expand Down
12 changes: 8 additions & 4 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ import {
STEP_DNS_MANAGED_ZONES,
STEP_DNS_POLICIES,
} from './steps/dns/constants';
import {
STEP_CLOUD_FUNCTIONS,
STEP_CLOUD_FUNCTIONS_SERVICE_ACCOUNT_RELATIONSHIPS,
} from './steps/functions';
import {
STEP_IAM_CUSTOM_ROLES,
STEP_IAM_CUSTOM_ROLE_SERVICE_API_RELATIONSHIPS,
Expand Down Expand Up @@ -175,6 +171,11 @@ import {
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,
STEP_CLOUD_FUNCTIONS_SERVICE_ACCOUNT_RELATIONSHIPS,
STEP_CLOUD_FUNCTIONS_SOURCE_REPO_RELATIONSHIPS,
} from './steps/functions';

interface ValidateInvocationInvalidConfigTestParams {
instanceConfig?: Partial<IntegrationConfig>;
Expand Down Expand Up @@ -326,6 +327,9 @@ describe('#getStepStartStates success', () => {
[STEP_CLOUD_FUNCTIONS_SERVICE_ACCOUNT_RELATIONSHIPS]: {
disabled: false,
},
[STEP_CLOUD_FUNCTIONS_SOURCE_REPO_RELATIONSHIPS]: {
disabled: false,
},
[STEP_CLOUD_STORAGE_BUCKETS]: {
disabled: false,
},
Expand Down
Loading

0 comments on commit 4f7ccfa

Please sign in to comment.