From 7a56390bd0bb9e7b441e25a2060218481b07d71c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 31 Oct 2024 16:04:21 +0000 Subject: [PATCH] Regenerate client from commit a11da7b5 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 132 ++++++++++++++++++ ...points-returns-Bad-Request-response.frozen | 1 + ...endpoints-returns-Bad-Request-response.yml | 22 +++ .../GetBillingDimensionMapping.rb | 8 ++ features/scenarios_model_mapping.rb | 4 + features/v2/undo.json | 6 + features/v2/usage_metering.feature | 14 ++ lib/datadog_api_client/configuration.rb | 1 + lib/datadog_api_client/inflector.rb | 5 + .../v2/api/usage_metering_api.rb | 73 ++++++++++ .../billing_dimensions_mapping_body_item.rb | 125 +++++++++++++++++ ...dimensions_mapping_body_item_attributes.rb | 127 +++++++++++++++++ ...ng_body_item_attributes_endpoints_items.rb | 127 +++++++++++++++++ ..._item_attributes_endpoints_items_status.rb | 27 ++++ .../billing_dimensions_mapping_response.rb | 107 ++++++++++++++ 16 files changed, 783 insertions(+), 4 deletions(-) create mode 100644 cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.yml create mode 100644 examples/v2/usage-metering/GetBillingDimensionMapping.rb create mode 100644 lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item.rb create mode 100644 lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items.rb create mode 100644 lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items_status.rb create mode 100644 lib/datadog_api_client/v2/models/billing_dimensions_mapping_response.rb diff --git a/.apigentools-info b/.apigentools-info index 293140d9cffe..9960e6d621a5 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-31 15:33:01.721264", - "spec_repo_commit": "a7602fa1" + "regenerated": "2024-10-31 16:03:55.097621", + "spec_repo_commit": "a11da7b5" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-31 15:33:01.739608", - "spec_repo_commit": "a7602fa1" + "regenerated": "2024-10-31 16:03:55.116103", + "spec_repo_commit": "a11da7b5" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7f9b23070edc..61de273a3d92 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2186,6 +2186,74 @@ components: - storage_account - storage_container type: object + BillingDimensionsMappingBody: + description: Billing dimensions mapping data. + items: + $ref: '#/components/schemas/BillingDimensionsMappingBodyItem' + type: array + BillingDimensionsMappingBodyItem: + description: The mapping data for each billing dimension. + properties: + attributes: + $ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributes' + id: + description: ID of the billing dimension. + type: string + type: + $ref: '#/components/schemas/ActiveBillingDimensionsType' + type: object + BillingDimensionsMappingBodyItemAttributes: + description: Mapping of billing dimensions to endpoint keys. + properties: + endpoints: + description: List of supported endpoints with their keys mapped to the billing_dimension. + items: + $ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributesEndpointsItems' + type: array + in_app_label: + description: Label used for the billing dimension in the Plan & Usage charts. + example: APM Hosts + type: string + timestamp: + description: 'Month in ISO-8601 format, UTC, and precise to the second: + `[YYYY-MM-DDThh:mm:ss]`.' + format: date-time + type: string + type: object + BillingDimensionsMappingBodyItemAttributesEndpointsItems: + description: An endpoint's keys mapped to the billing_dimension. + properties: + id: + description: The URL for the endpoint. + example: api/v1/usage/billable-summary + type: string + keys: + description: The billing dimension. + example: + - apm_host_top99p + - apm_host_sum + items: + example: apm_host_top99p + type: string + type: array + status: + $ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus' + type: object + BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus: + description: Denotes whether mapping keys were available for this endpoint. + enum: + - OK + - NOT_FOUND + type: string + x-enum-varnames: + - OK + - NOT_FOUND + BillingDimensionsMappingResponse: + description: Billing dimensions mapping response. + properties: + data: + $ref: '#/components/schemas/BillingDimensionsMappingBody' + type: object BulkMuteFindingsRequest: description: The new bulk mute finding request. properties: @@ -41037,6 +41105,70 @@ paths: operator: OR permissions: - usage_read + /api/v2/usage/billing_dimension_mapping: + get: + description: 'Get a mapping of billing dimensions to the corresponding keys + for the supported usage metering public API endpoints. + + Mapping data is updated on a monthly cadence. + + + This endpoint is only accessible to [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).' + operationId: GetBillingDimensionMapping + parameters: + - description: Datetime in ISO-8601 format, UTC, and for mappings beginning + this month. Defaults to the current month. + in: query + name: filter[month] + required: false + schema: + format: date-time + type: string + - description: String to specify whether to retrieve active billing dimension + mappings for the contract or for all available mappings. Allowed views have + the string `active` or `all`. Defaults to `active`. + in: query + name: filter[view] + required: false + schema: + default: active + type: string + responses: + '200': + content: + application/json;datetime-format=rfc3339: + schema: + $ref: '#/components/schemas/BillingDimensionsMappingResponse' + description: OK + '400': + content: + application/json;datetime-format=rfc3339: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json;datetime-format=rfc3339: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden - User is not authorized + '429': + content: + application/json;datetime-format=rfc3339: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too many requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - usage_read + summary: Get billing dimension mapping for usage endpoints + tags: + - Usage Metering + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/usage/cost_by_org: get: deprecated: true diff --git a/cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.frozen b/cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..ccd20a305226 --- /dev/null +++ b/cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-28T16:04:40.774Z \ No newline at end of file diff --git a/cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.yml b/cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..0ecdc5773269 --- /dev/null +++ b/cassettes/features/v2/usage_metering/Get-billing-dimension-mapping-for-usage-endpoints-returns-Bad-Request-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Mon, 28 Oct 2024 16:04:40 GMT + request: + body: null + headers: + Accept: + - application/json;datetime-format=rfc3339 + method: GET + uri: https://api.datadoghq.com/api/v2/usage/billing_dimension_mapping + response: + body: + encoding: UTF-8 + string: '{"errors":[{"id":null,"links":null,"status":"400","code":null,"title":"Bad + Request","detail":"API called with non-parent org keys. Data is only available + at the root level org","source":null,"meta":null}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/examples/v2/usage-metering/GetBillingDimensionMapping.rb b/examples/v2/usage-metering/GetBillingDimensionMapping.rb new file mode 100644 index 000000000000..58ed76f3be8c --- /dev/null +++ b/examples/v2/usage-metering/GetBillingDimensionMapping.rb @@ -0,0 +1,8 @@ +# Get billing dimension mapping for usage endpoints returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_billing_dimension_mapping".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new +p api_instance.get_billing_dimension_mapping() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index e23e20d789e5..979f787c50eb 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1129,6 +1129,10 @@ "start_hr" => "Time", "end_hr" => "Time", }, + "v2.GetBillingDimensionMapping" => { + "filter_month" => "Time", + "filter_view" => "String", + }, "v2.GetCostByOrg" => { "start_month" => "Time", "end_month" => "Time", diff --git a/features/v2/undo.json b/features/v2/undo.json index 62b494c8dc11..0e2af9556a50 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2494,6 +2494,12 @@ "type": "safe" } }, + "GetBillingDimensionMapping": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, "GetCostByOrg": { "tag": "Usage Metering", "undo": { diff --git a/features/v2/usage_metering.feature b/features/v2/usage_metering.feature index 4773ad013388..5250338210cb 100644 --- a/features/v2/usage_metering.feature +++ b/features/v2/usage_metering.feature @@ -48,6 +48,20 @@ Feature: Usage Metering When the request is sent Then the response status is 200 OK + @team:DataDog/revenue-query + Scenario: Get billing dimension mapping for usage endpoints returns "Bad Request" response + Given operation "GetBillingDimensionMapping" enabled + And new "GetBillingDimensionMapping" request + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/revenue-query + Scenario: Get billing dimension mapping for usage endpoints returns "OK" response + Given operation "GetBillingDimensionMapping" enabled + And new "GetBillingDimensionMapping" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/revenue-query Scenario: Get cost across multi-org account returns "Bad Request" response Given new "GetCostByOrg" request diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index a062779a2057..3e0946f8a58b 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -195,6 +195,7 @@ def initialize "v2.list_apis": false, "v2.update_open_api": false, "v2.get_active_billing_dimensions": false, + "v2.get_billing_dimension_mapping": false, "v2.get_monthly_cost_attribution": false, "v2.create_dora_deployment": false, "v2.create_dora_incident": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 0bcdf4f7aad9..4e84f56f3af1 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1007,6 +1007,11 @@ def overrides "v2.azure_uc_config_post_request_type" => "AzureUCConfigPostRequestType", "v2.azure_uc_configs_response" => "AzureUCConfigsResponse", "v2.bill_config" => "BillConfig", + "v2.billing_dimensions_mapping_body_item" => "BillingDimensionsMappingBodyItem", + "v2.billing_dimensions_mapping_body_item_attributes" => "BillingDimensionsMappingBodyItemAttributes", + "v2.billing_dimensions_mapping_body_item_attributes_endpoints_items" => "BillingDimensionsMappingBodyItemAttributesEndpointsItems", + "v2.billing_dimensions_mapping_body_item_attributes_endpoints_items_status" => "BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus", + "v2.billing_dimensions_mapping_response" => "BillingDimensionsMappingResponse", "v2.bulk_mute_findings_request" => "BulkMuteFindingsRequest", "v2.bulk_mute_findings_request_attributes" => "BulkMuteFindingsRequestAttributes", "v2.bulk_mute_findings_request_data" => "BulkMuteFindingsRequestData", diff --git a/lib/datadog_api_client/v2/api/usage_metering_api.rb b/lib/datadog_api_client/v2/api/usage_metering_api.rb index 5a7b359b9baa..7832ceb9b1c2 100644 --- a/lib/datadog_api_client/v2/api/usage_metering_api.rb +++ b/lib/datadog_api_client/v2/api/usage_metering_api.rb @@ -89,6 +89,79 @@ def get_active_billing_dimensions_with_http_info(opts = {}) return data, status_code, headers end + # Get billing dimension mapping for usage endpoints. + # + # @see #get_billing_dimension_mapping_with_http_info + def get_billing_dimension_mapping(opts = {}) + data, _status_code, _headers = get_billing_dimension_mapping_with_http_info(opts) + data + end + + # Get billing dimension mapping for usage endpoints. + # + # Get a mapping of billing dimensions to the corresponding keys for the supported usage metering public API endpoints. + # Mapping data is updated on a monthly cadence. + # + # This endpoint is only accessible to [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/). + # + # @param opts [Hash] the optional parameters + # @option opts [Time] :filter_month Datetime in ISO-8601 format, UTC, and for mappings beginning this month. Defaults to the current month. + # @option opts [String] :filter_view String to specify whether to retrieve active billing dimension mappings for the contract or for all available mappings. Allowed views have the string `active` or `all`. Defaults to `active`. + # @return [Array<(BillingDimensionsMappingResponse, Integer, Hash)>] BillingDimensionsMappingResponse data, response status code and response headers + def get_billing_dimension_mapping_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_billing_dimension_mapping".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_billing_dimension_mapping") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_billing_dimension_mapping")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_billing_dimension_mapping ...' + end + # resource path + local_var_path = '/api/v2/usage/billing_dimension_mapping' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[month]'] = opts[:'filter_month'] if !opts[:'filter_month'].nil? + query_params[:'filter[view]'] = opts[:'filter_view'] if !opts[:'filter_view'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json;datetime-format=rfc3339']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'BillingDimensionsMappingResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_billing_dimension_mapping, + :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: UsageMeteringAPI#get_billing_dimension_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get cost across multi-org account. # # @see #get_cost_by_org_with_http_info diff --git a/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item.rb b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item.rb new file mode 100644 index 000000000000..e818fb23a38e --- /dev/null +++ b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +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 + # The mapping data for each billing dimension. + class BillingDimensionsMappingBodyItem + include BaseGenericModel + + # Mapping of billing dimensions to endpoint keys. + attr_accessor :attributes + + # ID of the billing dimension. + attr_accessor :id + + # Type of active billing dimensions data. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'BillingDimensionsMappingBodyItemAttributes', + :'id' => :'String', + :'type' => :'ActiveBillingDimensionsType' + } + 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::BillingDimensionsMappingBodyItem` 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?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + 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 && + attributes == o.attributes && + id == o.id && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes.rb b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes.rb new file mode 100644 index 000000000000..9254a9196c03 --- /dev/null +++ b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes.rb @@ -0,0 +1,127 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +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 + # Mapping of billing dimensions to endpoint keys. + class BillingDimensionsMappingBodyItemAttributes + include BaseGenericModel + + # List of supported endpoints with their keys mapped to the billing_dimension. + attr_accessor :endpoints + + # Label used for the billing dimension in the Plan & Usage charts. + attr_accessor :in_app_label + + # Month in ISO-8601 format, UTC, and precise to the second: `[YYYY-MM-DDThh:mm:ss]`. + attr_accessor :timestamp + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'endpoints' => :'endpoints', + :'in_app_label' => :'in_app_label', + :'timestamp' => :'timestamp' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'endpoints' => :'Array', + :'in_app_label' => :'String', + :'timestamp' => :'Time' + } + 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::BillingDimensionsMappingBodyItemAttributes` 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?(:'endpoints') + if (value = attributes[:'endpoints']).is_a?(Array) + self.endpoints = value + end + end + + if attributes.key?(:'in_app_label') + self.in_app_label = attributes[:'in_app_label'] + end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + 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 && + endpoints == o.endpoints && + in_app_label == o.in_app_label && + timestamp == o.timestamp + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [endpoints, in_app_label, timestamp].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items.rb b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items.rb new file mode 100644 index 000000000000..af8d81d87f58 --- /dev/null +++ b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items.rb @@ -0,0 +1,127 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +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 + # An endpoint's keys mapped to the billing_dimension. + class BillingDimensionsMappingBodyItemAttributesEndpointsItems + include BaseGenericModel + + # The URL for the endpoint. + attr_accessor :id + + # The billing dimension. + attr_accessor :keys + + # Denotes whether mapping keys were available for this endpoint. + attr_accessor :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'keys' => :'keys', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'keys' => :'Array', + :'status' => :'BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus' + } + 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::BillingDimensionsMappingBodyItemAttributesEndpointsItems` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'keys') + if (value = attributes[:'keys']).is_a?(Array) + self.keys = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + 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 && + id == o.id && + keys == o.keys && + status == o.status + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, keys, status].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items_status.rb b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items_status.rb new file mode 100644 index 000000000000..83de8a4d3b42 --- /dev/null +++ b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_body_item_attributes_endpoints_items_status.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +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 + # Denotes whether mapping keys were available for this endpoint. + class BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus + include BaseEnumModel + + OK = "OK".freeze + NOT_FOUND = "NOT_FOUND".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/billing_dimensions_mapping_response.rb b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_response.rb new file mode 100644 index 000000000000..879ec534a8dc --- /dev/null +++ b/lib/datadog_api_client/v2/models/billing_dimensions_mapping_response.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +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 + # Billing dimensions mapping response. + class BillingDimensionsMappingResponse + include BaseGenericModel + + # Billing dimensions mapping data. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + 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::BillingDimensionsMappingResponse` 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?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + 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 && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end