Skip to content
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
418 changes: 418 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/v2/cloud-cost-management/GetCostTagKey.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Get a Cloud Cost Management tag key returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_cost_tag_key("tag_key")
5 changes: 5 additions & 0 deletions examples/v2/cloud-cost-management/ListCostTagKeys.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List Cloud Cost Management tag keys returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_cost_tag_keys()
5 changes: 5 additions & 0 deletions examples/v2/cloud-cost-management/ListCostTags.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List Cloud Cost Management tags returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_cost_tags()
16 changes: 16 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2204,6 +2204,22 @@
"v2.ListCostTagDescriptions" => {
"filter_cloud" => "String",
},
"v2.ListCostTagKeys" => {
"filter_metric" => "String",
"filter_tags" => "Array<String>",
},
"v2.GetCostTagKey" => {
"tag_key" => "String",
"filter_metric" => "String",
"page_size" => "Integer",
},
"v2.ListCostTags" => {
"filter_metric" => "String",
"filter_match" => "String",
"filter_tags" => "Array<String>",
"filter_tag_keys" => "Array<String>",
"page_size" => "Integer",
},
"v2.CreateTagPipelinesRuleset" => {
"body" => "CreateRulesetRequest",
},
Expand Down
45 changes: 45 additions & 0 deletions features/v2/cloud_cost_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,27 @@ Feature: Cloud Cost Management
And the response "data.type" is equal to "gcp_uc_config"
And the response "data.attributes.account_id" is equal to "123456_ABCDEF_123ABC"

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Get a Cloud Cost Management tag key returns "Bad Request" response
Given new "GetCostTagKey" request
And request contains "tag_key" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Get a Cloud Cost Management tag key returns "Not Found" response
Given new "GetCostTagKey" request
And request contains "tag_key" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Get a Cloud Cost Management tag key returns "OK" response
Given new "GetCostTagKey" request
And request contains "tag_key" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@team:DataDog/cloud-cost-management
Scenario: Get a budget returns "Not Found" response
Given new "GetBudget" request
Expand Down Expand Up @@ -349,6 +370,30 @@ Feature: Cloud Cost Management
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/cloud-cost-management
Scenario: List Cloud Cost Management tag keys returns "Bad Request" response
Given new "ListCostTagKeys" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/cloud-cost-management
Scenario: List Cloud Cost Management tag keys returns "OK" response
Given new "ListCostTagKeys" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/cloud-cost-management
Scenario: List Cloud Cost Management tags returns "Bad Request" response
Given new "ListCostTags" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/cloud-cost-management
Scenario: List Cloud Cost Management tags returns "OK" response
Given new "ListCostTags" request
When the request is sent
Then the response status is 200 OK

