diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index bf4011c1550d..dab9cb7af53e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -73349,6 +73349,86 @@ components: - MINUS_ID - NAME - MINUS_NAME + OrgGroupPolicySuggestionAttributes: + description: Attributes of an org group policy suggestion. + properties: + consensus_ratio: + description: The ratio of member orgs whose configuration agrees on the recommended value. + example: 0.75 + format: double + maximum: 1 + minimum: 0 + type: number + policy_name: + description: The name of the suggested policy. + example: "monitor_timezone" + type: string + recommended_value: + description: The recommended value for the policy, based on member org consensus. + example: "UTC" + status: + $ref: "#/components/schemas/OrgGroupPolicySuggestionStatus" + required: + - policy_name + - status + - consensus_ratio + - recommended_value + type: object + OrgGroupPolicySuggestionData: + description: An org group policy suggestion resource. + properties: + attributes: + $ref: "#/components/schemas/OrgGroupPolicySuggestionAttributes" + id: + description: The ID of the org group policy suggestion. + example: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + type: string + relationships: + $ref: "#/components/schemas/OrgGroupPolicySuggestionRelationships" + type: + $ref: "#/components/schemas/OrgGroupPolicySuggestionType" + required: + - id + - type + - attributes + type: object + OrgGroupPolicySuggestionListResponse: + description: Response containing a list of org group policy suggestions. + properties: + data: + description: An array of org group policy suggestions. + items: + $ref: "#/components/schemas/OrgGroupPolicySuggestionData" + type: array + required: + - data + type: object + OrgGroupPolicySuggestionRelationships: + description: Relationships of an org group policy suggestion. + properties: + org_group: + $ref: "#/components/schemas/OrgGroupRelationshipToOne" + type: object + OrgGroupPolicySuggestionStatus: + description: The status of the policy suggestion. + enum: + - pending + - accepted + - dismissed + example: pending + type: string + x-enum-varnames: + - PENDING + - ACCEPTED + - DISMISSED + OrgGroupPolicySuggestionType: + description: Org group policy suggestions resource type. + enum: + - org_group_policy_suggestions + example: org_group_policy_suggestions + type: string + x-enum-varnames: + - ORG_GROUP_POLICY_SUGGESTIONS OrgGroupPolicyType: description: Org group policies resource type. enum: @@ -164682,6 +164762,64 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/org_group_policy_suggestions: + get: + description: List suggested organization group policies. Requires a filter on org group ID. + operationId: ListOrgGroupPolicySuggestions + parameters: + - $ref: "#/components/parameters/OrgGroupPolicyFilterOrgGroupId" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + consensus_ratio: 0.75 + policy_name: "monitor_timezone" + recommended_value: "UTC" + status: "pending" + id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + relationships: + org_group: + data: + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + type: org_groups + type: org_group_policy_suggestions + schema: + $ref: "#/components/schemas/OrgGroupPolicySuggestionListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List org group policy suggestions + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/org_groups: get: description: List all organization groups that the requesting organization has access to. diff --git a/examples/v2/org-groups/ListOrgGroupPolicySuggestions.rb b/examples/v2/org-groups/ListOrgGroupPolicySuggestions.rb new file mode 100644 index 000000000000..a749986bb635 --- /dev/null +++ b/examples/v2/org-groups/ListOrgGroupPolicySuggestions.rb @@ -0,0 +1,8 @@ +# List org group policy suggestions returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_org_group_policy_suggestions".to_sym] = true +end +api_instance = DatadogAPIClient::V2::OrgGroupsAPI.new +p api_instance.list_org_group_policy_suggestions("a1b2c3d4-e5f6-7890-abcd-ef0123456789") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a1187e6e1403..ca04165d22e6 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4699,6 +4699,9 @@ "org_group_policy_override_id" => "UUID", "body" => "OrgGroupPolicyOverrideUpdateRequest", }, + "v2.ListOrgGroupPolicySuggestions" => { + "filter_org_group_id" => "UUID", + }, "v2.ListOrgGroups" => { "page_number" => "Integer", "page_size" => "Integer", diff --git a/features/v2/org_groups.feature b/features/v2/org_groups.feature index 58065ea87fc7..46cd5e7d3e69 100644 --- a/features/v2/org_groups.feature +++ b/features/v2/org_groups.feature @@ -325,6 +325,22 @@ Feature: Org Groups When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/org-management + Scenario: List org group policy suggestions returns "Bad Request" response + Given operation "ListOrgGroupPolicySuggestions" enabled + And new "ListOrgGroupPolicySuggestions" request + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/org-management + Scenario: List org group policy suggestions returns "OK" response + Given operation "ListOrgGroupPolicySuggestions" enabled + And new "ListOrgGroupPolicySuggestions" request + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/org-management Scenario: List org groups returns "Bad Request" response Given operation "ListOrgGroups" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 92616785543a..bf204e203a69 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5959,6 +5959,12 @@ "type": "idempotent" } }, + "ListOrgGroupPolicySuggestions": { + "tag": "Org Groups", + "undo": { + "type": "safe" + } + }, "ListOrgGroups": { "tag": "Org Groups", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 46c87214cd62..5871db98c921 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -642,6 +642,7 @@ def initialize "v2.list_org_group_policies": false, "v2.list_org_group_policy_configs": false, "v2.list_org_group_policy_overrides": false, + "v2.list_org_group_policy_suggestions": false, "v2.list_org_groups": false, "v2.update_org_group": false, "v2.update_org_group_membership": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index dc2199812ef5..8e3cd2acaf23 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5527,6 +5527,12 @@ def overrides "v2.org_group_policy_relationship_to_one_data" => "OrgGroupPolicyRelationshipToOneData", "v2.org_group_policy_response" => "OrgGroupPolicyResponse", "v2.org_group_policy_sort_option" => "OrgGroupPolicySortOption", + "v2.org_group_policy_suggestion_attributes" => "OrgGroupPolicySuggestionAttributes", + "v2.org_group_policy_suggestion_data" => "OrgGroupPolicySuggestionData", + "v2.org_group_policy_suggestion_list_response" => "OrgGroupPolicySuggestionListResponse", + "v2.org_group_policy_suggestion_relationships" => "OrgGroupPolicySuggestionRelationships", + "v2.org_group_policy_suggestion_status" => "OrgGroupPolicySuggestionStatus", + "v2.org_group_policy_suggestion_type" => "OrgGroupPolicySuggestionType", "v2.org_group_policy_type" => "OrgGroupPolicyType", "v2.org_group_policy_update_attributes" => "OrgGroupPolicyUpdateAttributes", "v2.org_group_policy_update_data" => "OrgGroupPolicyUpdateData", diff --git a/lib/datadog_api_client/v2/api/org_groups_api.rb b/lib/datadog_api_client/v2/api/org_groups_api.rb index 9e2eb61ee9fa..713d7447f535 100644 --- a/lib/datadog_api_client/v2/api/org_groups_api.rb +++ b/lib/datadog_api_client/v2/api/org_groups_api.rb @@ -1153,6 +1153,78 @@ def list_org_group_policy_overrides_with_http_info(filter_org_group_id, opts = { return data, status_code, headers end + # List org group policy suggestions. + # + # @see #list_org_group_policy_suggestions_with_http_info + def list_org_group_policy_suggestions(filter_org_group_id, opts = {}) + data, _status_code, _headers = list_org_group_policy_suggestions_with_http_info(filter_org_group_id, opts) + data + end + + # List org group policy suggestions. + # + # List suggested organization group policies. Requires a filter on org group ID. + # + # @param filter_org_group_id [UUID] Filter policies by org group ID. + # @param opts [Hash] the optional parameters + # @return [Array<(OrgGroupPolicySuggestionListResponse, Integer, Hash)>] OrgGroupPolicySuggestionListResponse data, response status code and response headers + def list_org_group_policy_suggestions_with_http_info(filter_org_group_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_org_group_policy_suggestions".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_org_group_policy_suggestions") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_org_group_policy_suggestions")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrgGroupsAPI.list_org_group_policy_suggestions ...' + end + # verify the required parameter 'filter_org_group_id' is set + if @api_client.config.client_side_validation && filter_org_group_id.nil? + fail ArgumentError, "Missing the required parameter 'filter_org_group_id' when calling OrgGroupsAPI.list_org_group_policy_suggestions" + end + # resource path + local_var_path = '/api/v2/org_group_policy_suggestions' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[org_group_id]'] = filter_org_group_id + + # 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] || 'OrgGroupPolicySuggestionListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_org_group_policy_suggestions, + :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: OrgGroupsAPI#list_org_group_policy_suggestions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List org groups. # # @see #list_org_groups_with_http_info diff --git a/lib/datadog_api_client/v2/models/org_group_policy_suggestion_attributes.rb b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_attributes.rb new file mode 100644 index 000000000000..2b579d1ab9d6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_attributes.rb @@ -0,0 +1,194 @@ +=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 of an org group policy suggestion. + class OrgGroupPolicySuggestionAttributes + include BaseGenericModel + + # The ratio of member orgs whose configuration agrees on the recommended value. + attr_reader :consensus_ratio + + # The name of the suggested policy. + attr_reader :policy_name + + # The recommended value for the policy, based on member org consensus. + attr_reader :recommended_value + + # The status of the policy suggestion. + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'consensus_ratio' => :'consensus_ratio', + :'policy_name' => :'policy_name', + :'recommended_value' => :'recommended_value', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'consensus_ratio' => :'Float', + :'policy_name' => :'String', + :'recommended_value' => :'Object', + :'status' => :'OrgGroupPolicySuggestionStatus' + } + 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::OrgGroupPolicySuggestionAttributes` 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?(:'consensus_ratio') + self.consensus_ratio = attributes[:'consensus_ratio'] + end + + if attributes.key?(:'policy_name') + self.policy_name = attributes[:'policy_name'] + end + + if attributes.key?(:'recommended_value') + self.recommended_value = attributes[:'recommended_value'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + 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 @consensus_ratio.nil? + return false if @consensus_ratio > 1 + return false if @consensus_ratio < 0 + return false if @policy_name.nil? + return false if @recommended_value.nil? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param consensus_ratio [Object] Object to be assigned + # @!visibility private + def consensus_ratio=(consensus_ratio) + if consensus_ratio.nil? + fail ArgumentError, 'invalid value for "consensus_ratio", consensus_ratio cannot be nil.' + end + if consensus_ratio > 1 + fail ArgumentError, 'invalid value for "consensus_ratio", must be smaller than or equal to 1.' + end + if consensus_ratio < 0 + fail ArgumentError, 'invalid value for "consensus_ratio", must be greater than or equal to 0.' + end + @consensus_ratio = consensus_ratio + end + + # Custom attribute writer method with validation + # @param policy_name [Object] Object to be assigned + # @!visibility private + def policy_name=(policy_name) + if policy_name.nil? + fail ArgumentError, 'invalid value for "policy_name", policy_name cannot be nil.' + end + @policy_name = policy_name + end + + # Custom attribute writer method with validation + # @param recommended_value [Object] Object to be assigned + # @!visibility private + def recommended_value=(recommended_value) + if recommended_value.nil? + fail ArgumentError, 'invalid value for "recommended_value", recommended_value cannot be nil.' + end + @recommended_value = recommended_value + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + 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 && + consensus_ratio == o.consensus_ratio && + policy_name == o.policy_name && + recommended_value == o.recommended_value && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [consensus_ratio, policy_name, recommended_value, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/org_group_policy_suggestion_data.rb b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_data.rb new file mode 100644 index 000000000000..e5f64ff9cf10 --- /dev/null +++ b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_data.rb @@ -0,0 +1,175 @@ +=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 org group policy suggestion resource. + class OrgGroupPolicySuggestionData + include BaseGenericModel + + # Attributes of an org group policy suggestion. + attr_reader :attributes + + # The ID of the org group policy suggestion. + attr_reader :id + + # Relationships of an org group policy suggestion. + attr_accessor :relationships + + # Org group policy suggestions resource 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', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OrgGroupPolicySuggestionAttributes', + :'id' => :'String', + :'relationships' => :'OrgGroupPolicySuggestionRelationships', + :'type' => :'OrgGroupPolicySuggestionType' + } + 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::OrgGroupPolicySuggestionData` 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?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @id.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 id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + 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 && + relationships == o.relationships && + 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, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/org_group_policy_suggestion_list_response.rb b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_list_response.rb new file mode 100644 index 000000000000..1869246b82f9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_list_response.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 + # Response containing a list of org group policy suggestions. + class OrgGroupPolicySuggestionListResponse + include BaseGenericModel + + # An array of org group policy suggestions. + 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' => :'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::OrgGroupPolicySuggestionListResponse` 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 + + # 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/org_group_policy_suggestion_relationships.rb b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_relationships.rb new file mode 100644 index 000000000000..b875b9cc3f63 --- /dev/null +++ b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_relationships.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 + # Relationships of an org group policy suggestion. + class OrgGroupPolicySuggestionRelationships + include BaseGenericModel + + # Relationship to a single org group. + attr_accessor :org_group + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'org_group' => :'org_group' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'org_group' => :'OrgGroupRelationshipToOne' + } + 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::OrgGroupPolicySuggestionRelationships` 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?(:'org_group') + self.org_group = attributes[:'org_group'] + 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 && + org_group == o.org_group && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [org_group, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/org_group_policy_suggestion_status.rb b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_status.rb new file mode 100644 index 000000000000..22fb1de84917 --- /dev/null +++ b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_status.rb @@ -0,0 +1,28 @@ +=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 status of the policy suggestion. + class OrgGroupPolicySuggestionStatus + include BaseEnumModel + + PENDING = "pending".freeze + ACCEPTED = "accepted".freeze + DISMISSED = "dismissed".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/org_group_policy_suggestion_type.rb b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_type.rb new file mode 100644 index 000000000000..3dd1d3417501 --- /dev/null +++ b/lib/datadog_api_client/v2/models/org_group_policy_suggestion_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 + # Org group policy suggestions resource type. + class OrgGroupPolicySuggestionType + include BaseEnumModel + + ORG_GROUP_POLICY_SUGGESTIONS = "org_group_policy_suggestions".freeze + end +end