diff --git a/.apigentools-info b/.apigentools-info index b218587fce12..9aa4d69452bb 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-29 20:46:33.498190", - "spec_repo_commit": "c0b9551e" + "regenerated": "2024-10-30 18:58:10.241853", + "spec_repo_commit": "755120dd" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-29 20:46:33.516450", - "spec_repo_commit": "c0b9551e" + "regenerated": "2024-10-30 18:58:10.260831", + "spec_repo_commit": "755120dd" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ab32a8143067..38238fba6cc1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7115,6 +7115,81 @@ components: description: The type of the resource. The value should always be device. type: string type: object + DomainAllowlist: + description: The email domain allowlist for an org. + properties: + attributes: + $ref: '#/components/schemas/DomainAllowlistAttributes' + id: + description: The unique identifier of the org. + nullable: true + type: string + type: + $ref: '#/components/schemas/DomainAllowlistType' + required: + - type + type: object + DomainAllowlistAttributes: + description: The details of the email domain allowlist. + properties: + domains: + description: The list of domains in the email domain allowlist. + items: + type: string + type: array + enabled: + description: Whether the email domain allowlist is enabled for the org. + type: boolean + type: object + DomainAllowlistRequest: + description: Request containing the desired email domain allowlist configuration. + properties: + data: + $ref: '#/components/schemas/DomainAllowlist' + required: + - data + type: object + DomainAllowlistResponse: + description: Response containing information about the email domain allowlist. + properties: + data: + $ref: '#/components/schemas/DomainAllowlistResponseData' + type: object + DomainAllowlistResponseData: + description: The email domain allowlist response for an org. + properties: + attributes: + $ref: '#/components/schemas/DomainAllowlistResponseDataAttributes' + id: + description: The unique identifier of the org. + nullable: true + type: string + type: + $ref: '#/components/schemas/DomainAllowlistType' + required: + - type + type: object + DomainAllowlistResponseDataAttributes: + description: The details of the email domain allowlist. + properties: + domains: + description: The list of domains in the email domain allowlist. + items: + type: string + type: array + enabled: + description: Whether the email domain allowlist is enabled for the org. + type: boolean + type: object + DomainAllowlistType: + default: domain_allowlist + description: Email domain allowlist allowlist type. + enum: + - domain_allowlist + example: domain_allowlist + type: string + x-enum-varnames: + - DOMAIN_ALLOWLIST DowntimeCreateRequest: description: Request for creating a downtime. properties: @@ -29433,6 +29508,61 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v2/domain_allowlist: + get: + description: Get the domain allowlist for an organization. + operationId: GetDomainAllowlist + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DomainAllowlistResponse' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Get Domain Allowlist + tags: + - Domain Allowlist + x-permission: + operator: OR + permissions: + - org_management + patch: + description: Update the domain allowlist for an organization. + operationId: PatchDomainAllowlist + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DomainAllowlistRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DomainAllowlistResponse' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Sets Domain Allowlist + tags: + - Domain Allowlist + x-permission: + operator: OR + permissions: + - org_management /api/v2/dora/deployment: post: description: 'Use this API endpoint to provide data about deployments for DORA @@ -41786,6 +41916,14 @@ tags: organization.' name: Dashboard Lists +- description: 'Configure your Datadog Email Domain Allowlist directly through the + Datadog API. + + The Email Domain Allowlist controls the domains that certain datadog emails can + be sent to. + + For more information, see the [Domain Allowlist docs page](https://docs.datadoghq.com/account_management/org_settings/domain_allowlist)' + name: Domain Allowlist - description: '**Note**: Downtime V2 is currently in private beta. To request access, contact [Datadog support](https://docs.datadoghq.com/help/). diff --git a/cassettes/features/v2/domain_allowlist/Get-Domain-Allowlist-returns-OK-response.frozen b/cassettes/features/v2/domain_allowlist/Get-Domain-Allowlist-returns-OK-response.frozen new file mode 100644 index 000000000000..2090a82fa0f1 --- /dev/null +++ b/cassettes/features/v2/domain_allowlist/Get-Domain-Allowlist-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-23T18:16:16.668Z \ No newline at end of file diff --git a/cassettes/features/v2/domain_allowlist/Get-Domain-Allowlist-returns-OK-response.yml b/cassettes/features/v2/domain_allowlist/Get-Domain-Allowlist-returns-OK-response.yml new file mode 100644 index 000000000000..66708da4fee9 --- /dev/null +++ b/cassettes/features/v2/domain_allowlist/Get-Domain-Allowlist-returns-OK-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Wed, 23 Oct 2024 18:16:16 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/domain_allowlist + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"domain_allowlist","attributes":{"enabled":false,"domains":["@static-test-domain.test"]}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/domain_allowlist/Sets-Domain-Allowlist-returns-OK-response.frozen b/cassettes/features/v2/domain_allowlist/Sets-Domain-Allowlist-returns-OK-response.frozen new file mode 100644 index 000000000000..6315d630bc7e --- /dev/null +++ b/cassettes/features/v2/domain_allowlist/Sets-Domain-Allowlist-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-23T18:16:16.928Z \ No newline at end of file diff --git a/cassettes/features/v2/domain_allowlist/Sets-Domain-Allowlist-returns-OK-response.yml b/cassettes/features/v2/domain_allowlist/Sets-Domain-Allowlist-returns-OK-response.yml new file mode 100644 index 000000000000..f6ab3af35321 --- /dev/null +++ b/cassettes/features/v2/domain_allowlist/Sets-Domain-Allowlist-returns-OK-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Wed, 23 Oct 2024 18:16:16 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"domains":["@static-test-domain.test"],"enabled":false},"type":"domain_allowlist"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/domain_allowlist + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"domain_allowlist","attributes":{"enabled":false,"domains":["@static-test-domain.test"]}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/domain-allowlist/GetDomainAllowlist.rb b/examples/v2/domain-allowlist/GetDomainAllowlist.rb new file mode 100644 index 000000000000..bb3efddf9f20 --- /dev/null +++ b/examples/v2/domain-allowlist/GetDomainAllowlist.rb @@ -0,0 +1,5 @@ +# Get Domain Allowlist returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DomainAllowlistAPI.new +p api_instance.get_domain_allowlist() diff --git a/examples/v2/domain-allowlist/PatchDomainAllowlist.rb b/examples/v2/domain-allowlist/PatchDomainAllowlist.rb new file mode 100644 index 000000000000..088d5c2a06d1 --- /dev/null +++ b/examples/v2/domain-allowlist/PatchDomainAllowlist.rb @@ -0,0 +1,17 @@ +# Sets Domain Allowlist returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DomainAllowlistAPI.new + +body = DatadogAPIClient::V2::DomainAllowlistRequest.new({ + data: DatadogAPIClient::V2::DomainAllowlist.new({ + attributes: DatadogAPIClient::V2::DomainAllowlistAttributes.new({ + domains: [ + "@static-test-domain.test", + ], + enabled: false, + }), + type: DatadogAPIClient::V2::DomainAllowlistType::DOMAIN_ALLOWLIST, + }), +}) +p api_instance.patch_domain_allowlist(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index f34eaa2581aa..53c581b2a648 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1185,6 +1185,9 @@ "dashboard_list_id" => "Integer", "body" => "DashboardListUpdateItemsRequest", }, + "v2.PatchDomainAllowlist" => { + "body" => "DomainAllowlistRequest", + }, "v2.CreateDORADeployment" => { "body" => "DORADeploymentRequest", }, diff --git a/features/v2/domain_allowlist.feature b/features/v2/domain_allowlist.feature new file mode 100644 index 000000000000..8fe10371d5c1 --- /dev/null +++ b/features/v2/domain_allowlist.feature @@ -0,0 +1,32 @@ +@endpoint(domain-allowlist) @endpoint(domain-allowlist-v2) +Feature: Domain Allowlist + Configure your Datadog Email Domain Allowlist directly through the Datadog + API. The Email Domain Allowlist controls the domains that certain datadog + emails can be sent to. For more information, see the [Domain Allowlist + docs page](https://docs.datadoghq.com/account_management/org_settings/doma + in_allowlist) + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "DomainAllowlist" API + + @team:Datadog/team-aaa-dogmail + Scenario: Get Domain Allowlist returns "OK" response + Given new "GetDomainAllowlist" request + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "domain_allowlist" + And the response "data.attributes.domains" array contains value "@static-test-domain.test" + And the response "data.attributes.enabled" is equal to false + + @team:Datadog/team-aaa-dogmail + Scenario: Sets Domain Allowlist returns "OK" response + Given new "PatchDomainAllowlist" request + And body with value {"data": {"attributes": {"domains": ["@static-test-domain.test"], "enabled": false}, "type": "domain_allowlist"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "domain_allowlist" + And the response "data.attributes.domains" has length 1 + And the response "data.attributes.domains" array contains value "@static-test-domain.test" + And the response "data.attributes.enabled" is equal to false diff --git a/features/v2/undo.json b/features/v2/undo.json index 68b64dfc24d0..5516102f8ffd 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -547,6 +547,18 @@ "type": "safe" } }, + "GetDomainAllowlist": { + "tag": "Domain Allowlist", + "undo": { + "type": "safe" + } + }, + "PatchDomainAllowlist": { + "tag": "Domain Allowlist", + "undo": { + "type": "idempotent" + } + }, "CreateDORADeployment": { "tag": "DORA Metrics", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index c763ec7b65de..624b9ea59c10 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1283,6 +1283,13 @@ def overrides "v2.device_attributes" => "DeviceAttributes", "v2.device_attributes_interface_statuses" => "DeviceAttributesInterfaceStatuses", "v2.devices_list_data" => "DevicesListData", + "v2.domain_allowlist" => "DomainAllowlist", + "v2.domain_allowlist_attributes" => "DomainAllowlistAttributes", + "v2.domain_allowlist_request" => "DomainAllowlistRequest", + "v2.domain_allowlist_response" => "DomainAllowlistResponse", + "v2.domain_allowlist_response_data" => "DomainAllowlistResponseData", + "v2.domain_allowlist_response_data_attributes" => "DomainAllowlistResponseDataAttributes", + "v2.domain_allowlist_type" => "DomainAllowlistType", "v2.dora_deployment_request" => "DORADeploymentRequest", "v2.dora_deployment_request_attributes" => "DORADeploymentRequestAttributes", "v2.dora_deployment_request_data" => "DORADeploymentRequestData", @@ -2580,6 +2587,7 @@ def overrides "v2.containers_api" => "ContainersAPI", "v2.csm_threats_api" => "CSMThreatsAPI", "v2.dashboard_lists_api" => "DashboardListsAPI", + "v2.domain_allowlist_api" => "DomainAllowlistAPI", "v2.dora_metrics_api" => "DORAMetricsAPI", "v2.downtimes_api" => "DowntimesAPI", "v2.events_api" => "EventsAPI", diff --git a/lib/datadog_api_client/v2/api/domain_allowlist_api.rb b/lib/datadog_api_client/v2/api/domain_allowlist_api.rb new file mode 100644 index 000000000000..72e986ed6f2a --- /dev/null +++ b/lib/datadog_api_client/v2/api/domain_allowlist_api.rb @@ -0,0 +1,153 @@ +=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 'cgi' + +module DatadogAPIClient::V2 + class DomainAllowlistAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Get Domain Allowlist. + # + # @see #get_domain_allowlist_with_http_info + def get_domain_allowlist(opts = {}) + data, _status_code, _headers = get_domain_allowlist_with_http_info(opts) + data + end + + # Get Domain Allowlist. + # + # Get the domain allowlist for an organization. + # + # @param opts [Hash] the optional parameters + # @return [Array<(DomainAllowlistResponse, Integer, Hash)>] DomainAllowlistResponse data, response status code and response headers + def get_domain_allowlist_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DomainAllowlistAPI.get_domain_allowlist ...' + end + # resource path + local_var_path = '/api/v2/domain_allowlist' + + # 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] || 'DomainAllowlistResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_domain_allowlist, + :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: DomainAllowlistAPI#get_domain_allowlist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Sets Domain Allowlist. + # + # @see #patch_domain_allowlist_with_http_info + def patch_domain_allowlist(body, opts = {}) + data, _status_code, _headers = patch_domain_allowlist_with_http_info(body, opts) + data + end + + # Sets Domain Allowlist. + # + # Update the domain allowlist for an organization. + # + # @param body [DomainAllowlistRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(DomainAllowlistResponse, Integer, Hash)>] DomainAllowlistResponse data, response status code and response headers + def patch_domain_allowlist_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DomainAllowlistAPI.patch_domain_allowlist ...' + 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 DomainAllowlistAPI.patch_domain_allowlist" + end + # resource path + local_var_path = '/api/v2/domain_allowlist' + + # 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] || 'DomainAllowlistResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :patch_domain_allowlist, + :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: DomainAllowlistAPI#patch_domain_allowlist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/domain_allowlist.rb b/lib/datadog_api_client/v2/models/domain_allowlist.rb new file mode 100644 index 000000000000..fcc4685796dd --- /dev/null +++ b/lib/datadog_api_client/v2/models/domain_allowlist.rb @@ -0,0 +1,151 @@ +=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 email domain allowlist for an org. + class DomainAllowlist + include BaseGenericModel + + # The details of the email domain allowlist. + attr_accessor :attributes + + # The unique identifier of the org. + attr_accessor :id + + # Email domain allowlist allowlist type. + 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' => :'DomainAllowlistAttributes', + :'id' => :'String', + :'type' => :'DomainAllowlistType' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'id', + ]) + 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::DomainAllowlist` 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 @type.nil? + true + 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].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/domain_allowlist_attributes.rb b/lib/datadog_api_client/v2/models/domain_allowlist_attributes.rb new file mode 100644 index 000000000000..d4632426e77e --- /dev/null +++ b/lib/datadog_api_client/v2/models/domain_allowlist_attributes.rb @@ -0,0 +1,117 @@ +=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 details of the email domain allowlist. + class DomainAllowlistAttributes + include BaseGenericModel + + # The list of domains in the email domain allowlist. + attr_accessor :domains + + # Whether the email domain allowlist is enabled for the org. + attr_accessor :enabled + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'domains' => :'domains', + :'enabled' => :'enabled' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'domains' => :'Array', + :'enabled' => :'Boolean' + } + 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::DomainAllowlistAttributes` 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?(:'domains') + if (value = attributes[:'domains']).is_a?(Array) + self.domains = value + end + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + 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 && + domains == o.domains && + enabled == o.enabled + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [domains, enabled].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/domain_allowlist_request.rb b/lib/datadog_api_client/v2/models/domain_allowlist_request.rb new file mode 100644 index 000000000000..06daaec7c49a --- /dev/null +++ b/lib/datadog_api_client/v2/models/domain_allowlist_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 + # Request containing the desired email domain allowlist configuration. + class DomainAllowlistRequest + include BaseGenericModel + + # The email domain allowlist for an org. + 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' => :'DomainAllowlist' + } + 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::DomainAllowlistRequest` 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].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/domain_allowlist_response.rb b/lib/datadog_api_client/v2/models/domain_allowlist_response.rb new file mode 100644 index 000000000000..a7a2f10fb09e --- /dev/null +++ b/lib/datadog_api_client/v2/models/domain_allowlist_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 information about the email domain allowlist. + class DomainAllowlistResponse + include BaseGenericModel + + # The email domain allowlist response for an org. + 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' => :'DomainAllowlistResponseData' + } + 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::DomainAllowlistResponse` 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].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/domain_allowlist_response_data.rb b/lib/datadog_api_client/v2/models/domain_allowlist_response_data.rb new file mode 100644 index 000000000000..1dca714336b4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/domain_allowlist_response_data.rb @@ -0,0 +1,151 @@ +=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 email domain allowlist response for an org. + class DomainAllowlistResponseData + include BaseGenericModel + + # The details of the email domain allowlist. + attr_accessor :attributes + + # The unique identifier of the org. + attr_accessor :id + + # Email domain allowlist allowlist type. + 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' => :'DomainAllowlistResponseDataAttributes', + :'id' => :'String', + :'type' => :'DomainAllowlistType' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'id', + ]) + 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::DomainAllowlistResponseData` 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 @type.nil? + true + 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].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/domain_allowlist_response_data_attributes.rb b/lib/datadog_api_client/v2/models/domain_allowlist_response_data_attributes.rb new file mode 100644 index 000000000000..6f8940ec4a5b --- /dev/null +++ b/lib/datadog_api_client/v2/models/domain_allowlist_response_data_attributes.rb @@ -0,0 +1,117 @@ +=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 details of the email domain allowlist. + class DomainAllowlistResponseDataAttributes + include BaseGenericModel + + # The list of domains in the email domain allowlist. + attr_accessor :domains + + # Whether the email domain allowlist is enabled for the org. + attr_accessor :enabled + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'domains' => :'domains', + :'enabled' => :'enabled' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'domains' => :'Array', + :'enabled' => :'Boolean' + } + 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::DomainAllowlistResponseDataAttributes` 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?(:'domains') + if (value = attributes[:'domains']).is_a?(Array) + self.domains = value + end + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + 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 && + domains == o.domains && + enabled == o.enabled + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [domains, enabled].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/domain_allowlist_type.rb b/lib/datadog_api_client/v2/models/domain_allowlist_type.rb new file mode 100644 index 000000000000..5f5dc6b58166 --- /dev/null +++ b/lib/datadog_api_client/v2/models/domain_allowlist_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 + # Email domain allowlist allowlist type. + class DomainAllowlistType + include BaseEnumModel + + DOMAIN_ALLOWLIST = "domain_allowlist".freeze + end +end