Skip to content

Commit 8360a87

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add metric_namespace_configs to GCP v2 API (#2087)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 20b42b4 commit 8360a87

File tree

6 files changed

+159
-9
lines changed

6 files changed

+159
-9
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-11-05 21:07:13.880957",
8-
"spec_repo_commit": "6c0fa1b6"
7+
"regenerated": "2024-11-05 22:28:17.976412",
8+
"spec_repo_commit": "2db17c21"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-11-05 21:07:13.899409",
13-
"spec_repo_commit": "6c0fa1b6"
12+
"regenerated": "2024-11-05 22:28:17.995053",
13+
"spec_repo_commit": "2db17c21"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9623,6 +9623,20 @@ components:
96239623
nullable: true
96249624
type: array
96259625
type: object
9626+
GCPMetricNamespaceConfig:
9627+
description: Configuration for a GCP metric namespace.
9628+
properties:
9629+
disabled:
9630+
default: false
9631+
description: When disabled, Datadog does not collect metrics that are related
9632+
to this GCP metric namespace.
9633+
example: true
9634+
type: boolean
9635+
id:
9636+
description: The id of the GCP metric namespace.
9637+
example: aiplatform
9638+
type: string
9639+
type: object
96269640
GCPSTSDelegateAccount:
96279641
description: Datadog principal service account info.
96289642
properties:
@@ -9725,6 +9739,14 @@ components:
97259739
account.'
97269740
example: true
97279741
type: boolean
9742+
metric_namespace_configs:
9743+
description: Configurations for GCP metric namespaces.
9744+
example:
9745+
- disabled: true
9746+
id: aiplatform
9747+
items:
9748+
$ref: '#/components/schemas/GCPMetricNamespaceConfig'
9749+
type: array
97289750
resource_collection_enabled:
97299751
description: When enabled, Datadog scans for all resources in your GCP environment.
97309752
type: boolean

features/v2/gcp_integration.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ Feature: GCP Integration
3434
@generated @skip @team:DataDog/gcp-integrations
3535
Scenario: Create a new entry for your service account returns "Bad Request" response
3636
Given new "CreateGCPSTSAccount" request
37-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "type": "gcp_service_account"}}
37+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "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"}}
3838
When the request is sent
3939
Then the response status is 400 Bad Request
4040

4141
@generated @skip @team:DataDog/gcp-integrations
4242
Scenario: Create a new entry for your service account returns "Conflict" response
4343
Given new "CreateGCPSTSAccount" request
44-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "type": "gcp_service_account"}}
44+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "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"}}
4545
When the request is sent
4646
Then the response status is 409 Conflict
4747

@@ -151,15 +151,15 @@ Feature: GCP Integration
151151
Scenario: Update STS Service Account returns "Bad Request" response
152152
Given new "UpdateGCPSTSAccount" request
153153
And request contains "account_id" parameter from "REPLACE.ME"
154-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "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"}}
154+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "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"}}
155155
When the request is sent
156156
Then the response status is 400 Bad Request
157157

158158
@generated @skip @team:DataDog/gcp-integrations
159159
Scenario: Update STS Service Account returns "Not Found" response
160160
Given new "UpdateGCPSTSAccount" request
161161
And request contains "account_id" parameter from "REPLACE.ME"
162-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "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"}}
162+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "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"}}
163163
When the request is sent
164164
Then the response status is 404 Not Found
165165

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ def overrides
14541454
"v2.full_api_key_attributes" => "FullAPIKeyAttributes",
14551455
"v2.full_application_key" => "FullApplicationKey",
14561456
"v2.full_application_key_attributes" => "FullApplicationKeyAttributes",
1457+
"v2.gcp_metric_namespace_config" => "GCPMetricNamespaceConfig",
14571458
"v2.gcp_service_account_meta" => "GCPServiceAccountMeta",
14581459
"v2.gcp_service_account_type" => "GCPServiceAccountType",
14591460
"v2.gcpsts_delegate_account" => "GCPSTSDelegateAccount",
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Configuration for a GCP metric namespace.
21+
class GCPMetricNamespaceConfig
22+
include BaseGenericModel
23+
24+
# When disabled, Datadog does not collect metrics that are related to this GCP metric namespace.
25+
attr_accessor :disabled
26+
27+
# The id of the GCP metric namespace.
28+
attr_accessor :id
29+
30+
attr_accessor :additional_properties
31+
32+
# Attribute mapping from ruby-style variable name to JSON key.
33+
# @!visibility private
34+
def self.attribute_map
35+
{
36+
:'disabled' => :'disabled',
37+
:'id' => :'id'
38+
}
39+
end
40+
41+
# Attribute type mapping.
42+
# @!visibility private
43+
def self.openapi_types
44+
{
45+
:'disabled' => :'Boolean',
46+
:'id' => :'String'
47+
}
48+
end
49+
50+
# Initializes the object
51+
# @param attributes [Hash] Model attributes in the form of hash
52+
# @!visibility private
53+
def initialize(attributes = {})
54+
if (!attributes.is_a?(Hash))
55+
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GCPMetricNamespaceConfig` initialize method"
56+
end
57+
58+
self.additional_properties = {}
59+
# check to see if the attribute exists and convert string to symbol for hash key
60+
attributes = attributes.each_with_object({}) { |(k, v), h|
61+
if (!self.class.attribute_map.key?(k.to_sym))
62+
self.additional_properties[k.to_sym] = v
63+
else
64+
h[k.to_sym] = v
65+
end
66+
}
67+
68+
if attributes.key?(:'disabled')
69+
self.disabled = attributes[:'disabled']
70+
end
71+
72+
if attributes.key?(:'id')
73+
self.id = attributes[:'id']
74+
end
75+
end
76+
77+
# Returns the object in the form of hash, with additionalProperties support.
78+
# @return [Hash] Returns the object in the form of hash
79+
# @!visibility private
80+
def to_hash
81+
hash = {}
82+
self.class.attribute_map.each_pair do |attr, param|
83+
value = self.send(attr)
84+
if value.nil?
85+
is_nullable = self.class.openapi_nullable.include?(attr)
86+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
87+
end
88+
89+
hash[param] = _to_hash(value)
90+
end
91+
self.additional_properties.each_pair do |attr, value|
92+
hash[attr] = value
93+
end
94+
hash
95+
end
96+
97+
# Checks equality by comparing each attribute.
98+
# @param o [Object] Object to be compared
99+
# @!visibility private
100+
def ==(o)
101+
return true if self.equal?(o)
102+
self.class == o.class &&
103+
disabled == o.disabled &&
104+
id == o.id
105+
additional_properties == o.additional_properties
106+
end
107+
108+
# Calculates hash code according to all attributes.
109+
# @return [Integer] Hash code
110+
# @!visibility private
111+
def hash
112+
[disabled, id].hash
113+
end
114+
end
115+
end

lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class GCPSTSServiceAccountAttributes
4646
# When enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account.
4747
attr_accessor :is_security_command_center_enabled
4848

49+
# Configurations for GCP metric namespaces.
50+
attr_accessor :metric_namespace_configs
51+
4952
# When enabled, Datadog scans for all resources in your GCP environment.
5053
attr_accessor :resource_collection_enabled
5154

@@ -63,6 +66,7 @@ def self.attribute_map
6366
:'is_cspm_enabled' => :'is_cspm_enabled',
6467
:'is_resource_change_collection_enabled' => :'is_resource_change_collection_enabled',
6568
:'is_security_command_center_enabled' => :'is_security_command_center_enabled',
69+
:'metric_namespace_configs' => :'metric_namespace_configs',
6670
:'resource_collection_enabled' => :'resource_collection_enabled'
6771
}
6872
end
@@ -79,6 +83,7 @@ def self.openapi_types
7983
:'is_cspm_enabled' => :'Boolean',
8084
:'is_resource_change_collection_enabled' => :'Boolean',
8185
:'is_security_command_center_enabled' => :'Boolean',
86+
:'metric_namespace_configs' => :'Array<GCPMetricNamespaceConfig>',
8287
:'resource_collection_enabled' => :'Boolean'
8388
}
8489
end
@@ -139,6 +144,12 @@ def initialize(attributes = {})
139144
self.is_security_command_center_enabled = attributes[:'is_security_command_center_enabled']
140145
end
141146

147+
if attributes.key?(:'metric_namespace_configs')
148+
if (value = attributes[:'metric_namespace_configs']).is_a?(Array)
149+
self.metric_namespace_configs = value
150+
end
151+
end
152+
142153
if attributes.key?(:'resource_collection_enabled')
143154
self.resource_collection_enabled = attributes[:'resource_collection_enabled']
144155
end
@@ -178,6 +189,7 @@ def ==(o)
178189
is_cspm_enabled == o.is_cspm_enabled &&
179190
is_resource_change_collection_enabled == o.is_resource_change_collection_enabled &&
180191
is_security_command_center_enabled == o.is_security_command_center_enabled &&
192+
metric_namespace_configs == o.metric_namespace_configs &&
181193
resource_collection_enabled == o.resource_collection_enabled
182194
additional_properties == o.additional_properties
183195
end
@@ -186,7 +198,7 @@ def ==(o)
186198
# @return [Integer] Hash code
187199
# @!visibility private
188200
def hash
189-
[account_tags, automute, client_email, cloud_run_revision_filters, host_filters, is_cspm_enabled, is_resource_change_collection_enabled, is_security_command_center_enabled, resource_collection_enabled].hash
201+
[account_tags, automute, client_email, cloud_run_revision_filters, host_filters, is_cspm_enabled, is_resource_change_collection_enabled, is_security_command_center_enabled, metric_namespace_configs, resource_collection_enabled].hash
190202
end
191203
end
192204
end

0 commit comments

Comments
 (0)