diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index bf4011c1550d..053bf0343394 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -4062,6 +4062,86 @@ components: type: string type: array type: object + AccountFilters: + description: The account filters for a cloud account. + properties: + attributes: + $ref: "#/components/schemas/AccountFiltersAttributes" + id: + description: The ID of the cloud account. + example: "123456789123" + type: string + type: + $ref: "#/components/schemas/AccountFiltersType" + required: + - attributes + - type + type: object + AccountFiltersAttributes: + description: Attributes for the account filters of a cloud account. + properties: + account_filters: + $ref: "#/components/schemas/AccountFilteringConfig" + account_id: + description: The cloud account ID. + example: "123456789123" + type: string + cloud: + description: The cloud provider of the account, for example `aws`, `aws_cur2`, or `oci`. + example: "aws_cur2" + type: string + type: object + AccountFiltersPatchData: + description: Account filters patch data. + properties: + attributes: + $ref: "#/components/schemas/AccountFiltersPatchRequestAttributes" + type: + $ref: "#/components/schemas/AccountFiltersPatchRequestType" + required: + - attributes + - type + type: object + AccountFiltersPatchRequest: + description: Account filters patch request. + properties: + data: + $ref: "#/components/schemas/AccountFiltersPatchData" + required: + - data + type: object + AccountFiltersPatchRequestAttributes: + description: Attributes for an account filters patch request. + properties: + account_filters: + $ref: "#/components/schemas/AccountFilteringConfig" + required: + - account_filters + type: object + AccountFiltersPatchRequestType: + default: account_filters_patch_request + description: Type of account filters patch request. + enum: + - account_filters_patch_request + example: account_filters_patch_request + type: string + x-enum-varnames: + - ACCOUNT_FILTERS_PATCH_REQUEST + AccountFiltersResponse: + description: Response containing the account filters for a cloud account. + properties: + data: + $ref: "#/components/schemas/AccountFilters" + type: object + AccountFiltersType: + default: account_filters + description: Type of account filters. + enum: + - account_filters + example: account_filters + type: string + x-enum-varnames: + - ACCOUNT_FILTERS ActionConnectionAttributes: description: The definition of `ActionConnectionAttributes` object. properties: @@ -126466,6 +126546,182 @@ paths: "x-permission": operator: OPEN permissions: [] + /api/v2/cost/account_filters/{cloud_account_id}: + get: + description: Get the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + operationId: GetCostAccountFilters + parameters: + - $ref: "#/components/parameters/CloudAccountID" + responses: + "200": + content: + application/json: + examples: + default: + summary: Include new accounts and exclude specific accounts + value: + data: + attributes: + account_filters: + excluded_accounts: + - "123456789123" + - "123456789143" + include_new_accounts: true + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + include_accounts: + summary: Exclude new accounts and include specific accounts + value: + data: + attributes: + account_filters: + include_new_accounts: false + included_accounts: + - "123456789123" + - "123456789143" + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + schema: + $ref: "#/components/schemas/AccountFiltersResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get account filters + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + patch: + description: Update the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + operationId: UpdateCostAccountFilters + parameters: + - $ref: "#/components/parameters/CloudAccountID" + requestBody: + content: + application/json: + examples: + default: + summary: Exclude new accounts and include specific accounts + value: + data: + attributes: + account_filters: + include_new_accounts: false + included_accounts: + - "123456789123" + - "123456789143" + type: account_filters_patch_request + exclude_accounts: + summary: Include new accounts and exclude specific accounts + value: + data: + attributes: + account_filters: + excluded_accounts: + - "123456789123" + - "123456789143" + include_new_accounts: true + type: account_filters_patch_request + schema: + $ref: "#/components/schemas/AccountFiltersPatchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + summary: Exclude new accounts and include specific accounts + value: + data: + attributes: + account_filters: + include_new_accounts: false + included_accounts: + - "123456789123" + - "123456789143" + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + exclude_accounts: + summary: Include new accounts and exclude specific accounts + value: + data: + attributes: + account_filters: + excluded_accounts: + - "123456789123" + - "123456789143" + include_new_accounts: true + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + schema: + $ref: "#/components/schemas/AccountFiltersResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Update account filters + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_write /api/v2/cost/anomalies: get: description: List detected Cloud Cost Management anomalies for the organization. diff --git a/examples/v2/cloud-cost-management/GetCostAccountFilters.rb b/examples/v2/cloud-cost-management/GetCostAccountFilters.rb new file mode 100644 index 000000000000..d2012a6bd62e --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCostAccountFilters.rb @@ -0,0 +1,5 @@ +# Get account filters returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new +p api_instance.get_cost_account_filters(9223372036854775807) diff --git a/examples/v2/cloud-cost-management/UpdateCostAccountFilters.rb b/examples/v2/cloud-cost-management/UpdateCostAccountFilters.rb new file mode 100644 index 000000000000..264d22be8782 --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateCostAccountFilters.rb @@ -0,0 +1,24 @@ +# Update account filters returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new + +body = DatadogAPIClient::V2::AccountFiltersPatchRequest.new({ + data: DatadogAPIClient::V2::AccountFiltersPatchData.new({ + attributes: DatadogAPIClient::V2::AccountFiltersPatchRequestAttributes.new({ + account_filters: DatadogAPIClient::V2::AccountFilteringConfig.new({ + excluded_accounts: [ + "123456789123", + "123456789143", + ], + include_new_accounts: true, + included_accounts: [ + "123456789123", + "123456789143", + ], + }), + }), + type: DatadogAPIClient::V2::AccountFiltersPatchRequestType::ACCOUNT_FILTERS_PATCH_REQUEST, + }), +}) +p api_instance.update_cost_account_filters(9223372036854775807, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a1187e6e1403..c2c3e8003705 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2661,6 +2661,13 @@ "page_size" => "Integer", "page_cursor" => "String", }, + "v2.GetCostAccountFilters" => { + "cloud_account_id" => "Integer", + }, + "v2.UpdateCostAccountFilters" => { + "cloud_account_id" => "Integer", + "body" => "AccountFiltersPatchRequest", + }, "v2.ListCostAnomalies" => { "start" => "Integer", "_end" => "Integer", diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 028864461382..a8693074a7d2 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -408,6 +408,27 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "ruleset" And the response "data.attributes.name" is equal to "EVP Cost Tags" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get account filters returns "Bad Request" response + Given new "GetCostAccountFilters" request + And request contains "cloud_account_id" 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 account filters returns "Not Found" response + Given new "GetCostAccountFilters" request + And request contains "cloud_account_id" 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 account filters returns "OK" response + Given new "GetCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: Get budget returns "Bad Request" response Given new "GetBudget" request @@ -962,6 +983,30 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.account_id" is equal to "123456_A123BC_12AB34" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Update account filters returns "Bad Request" response + Given new "UpdateCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_filters": {"excluded_accounts": ["123456789123", "123456789143"], "include_new_accounts": true, "included_accounts": ["123456789123", "123456789143"]}}, "type": "account_filters_patch_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Update account filters returns "Not Found" response + Given new "UpdateCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_filters": {"excluded_accounts": ["123456789123", "123456789143"], "include_new_accounts": true, "included_accounts": ["123456789123", "123456789143"]}}, "type": "account_filters_patch_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Update account filters returns "OK" response + Given new "UpdateCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_filters": {"excluded_accounts": ["123456789123", "123456789143"], "include_new_accounts": true, "included_accounts": ["123456789123", "123456789143"]}}, "type": "account_filters_patch_request"}} + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management Scenario: Update custom allocation rule returns "OK" response Given new "UpdateCustomAllocationRule" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 92616785543a..6551ae7167df 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1622,6 +1622,18 @@ "type": "safe" } }, + "GetCostAccountFilters": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UpdateCostAccountFilters": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "ListCostAnomalies": { "tag": "Cloud Cost Management", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index dc2199812ef5..0b07e31248db 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1166,6 +1166,14 @@ def overrides "v2.access_token_owner_type" => "AccessTokenOwnerType", "v2.access_tokens_type" => "AccessTokensType", "v2.account_filtering_config" => "AccountFilteringConfig", + "v2.account_filters" => "AccountFilters", + "v2.account_filters_attributes" => "AccountFiltersAttributes", + "v2.account_filters_patch_data" => "AccountFiltersPatchData", + "v2.account_filters_patch_request" => "AccountFiltersPatchRequest", + "v2.account_filters_patch_request_attributes" => "AccountFiltersPatchRequestAttributes", + "v2.account_filters_patch_request_type" => "AccountFiltersPatchRequestType", + "v2.account_filters_response" => "AccountFiltersResponse", + "v2.account_filters_type" => "AccountFiltersType", "v2.action_connection_attributes" => "ActionConnectionAttributes", "v2.action_connection_attributes_update" => "ActionConnectionAttributesUpdate", "v2.action_connection_data" => "ActionConnectionData", diff --git a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb index 09671f6dee33..ff1881411060 100644 --- a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb +++ b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb @@ -1895,6 +1895,71 @@ def get_commitments_utilization_timeseries_with_http_info(provider, product, sta return data, status_code, headers end + # Get account filters. + # + # @see #get_cost_account_filters_with_http_info + def get_cost_account_filters(cloud_account_id, opts = {}) + data, _status_code, _headers = get_cost_account_filters_with_http_info(cloud_account_id, opts) + data + end + + # Get account filters. + # + # Get the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + # + # @param cloud_account_id [Integer] Cloud Account id. + # @param opts [Hash] the optional parameters + # @return [Array<(AccountFiltersResponse, Integer, Hash)>] AccountFiltersResponse data, response status code and response headers + def get_cost_account_filters_with_http_info(cloud_account_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.get_cost_account_filters ...' + end + # verify the required parameter 'cloud_account_id' is set + if @api_client.config.client_side_validation && cloud_account_id.nil? + fail ArgumentError, "Missing the required parameter 'cloud_account_id' when calling CloudCostManagementAPI.get_cost_account_filters" + end + # resource path + local_var_path = '/api/v2/cost/account_filters/{cloud_account_id}'.sub('{cloud_account_id}', CGI.escape(cloud_account_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # 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] || 'AccountFiltersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_cost_account_filters, + :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_account_filters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get cost anomaly. # # @see #get_cost_anomaly_with_http_info @@ -4141,6 +4206,78 @@ def search_cost_recommendations_with_http_info(body, opts = {}) return data, status_code, headers end + # Update account filters. + # + # @see #update_cost_account_filters_with_http_info + def update_cost_account_filters(cloud_account_id, body, opts = {}) + data, _status_code, _headers = update_cost_account_filters_with_http_info(cloud_account_id, body, opts) + data + end + + # Update account filters. + # + # Update the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + # + # @param cloud_account_id [Integer] Cloud Account id. + # @param body [AccountFiltersPatchRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(AccountFiltersResponse, Integer, Hash)>] AccountFiltersResponse data, response status code and response headers + def update_cost_account_filters_with_http_info(cloud_account_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.update_cost_account_filters ...' + end + # verify the required parameter 'cloud_account_id' is set + if @api_client.config.client_side_validation && cloud_account_id.nil? + fail ArgumentError, "Missing the required parameter 'cloud_account_id' when calling CloudCostManagementAPI.update_cost_account_filters" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CloudCostManagementAPI.update_cost_account_filters" + end + # resource path + local_var_path = '/api/v2/cost/account_filters/{cloud_account_id}'.sub('{cloud_account_id}', CGI.escape(cloud_account_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AccountFiltersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_cost_account_filters, + :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::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudCostManagementAPI#update_cost_account_filters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update Cloud Cost Management AWS CUR config. # # @see #update_cost_awscur_config_with_http_info diff --git a/lib/datadog_api_client/v2/models/account_filters.rb b/lib/datadog_api_client/v2/models/account_filters.rb new file mode 100644 index 000000000000..473c5fed3fb3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters.rb @@ -0,0 +1,154 @@ +=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 account filters for a cloud account. + class AccountFilters + include BaseGenericModel + + # Attributes for the account filters of a cloud account. + attr_reader :attributes + + # The ID of the cloud account. + attr_accessor :id + + # Type of account filters. + attr_reader :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' => :'AccountFiltersAttributes', + :'id' => :'String', + :'type' => :'AccountFiltersType' + } + 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::AccountFilters` 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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/account_filters_attributes.rb b/lib/datadog_api_client/v2/models/account_filters_attributes.rb new file mode 100644 index 000000000000..7548e4aeff30 --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters_attributes.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 + # Attributes for the account filters of a cloud account. + class AccountFiltersAttributes + include BaseGenericModel + + # The account filtering configuration. + attr_accessor :account_filters + + # The cloud account ID. + attr_accessor :account_id + + # The cloud provider of the account, for example `aws`, `aws_cur2`, or `oci`. + attr_accessor :cloud + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_filters' => :'account_filters', + :'account_id' => :'account_id', + :'cloud' => :'cloud' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_filters' => :'AccountFilteringConfig', + :'account_id' => :'String', + :'cloud' => :'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::AccountFiltersAttributes` 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?(:'account_filters') + self.account_filters = attributes[:'account_filters'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'cloud') + self.cloud = attributes[:'cloud'] + 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 && + account_filters == o.account_filters && + account_id == o.account_id && + cloud == o.cloud && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_filters, account_id, cloud, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/account_filters_patch_data.rb b/lib/datadog_api_client/v2/models/account_filters_patch_data.rb new file mode 100644 index 000000000000..85942e9a3500 --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters_patch_data.rb @@ -0,0 +1,144 @@ +=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 + # Account filters patch data. + class AccountFiltersPatchData + include BaseGenericModel + + # Attributes for an account filters patch request. + attr_reader :attributes + + # Type of account filters patch request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AccountFiltersPatchRequestAttributes', + :'type' => :'AccountFiltersPatchRequestType' + } + 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::AccountFiltersPatchData` 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?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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 && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/account_filters_patch_request.rb b/lib/datadog_api_client/v2/models/account_filters_patch_request.rb new file mode 100644 index 000000000000..125a3f138771 --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters_patch_request.rb @@ -0,0 +1,123 @@ +=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 + # Account filters patch request. + class AccountFiltersPatchRequest + include BaseGenericModel + + # Account filters patch data. + attr_reader :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' => :'AccountFiltersPatchData' + } + 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::AccountFiltersPatchRequest` 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') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + 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, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/account_filters_patch_request_attributes.rb b/lib/datadog_api_client/v2/models/account_filters_patch_request_attributes.rb new file mode 100644 index 000000000000..99ee40c9915a --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters_patch_request_attributes.rb @@ -0,0 +1,123 @@ +=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 + # Attributes for an account filters patch request. + class AccountFiltersPatchRequestAttributes + include BaseGenericModel + + # The account filtering configuration. + attr_reader :account_filters + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_filters' => :'account_filters' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_filters' => :'AccountFilteringConfig' + } + 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::AccountFiltersPatchRequestAttributes` 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?(:'account_filters') + self.account_filters = attributes[:'account_filters'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @account_filters.nil? + true + end + + # Custom attribute writer method with validation + # @param account_filters [Object] Object to be assigned + # @!visibility private + def account_filters=(account_filters) + if account_filters.nil? + fail ArgumentError, 'invalid value for "account_filters", account_filters cannot be nil.' + end + @account_filters = account_filters + 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 && + account_filters == o.account_filters && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_filters, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/account_filters_patch_request_type.rb b/lib/datadog_api_client/v2/models/account_filters_patch_request_type.rb new file mode 100644 index 000000000000..2bd10f04308c --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters_patch_request_type.rb @@ -0,0 +1,26 @@ +=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 + # Type of account filters patch request. + class AccountFiltersPatchRequestType + include BaseEnumModel + + ACCOUNT_FILTERS_PATCH_REQUEST = "account_filters_patch_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/account_filters_response.rb b/lib/datadog_api_client/v2/models/account_filters_response.rb new file mode 100644 index 000000000000..df7ccd2a5191 --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters_response.rb @@ -0,0 +1,105 @@ +=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 + # Response containing the account filters for a cloud account. + class AccountFiltersResponse + include BaseGenericModel + + # The account filters for a cloud account. + 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' => :'AccountFilters' + } + 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::AccountFiltersResponse` 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') + self.data = attributes[:'data'] + 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, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/account_filters_type.rb b/lib/datadog_api_client/v2/models/account_filters_type.rb new file mode 100644 index 000000000000..81f7148f884c --- /dev/null +++ b/lib/datadog_api_client/v2/models/account_filters_type.rb @@ -0,0 +1,26 @@ +=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 + # Type of account filters. + class AccountFiltersType + include BaseEnumModel + + ACCOUNT_FILTERS = "account_filters".freeze + end +end