Skip to content

Commit

Permalink
Add metric_namespace_configs to GCP v2 API (#1894)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Nov 6, 2024
1 parent 3a1bfd5 commit 506dc62
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-11-05 21:07:10.843952",
"spec_repo_commit": "6c0fa1b6"
"regenerated": "2024-11-05 22:28:18.403817",
"spec_repo_commit": "2db17c21"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-11-05 21:07:10.862374",
"spec_repo_commit": "6c0fa1b6"
"regenerated": "2024-11-05 22:28:18.425193",
"spec_repo_commit": "2db17c21"
}
}
}
22 changes: 22 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9623,6 +9623,20 @@ components:
nullable: true
type: array
type: object
GCPMetricNamespaceConfig:
description: Configuration for a GCP metric namespace.
properties:
disabled:
default: false
description: When disabled, Datadog does not collect metrics that are related
to this GCP metric namespace.
example: true
type: boolean
id:
description: The id of the GCP metric namespace.
example: aiplatform
type: string
type: object
GCPSTSDelegateAccount:
description: Datadog principal service account info.
properties:
Expand Down Expand Up @@ -9725,6 +9739,14 @@ components:
account.'
example: true
type: boolean
metric_namespace_configs:
description: Configurations for GCP metric namespaces.
example:
- disabled: true
id: aiplatform
items:
$ref: '#/components/schemas/GCPMetricNamespaceConfig'
type: array
resource_collection_enabled:
description: When enabled, Datadog scans for all resources in your GCP environment.
type: boolean
Expand Down
8 changes: 4 additions & 4 deletions features/v2/gcp_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ Feature: GCP Integration
@generated @skip @team:DataDog/gcp-integrations
Scenario: Create a new entry for your service account returns "Bad Request" response
Given new "CreateGCPSTSAccount" request
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "type": "gcp_service_account"}}
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "type": "gcp_service_account"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/gcp-integrations
Scenario: Create a new entry for your service account returns "Conflict" response
Given new "CreateGCPSTSAccount" request
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "type": "gcp_service_account"}}
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "type": "gcp_service_account"}}
When the request is sent
Then the response status is 409 Conflict

Expand Down Expand Up @@ -151,15 +151,15 @@ Feature: GCP Integration
Scenario: Update STS Service Account returns "Bad Request" response
Given new "UpdateGCPSTSAccount" request
And request contains "account_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/gcp-integrations
Scenario: Update STS Service Account returns "Not Found" response
Given new "UpdateGCPSTSAccount" request
And request contains "account_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
When the request is sent
Then the response status is 404 Not Found

Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ export { FullAPIKey } from "./models/FullAPIKey";
export { FullAPIKeyAttributes } from "./models/FullAPIKeyAttributes";
export { FullApplicationKey } from "./models/FullApplicationKey";
export { FullApplicationKeyAttributes } from "./models/FullApplicationKeyAttributes";
export { GCPMetricNamespaceConfig } from "./models/GCPMetricNamespaceConfig";
export { GCPServiceAccountMeta } from "./models/GCPServiceAccountMeta";
export { GCPServiceAccountType } from "./models/GCPServiceAccountType";
export { GCPSTSDelegateAccount } from "./models/GCPSTSDelegateAccount";
Expand Down
60 changes: 60 additions & 0 deletions packages/datadog-api-client-v2/models/GCPMetricNamespaceConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2020-Present Datadog, Inc.
*/

import { AttributeTypeMap } from "../../datadog-api-client-common/util";

/**
* Configuration for a GCP metric namespace.
*/
export class GCPMetricNamespaceConfig {
/**
* When disabled, Datadog does not collect metrics that are related to this GCP metric namespace.
*/
"disabled"?: boolean;
/**
* The id of the GCP metric namespace.
*/
"id"?: string;

/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
"additionalProperties"?: { [key: string]: any };

/**
* @ignore
*/
"_unparsed"?: boolean;

/**
* @ignore
*/
static readonly attributeTypeMap: AttributeTypeMap = {
disabled: {
baseName: "disabled",
type: "boolean",
},
id: {
baseName: "id",
type: "string",
},
additionalProperties: {
baseName: "additionalProperties",
type: "any",
},
};

/**
* @ignore
*/
static getAttributeTypeMap(): AttributeTypeMap {
return GCPMetricNamespaceConfig.attributeTypeMap;
}

public constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2020-Present Datadog, Inc.
*/
import { GCPMetricNamespaceConfig } from "./GCPMetricNamespaceConfig";

import { AttributeTypeMap } from "../../datadog-api-client-common/util";

Expand Down Expand Up @@ -43,6 +44,10 @@ export class GCPSTSServiceAccountAttributes {
* When enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account.
*/
"isSecurityCommandCenterEnabled"?: boolean;
/**
* Configurations for GCP metric namespaces.
*/
"metricNamespaceConfigs"?: Array<GCPMetricNamespaceConfig>;
/**
* When enabled, Datadog scans for all resources in your GCP environment.
*/
Expand Down Expand Up @@ -96,6 +101,10 @@ export class GCPSTSServiceAccountAttributes {
baseName: "is_security_command_center_enabled",
type: "boolean",
},
metricNamespaceConfigs: {
baseName: "metric_namespace_configs",
type: "Array<GCPMetricNamespaceConfig>",
},
resourceCollectionEnabled: {
baseName: "resource_collection_enabled",
type: "boolean",
Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-api-client-v2/models/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ import { FullAPIKey } from "./FullAPIKey";
import { FullAPIKeyAttributes } from "./FullAPIKeyAttributes";
import { FullApplicationKey } from "./FullApplicationKey";
import { FullApplicationKeyAttributes } from "./FullApplicationKeyAttributes";
import { GCPMetricNamespaceConfig } from "./GCPMetricNamespaceConfig";
import { GCPSTSDelegateAccount } from "./GCPSTSDelegateAccount";
import { GCPSTSDelegateAccountAttributes } from "./GCPSTSDelegateAccountAttributes";
import { GCPSTSDelegateAccountResponse } from "./GCPSTSDelegateAccountResponse";
Expand Down Expand Up @@ -2429,6 +2430,7 @@ const typeMap: { [index: string]: any } = {
FullAPIKeyAttributes: FullAPIKeyAttributes,
FullApplicationKey: FullApplicationKey,
FullApplicationKeyAttributes: FullApplicationKeyAttributes,
GCPMetricNamespaceConfig: GCPMetricNamespaceConfig,
GCPSTSDelegateAccount: GCPSTSDelegateAccount,
GCPSTSDelegateAccountAttributes: GCPSTSDelegateAccountAttributes,
GCPSTSDelegateAccountResponse: GCPSTSDelegateAccountResponse,
Expand Down

0 comments on commit 506dc62

Please sign in to comment.