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

Consolidate event log names for better user experience #583

Merged
merged 5 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 31 additions & 32 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ['main']

jobs:
analyze:
name: Analyze
Expand All @@ -30,41 +30,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
32 changes: 16 additions & 16 deletions src/getStepStartStates.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
IntegrationExecutionContext,
IntegrationInfoEventName,
IntegrationLogger,
IntegrationValidationError,
IntegrationWarnEventName,
StepStartState,
StepStartStates,
} from '@jupiterone/integration-sdk-core';
Expand All @@ -15,8 +15,8 @@ import {
} from './steps/access-context-manager/constants';
import { apiGatewaySteps } from './steps/api-gateway';
import {
STEP_API_GATEWAY_APIS,
STEP_API_GATEWAY_API_CONFIGS,
STEP_API_GATEWAY_APIS,
STEP_API_GATEWAY_GATEWAYS,
} from './steps/api-gateway/constants';
import { appEngineSteps } from './steps/app-engine';
Expand Down Expand Up @@ -77,37 +77,37 @@ import {
STEP_COMPUTE_ADDRESSES,
STEP_COMPUTE_BACKEND_BUCKETS,
STEP_COMPUTE_BACKEND_SERVICES,
STEP_COMPUTE_DISKS,
STEP_COMPUTE_DISK_IMAGE_RELATIONSHIPS,
STEP_COMPUTE_DISK_KMS_RELATIONSHIPS,
STEP_COMPUTE_DISKS,
STEP_COMPUTE_FIREWALLS,
STEP_COMPUTE_FORWARDING_RULES,
STEP_COMPUTE_GLOBAL_ADDRESSES,
STEP_COMPUTE_GLOBAL_FORWARDING_RULES,
STEP_COMPUTE_HEALTH_CHECKS,
STEP_COMPUTE_IMAGES,
STEP_COMPUTE_IMAGE_IMAGE_RELATIONSHIPS,
STEP_COMPUTE_IMAGE_KMS_RELATIONSHIPS,
STEP_COMPUTE_INSTANCES,
STEP_COMPUTE_IMAGES,
STEP_COMPUTE_INSTANCE_GROUPS,
STEP_COMPUTE_INSTANCE_SERVICE_ACCOUNT_RELATIONSHIPS,
STEP_COMPUTE_INSTANCES,
STEP_COMPUTE_LOADBALANCERS,
STEP_COMPUTE_NETWORKS,
STEP_COMPUTE_NETWORK_PEERING_RELATIONSHIPS,
STEP_COMPUTE_NETWORKS,
STEP_COMPUTE_PROJECT,
STEP_COMPUTE_REGION_BACKEND_SERVICES,
STEP_COMPUTE_REGION_DISKS,
STEP_COMPUTE_REGION_HEALTH_CHECKS,
STEP_COMPUTE_REGION_INSTANCE_GROUPS,
STEP_COMPUTE_REGION_LOADBALANCERS,
STEP_COMPUTE_REGION_TARGET_HTTPS_PROXIES,
STEP_COMPUTE_REGION_TARGET_HTTP_PROXIES,
STEP_COMPUTE_SNAPSHOTS,
STEP_COMPUTE_REGION_TARGET_HTTPS_PROXIES,
STEP_COMPUTE_SNAPSHOT_DISK_RELATIONSHIPS,
STEP_COMPUTE_SNAPSHOTS,
STEP_COMPUTE_SSL_POLICIES,
STEP_COMPUTE_SUBNETWORKS,
STEP_COMPUTE_TARGET_HTTPS_PROXIES,
STEP_COMPUTE_TARGET_HTTP_PROXIES,
STEP_COMPUTE_TARGET_HTTPS_PROXIES,
STEP_COMPUTE_TARGET_SSL_PROXIES,
STEP_CREATE_COMPUTE_BACKEND_BUCKET_BUCKET_RELATIONSHIPS,
} from './steps/compute';
Expand All @@ -116,8 +116,8 @@ import { dataprocSteps } from './steps/dataproc';
import {
STEP_CREATE_CLUSTER_IMAGE_RELATIONSHIPS,
STEP_CREATE_CLUSTER_STORAGE_RELATIONSHIPS,
STEP_DATAPROC_CLUSTERS,
STEP_DATAPROC_CLUSTER_KMS_RELATIONSHIPS,
STEP_DATAPROC_CLUSTERS,
} from './steps/dataproc/constants';
import { dnsManagedZonesSteps } from './steps/dns';
import {
Expand All @@ -134,15 +134,15 @@ import {
} from './steps/functions';
import {
iamSteps,
STEP_IAM_CUSTOM_ROLES,
STEP_IAM_CUSTOM_ROLE_SERVICE_API_RELATIONSHIPS,
STEP_IAM_CUSTOM_ROLES,
STEP_IAM_MANAGED_ROLES,
STEP_IAM_SERVICE_ACCOUNTS,
} from './steps/iam';
import {
kmsSteps,
STEP_CLOUD_KMS_KEYS,
STEP_CLOUD_KMS_KEY_RINGS,
STEP_CLOUD_KMS_KEYS,
} from './steps/kms';
import { loggingSteps } from './steps/logging';
import {
Expand Down Expand Up @@ -174,8 +174,8 @@ import {
resourceManagerSteps,
STEP_AUDIT_CONFIG_IAM_POLICY,
STEP_RESOURCE_MANAGER_FOLDERS,
STEP_RESOURCE_MANAGER_ORGANIZATION,
STEP_RESOURCE_MANAGER_ORG_PROJECT_RELATIONSHIPS,
STEP_RESOURCE_MANAGER_ORGANIZATION,
STEP_RESOURCE_MANAGER_PROJECT,
} from './steps/resource-manager';
import { secretManagerSteps } from './steps/secret-manager';
Expand All @@ -184,9 +184,9 @@ import { serviceUsageSteps } from './steps/service-usage';
import { ServiceUsageStepIds } from './steps/service-usage/constants';
import { spannerSteps } from './steps/spanner';
import {
STEP_SPANNER_INSTANCES,
STEP_SPANNER_INSTANCE_CONFIGS,
STEP_SPANNER_INSTANCE_DATABASES,
STEP_SPANNER_INSTANCES,
} from './steps/spanner/constants';
import {
sqlAdminSteps,
Expand Down Expand Up @@ -948,8 +948,8 @@ async function getStepStartStatesUsingServiceEnablements(params: {

for (const serviceName of Object.keys(apiServiceToStepIdsMap)) {
if (!enabledServiceNames.includes(serviceName)) {
logger.publishInfoEvent({
name: '[service_disabled]' as IntegrationInfoEventName,
logger.publishWarnEvent({
name: 'step_skip' as IntegrationWarnEventName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this outside of the allowed values for IntegrationWarnEventName? What's the reason for type casting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, currently that is true.
My focus is to first get the new job status out the door. Follow on work will include adding all used eventNames to the sdk. Most event names are currently strings scattered throughout integrations and even the sdk.

description: `The API Service ${serviceName} is disabled in this account. As a result, the following steps are disabled: ${apiServiceToStepIdsMap[serviceName]}`,
});
}
Expand Down
46 changes: 8 additions & 38 deletions src/steps/__test__/service-api-disabled-error-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,12 @@
"retryConfig": {
"currentRetryAttempt": 0,
"retry": 3,
"httpMethodsToRetry": [
"GET",
"HEAD",
"PUT",
"OPTIONS",
"DELETE"
],
"httpMethodsToRetry": ["GET", "HEAD", "PUT", "OPTIONS", "DELETE"],
"noResponseRetries": 2,
"statusCodesToRetry": [
[
100,
199
],
[
429,
429
],
[
500,
599
]
[100, 199],
[429, 429],
[500, 599]
]
}
},
Expand Down Expand Up @@ -125,27 +110,12 @@
"retryConfig": {
"currentRetryAttempt": 0,
"retry": 3,
"httpMethodsToRetry": [
"GET",
"HEAD",
"PUT",
"OPTIONS",
"DELETE"
],
"httpMethodsToRetry": ["GET", "HEAD", "PUT", "OPTIONS", "DELETE"],
"noResponseRetries": 2,
"statusCodesToRetry": [
[
100,
199
],
[
429,
429
],
[
500,
599
]
[100, 199],
[429, 429],
[500, 599]
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/steps/dns/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { fetchComputeNetworks } from '../compute';
import {
DNS_MANAGED_ZONE_ENTITY_TYPE,
DNS_POLICY_ENTITY_TYPE,
RELATIONSHIP_TYPE_COMPUTE_NETWORK_HAS_DNS_POLICY
RELATIONSHIP_TYPE_COMPUTE_NETWORK_HAS_DNS_POLICY,
} from './constants';

const tempNewAccountConfig = {
Expand Down
9 changes: 6 additions & 3 deletions src/utils/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { IntegrationLogger } from '@jupiterone/integration-sdk-core';
import {
IntegrationLogger,
IntegrationWarnEventName,
} from '@jupiterone/integration-sdk-core';

interface PublishMissingPermissionEventParams {
logger: IntegrationLogger;
Expand All @@ -11,8 +14,8 @@ export function publishMissingPermissionEvent({
permission,
stepId,
}: PublishMissingPermissionEventParams) {
logger.publishEvent({
name: 'missing_permission',
logger.publishWarnEvent({
name: IntegrationWarnEventName.MissingPermission,
description: `"${permission}" is not a required permission to run the Google Cloud integration, but is required for step "${stepId}"`,
});
}
Expand Down