@replay-only @team:DataDog/cloud-cost-management
Scenario: List Custom Costs Files returns "OK" response
Given new "ListCustomCostsFiles" request
Expand Down
18 changes: 18 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,24 @@
"type": "safe"
}
},
"ListCostTagKeys": {
"tag": "Cloud Cost Management",
"undo": {
"type": "safe"
}
},
"GetCostTagKey": {
"tag": "Cloud Cost Management",
"undo": {
"type": "safe"
}
},
"ListCostTags": {
"tag": "Cloud Cost Management",
"undo": {
"type": "safe"
}
},
"GetActiveBillingDimensions": {
"tag": "Usage Metering",
"undo": {
Expand Down
10 changes: 10 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1996,11 +1996,21 @@ def overrides
"v2.cost_by_org_attributes" => "CostByOrgAttributes",
"v2.cost_by_org_response" => "CostByOrgResponse",
"v2.cost_by_org_type" => "CostByOrgType",
"v2.cost_tag" => "CostTag",
"v2.cost_tag_attributes" => "CostTagAttributes",
"v2.cost_tag_description" => "CostTagDescription",
"v2.cost_tag_description_attributes" => "CostTagDescriptionAttributes",
"v2.cost_tag_description_source" => "CostTagDescriptionSource",
"v2.cost_tag_descriptions_response" => "CostTagDescriptionsResponse",
"v2.cost_tag_description_type" => "CostTagDescriptionType",
"v2.cost_tag_key" => "CostTagKey",
"v2.cost_tag_key_attributes" => "CostTagKeyAttributes",
"v2.cost_tag_key_details" => "CostTagKeyDetails",
"v2.cost_tag_key_response" => "CostTagKeyResponse",
"v2.cost_tag_keys_response" => "CostTagKeysResponse",
"v2.cost_tag_key_type" => "CostTagKeyType",
"v2.cost_tags_response" => "CostTagsResponse",
"v2.cost_tag_type" => "CostTagType",
"v2.coverage_summary_attributes" => "CoverageSummaryAttributes",
"v2.coverage_summary_codeowner_stats" => "CoverageSummaryCodeownerStats",
"v2.coverage_summary_data" => "CoverageSummaryData",
Expand Down
211 changes: 211 additions & 0 deletions lib/datadog_api_client/v2/api/cloud_cost_management_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,78 @@ def get_cost_gcp_usage_cost_config_with_http_info(cloud_account_id, opts = {})
return data, status_code, headers
end

# Get a Cloud Cost Management tag key.
#
# @see #get_cost_tag_key_with_http_info
def get_cost_tag_key(tag_key, opts = {})
data, _status_code, _headers = get_cost_tag_key_with_http_info(tag_key, opts)
data
end

# Get a Cloud Cost Management tag key.
#
# Get details for a specific Cloud Cost Management tag key, including example tag values and description.
#
# @param tag_key [String] The Cloud Cost Management tag key. Tag keys can contain forward slashes (for example, `kubernetes/instance`).
# @param opts [Hash] the optional parameters
# @option opts [String] :filter_metric The Cloud Cost Management metric to scope the tag key details to. When omitted, returns details across all metrics.
# @option opts [Integer] :page_size Controls the size of the internal tag value search scope. This does **not** restrict the number of example tag values returned in the response. Defaults to 50, maximum 10000.
# @return [Array<(CostTagKeyResponse, Integer, Hash)>] CostTagKeyResponse data, response status code and response headers
def get_cost_tag_key_with_http_info(tag_key, opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.get_cost_tag_key ...'
end
# verify the required parameter 'tag_key' is set
if @api_client.config.client_side_validation && tag_key.nil?
fail ArgumentError, "Missing the required parameter 'tag_key' when calling CloudCostManagementAPI.get_cost_tag_key"
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CloudCostManagementAPI.get_cost_tag_key, must be smaller than or equal to 10000.'
end
# resource path
local_var_path = '/api/v2/cost/tag_keys/{tag_key}'.sub('{tag_key}', CGI.escape(tag_key.to_s).gsub('%2F', '/'))

# query parameters
query_params = opts[:query_params] || {}
query_params[:'filter[metric]'] = opts[:'filter_metric'] if !opts[:'filter_metric'].nil?
query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body]

# return_type
return_type = opts[:debug_return_type] || 'CostTagKeyResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

new_options = opts.merge(
:operation => :get_cost_tag_key,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CloudCostManagementAPI#get_cost_tag_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get custom allocation rule.
#
# @see #get_custom_allocation_rule_with_http_info
Expand Down Expand Up @@ -1802,6 +1874,145 @@ def list_cost_tag_descriptions_with_http_info(opts = {})
return data, status_code, headers
end

# List Cloud Cost Management tag keys.
#
# @see #list_cost_tag_keys_with_http_info
def list_cost_tag_keys(opts = {})
data, _status_code, _headers = list_cost_tag_keys_with_http_info(opts)
data
end

# List Cloud Cost Management tag keys.
#
# List Cloud Cost Management tag keys.
#
# @param opts [Hash] the optional parameters
# @option opts [String] :filter_metric The Cloud Cost Management metric to scope the tag keys to. When omitted, returns tag keys across all metrics.
# @option opts [Array<String>] :filter_tags Filter to return only tag keys that appear with the given `key:value` tag values. For example, `filter[tags]=providername:aws` returns tag keys found on the same cost data, such as `is_aws_ec2_compute` and `aws_instance_type`.
# @return [Array<(CostTagKeysResponse, Integer, Hash)>] CostTagKeysResponse data, response status code and response headers
def list_cost_tag_keys_with_http_info(opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.list_cost_tag_keys ...'
end
# resource path
local_var_path = '/api/v2/cost/tag_keys'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'filter[metric]'] = opts[:'filter_metric'] if !opts[:'filter_metric'].nil?
query_params[:'filter[tags]'] = @api_client.build_collection_param(opts[:'filter_tags'], :multi) if !opts[:'filter_tags'].nil?

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body]

# return_type
return_type = opts[:debug_return_type] || 'CostTagKeysResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

new_options = opts.merge(
:operation => :list_cost_tag_keys,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CloudCostManagementAPI#list_cost_tag_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# List Cloud Cost Management tags.
#
# @see #list_cost_tags_with_http_info
def list_cost_tags(opts = {})
data, _status_code, _headers = list_cost_tags_with_http_info(opts)
data
end

# List Cloud Cost Management tags.
#
# List Cloud Cost Management tags for a given metric.
#
# @param opts [Hash] the optional parameters
# @option opts [String] :filter_metric The Cloud Cost Management metric to scope the tags to. When omitted, returns tags across all metrics.
# @option opts [String] :filter_match A substring used to filter the returned tags by name.
# @option opts [Array<String>] :filter_tags Filter to return only tags that appear with the given `key:value` tag values. For example, `filter[tags]=providername:aws` returns tags found on the same cost data, such as `aws_instance_type:t3.micro` and `aws_instance_type:m5.large`.
# @option opts [Array<String>] :filter_tag_keys Restrict the returned tags to those whose key matches one of the given tag keys.
# @option opts [Integer] :page_size Controls the size of the internal tag search scope. This does **not** restrict the number of tags returned in the response. Defaults to 50, maximum 10000.
# @return [Array<(CostTagsResponse, Integer, Hash)>] CostTagsResponse data, response status code and response headers
def list_cost_tags_with_http_info(opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.list_cost_tags ...'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CloudCostManagementAPI.list_cost_tags, must be smaller than or equal to 10000.'
end
# resource path
local_var_path = '/api/v2/cost/tags'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'filter[metric]'] = opts[:'filter_metric'] if !opts[:'filter_metric'].nil?
query_params[:'filter[match]'] = opts[:'filter_match'] if !opts[:'filter_match'].nil?
query_params[:'filter[tags]'] = @api_client.build_collection_param(opts[:'filter_tags'], :multi) if !opts[:'filter_tags'].nil?
query_params[:'filter[tag_keys]'] = @api_client.build_collection_param(opts[:'filter_tag_keys'], :multi) if !opts[:'filter_tag_keys'].nil?
query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body]

# return_type
return_type = opts[:debug_return_type] || 'CostTagsResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

new_options = opts.merge(
:operation => :list_cost_tags,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CloudCostManagementAPI#list_cost_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# List custom allocation rules.
#
# @see #list_custom_allocation_rules_with_http_info
Expand Down
Loading
Loading