-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metric_namespace_configs to GCP v2 API (#2087)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
20b42b4
commit 8360a87
Showing
6 changed files
with
159 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
lib/datadog_api_client/v2/models/gcp_metric_namespace_config.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
=begin | ||
#Datadog API V2 Collection | ||
#Collection of all Datadog Public endpoints. | ||
The version of the OpenAPI document: 1.0 | ||
Contact: [email protected] | ||
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator | ||
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. | ||
=end | ||
|
||
require 'date' | ||
require 'time' | ||
|
||
module DatadogAPIClient::V2 | ||
# Configuration for a GCP metric namespace. | ||
class GCPMetricNamespaceConfig | ||
include BaseGenericModel | ||
|
||
# When disabled, Datadog does not collect metrics that are related to this GCP metric namespace. | ||
attr_accessor :disabled | ||
|
||
# The id of the GCP metric namespace. | ||
attr_accessor :id | ||
|
||
attr_accessor :additional_properties | ||
|
||
# Attribute mapping from ruby-style variable name to JSON key. | ||
# @!visibility private | ||
def self.attribute_map | ||
{ | ||
:'disabled' => :'disabled', | ||
:'id' => :'id' | ||
} | ||
end | ||
|
||
# Attribute type mapping. | ||
# @!visibility private | ||
def self.openapi_types | ||
{ | ||
:'disabled' => :'Boolean', | ||
:'id' => :'String' | ||
} | ||
end | ||
|
||
# Initializes the object | ||
# @param attributes [Hash] Model attributes in the form of hash | ||
# @!visibility private | ||
def initialize(attributes = {}) | ||
if (!attributes.is_a?(Hash)) | ||
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GCPMetricNamespaceConfig` initialize method" | ||
end | ||
|
||
self.additional_properties = {} | ||
# check to see if the attribute exists and convert string to symbol for hash key | ||
attributes = attributes.each_with_object({}) { |(k, v), h| | ||
if (!self.class.attribute_map.key?(k.to_sym)) | ||
self.additional_properties[k.to_sym] = v | ||
else | ||
h[k.to_sym] = v | ||
end | ||
} | ||
|
||
if attributes.key?(:'disabled') | ||
self.disabled = attributes[:'disabled'] | ||
end | ||
|
||
if attributes.key?(:'id') | ||
self.id = attributes[:'id'] | ||
end | ||
end | ||
|
||
# Returns the object in the form of hash, with additionalProperties support. | ||
# @return [Hash] Returns the object in the form of hash | ||
# @!visibility private | ||
def to_hash | ||
hash = {} | ||
self.class.attribute_map.each_pair do |attr, param| | ||
value = self.send(attr) | ||
if value.nil? | ||
is_nullable = self.class.openapi_nullable.include?(attr) | ||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) | ||
end | ||
|
||
hash[param] = _to_hash(value) | ||
end | ||
self.additional_properties.each_pair do |attr, value| | ||
hash[attr] = value | ||
end | ||
hash | ||
end | ||
|
||
# Checks equality by comparing each attribute. | ||
# @param o [Object] Object to be compared | ||
# @!visibility private | ||
def ==(o) | ||
return true if self.equal?(o) | ||
self.class == o.class && | ||
disabled == o.disabled && | ||
id == o.id | ||
additional_properties == o.additional_properties | ||
end | ||
|
||
# Calculates hash code according to all attributes. | ||
# @return [Integer] Hash code | ||
# @!visibility private | ||
def hash | ||
[disabled, id].hash | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters