From f627562c267d709c0244e00ecb334e93b444c737 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 8 Apr 2024 20:24:26 +0000 Subject: [PATCH] Regenerate client from commit 037e376a of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 107 ++++++++- .../v2/authn-mappings/CreateAuthNMapping.rb | 2 +- .../v2/authn-mappings/UpdateAuthNMapping.rb | 2 +- lib/datadog_api_client/inflector.rb | 6 + .../v2/models/authn_mapping_create_data.rb | 2 +- .../authn_mapping_create_relationships.rb | 91 +++----- .../v2/models/authn_mapping_included.rb | 3 +- .../authn_mapping_relationship_to_role.rb | 98 ++++++++ .../authn_mapping_relationship_to_team.rb | 98 ++++++++ .../v2/models/authn_mapping_relationships.rb | 18 +- .../v2/models/authn_mapping_team.rb | 100 +++++++++ .../models/authn_mapping_team_attributes.rb | 212 ++++++++++++++++++ .../v2/models/authn_mapping_update_data.rb | 2 +- .../authn_mapping_update_relationships.rb | 91 +++----- .../v2/models/relationship_to_team.rb | 80 +++++++ .../v2/models/relationship_to_team_data.rb | 90 ++++++++ 17 files changed, 879 insertions(+), 131 deletions(-) create mode 100644 lib/datadog_api_client/v2/models/authn_mapping_relationship_to_role.rb create mode 100644 lib/datadog_api_client/v2/models/authn_mapping_relationship_to_team.rb create mode 100644 lib/datadog_api_client/v2/models/authn_mapping_team.rb create mode 100644 lib/datadog_api_client/v2/models/authn_mapping_team_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/relationship_to_team.rb create mode 100644 lib/datadog_api_client/v2/models/relationship_to_team_data.rb diff --git a/.apigentools-info b/.apigentools-info index 34598f08b4b7..73c70ec52014 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-05 19:46:29.847547", - "spec_repo_commit": "cdcf2ed6" + "regenerated": "2024-04-08 20:24:03.678592", + "spec_repo_commit": "037e376a" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-05 19:46:29.865037", - "spec_repo_commit": "cdcf2ed6" + "regenerated": "2024-04-08 20:24:03.695666", + "spec_repo_commit": "037e376a" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 79b987937e5b..3ec2a7d6b93a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1325,11 +1325,10 @@ components: - type type: object AuthNMappingCreateRelationships: - description: Relationship of AuthN Mapping create object to Role. - properties: - role: - $ref: '#/components/schemas/RelationshipToRole' - type: object + description: Relationship of AuthN Mapping create object to a Role or Team. + oneOf: + - $ref: '#/components/schemas/AuthNMappingRelationshipToRole' + - $ref: '#/components/schemas/AuthNMappingRelationshipToTeam' AuthNMappingCreateRequest: description: Request for creating an AuthN Mapping. properties: @@ -1343,6 +1342,23 @@ components: oneOf: - $ref: '#/components/schemas/SAMLAssertionAttribute' - $ref: '#/components/schemas/Role' + - $ref: '#/components/schemas/AuthNMappingTeam' + AuthNMappingRelationshipToRole: + description: Relationship of AuthN Mapping to a Role. + properties: + role: + $ref: '#/components/schemas/RelationshipToRole' + required: + - role + type: object + AuthNMappingRelationshipToTeam: + description: Relationship of AuthN Mapping to a Team. + properties: + team: + $ref: '#/components/schemas/RelationshipToTeam' + required: + - team + type: object AuthNMappingRelationships: description: All relationships associated with AuthN Mapping. properties: @@ -1350,6 +1366,8 @@ components: $ref: '#/components/schemas/RelationshipToRole' saml_assertion_attribute: $ref: '#/components/schemas/RelationshipToSAMLAssertionAttribute' + team: + $ref: '#/components/schemas/RelationshipToTeam' type: object AuthNMappingResponse: description: AuthN Mapping response from the API. @@ -1362,6 +1380,60 @@ components: $ref: '#/components/schemas/AuthNMappingIncluded' type: array type: object + AuthNMappingTeam: + description: Team. + properties: + attributes: + $ref: '#/components/schemas/AuthNMappingTeamAttributes' + id: + description: The ID of the Team. + example: f9bb8444-af7f-11ec-ac2c-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/TeamType' + type: object + AuthNMappingTeamAttributes: + description: Team attributes. + properties: + avatar: + description: Unicode representation of the avatar for the team, limited + to a single grapheme + example: "\U0001F951" + nullable: true + type: string + banner: + description: Banner selection for the team + format: int64 + nullable: true + type: integer + handle: + description: The team's identifier + example: example-team + maxLength: 195 + type: string + link_count: + description: The number of links belonging to the team + format: int32 + maximum: 2147483647 + readOnly: true + type: integer + name: + description: The name of the team + example: Example Team + maxLength: 200 + type: string + summary: + description: A brief summary of the team, derived from the `description` + maxLength: 120 + nullable: true + type: string + user_count: + description: The number of users belonging to the team + format: int32 + maximum: 2147483647 + readOnly: true + type: integer + type: object AuthNMappingUpdateAttributes: description: Key/Value pair of attributes used for update request. properties: @@ -1394,11 +1466,10 @@ components: - type type: object AuthNMappingUpdateRelationships: - description: Relationship of AuthN Mapping update object to Role. - properties: - role: - $ref: '#/components/schemas/RelationshipToRole' - type: object + description: Relationship of AuthN Mapping update object to a Role or Team. + oneOf: + - $ref: '#/components/schemas/AuthNMappingRelationshipToRole' + - $ref: '#/components/schemas/AuthNMappingRelationshipToTeam' AuthNMappingUpdateRequest: description: Request to update an AuthN Mapping. properties: @@ -15667,6 +15738,22 @@ components: - id - type type: object + RelationshipToTeam: + description: Relationship to team. + properties: + data: + $ref: '#/components/schemas/RelationshipToTeamData' + type: object + RelationshipToTeamData: + description: Relationship to Team object. + properties: + id: + description: The unique identifier of the team. + example: f9bb8444-af7f-11ec-ac2c-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/TeamType' + type: object RelationshipToTeamLinkData: description: Relationship between a link and a team properties: diff --git a/examples/v2/authn-mappings/CreateAuthNMapping.rb b/examples/v2/authn-mappings/CreateAuthNMapping.rb index 1d608685b8fa..a3311064014c 100644 --- a/examples/v2/authn-mappings/CreateAuthNMapping.rb +++ b/examples/v2/authn-mappings/CreateAuthNMapping.rb @@ -12,7 +12,7 @@ attribute_key: "exampleauthnmapping", attribute_value: "Example-AuthN-Mapping", }), - relationships: DatadogAPIClient::V2::AuthNMappingCreateRelationships.new({ + relationships: DatadogAPIClient::V2::AuthNMappingRelationshipToRole.new({ role: DatadogAPIClient::V2::RelationshipToRole.new({ data: DatadogAPIClient::V2::RelationshipToRoleData.new({ id: ROLE_DATA_ID, diff --git a/examples/v2/authn-mappings/UpdateAuthNMapping.rb b/examples/v2/authn-mappings/UpdateAuthNMapping.rb index ae68b5d5d839..cc0031170c31 100644 --- a/examples/v2/authn-mappings/UpdateAuthNMapping.rb +++ b/examples/v2/authn-mappings/UpdateAuthNMapping.rb @@ -16,7 +16,7 @@ attribute_value: "Development", }), id: AUTHN_MAPPING_DATA_ID, - relationships: DatadogAPIClient::V2::AuthNMappingUpdateRelationships.new({ + relationships: DatadogAPIClient::V2::AuthNMappingRelationshipToRole.new({ role: DatadogAPIClient::V2::RelationshipToRole.new({ data: DatadogAPIClient::V2::RelationshipToRoleData.new({ id: ROLE_DATA_ID, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index f48ac28fd0e0..730c8f297df8 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -900,10 +900,14 @@ def overrides "v2.authn_mapping_create_request" => "AuthNMappingCreateRequest", "v2.authn_mapping_included" => "AuthNMappingIncluded", "v2.authn_mapping_relationships" => "AuthNMappingRelationships", + "v2.authn_mapping_relationship_to_role" => "AuthNMappingRelationshipToRole", + "v2.authn_mapping_relationship_to_team" => "AuthNMappingRelationshipToTeam", "v2.authn_mapping_response" => "AuthNMappingResponse", "v2.authn_mappings_response" => "AuthNMappingsResponse", "v2.authn_mappings_sort" => "AuthNMappingsSort", "v2.authn_mappings_type" => "AuthNMappingsType", + "v2.authn_mapping_team" => "AuthNMappingTeam", + "v2.authn_mapping_team_attributes" => "AuthNMappingTeamAttributes", "v2.authn_mapping_update_attributes" => "AuthNMappingUpdateAttributes", "v2.authn_mapping_update_data" => "AuthNMappingUpdateData", "v2.authn_mapping_update_relationships" => "AuthNMappingUpdateRelationships", @@ -1789,6 +1793,8 @@ def overrides "v2.relationship_to_rule_data_object" => "RelationshipToRuleDataObject", "v2.relationship_to_saml_assertion_attribute" => "RelationshipToSAMLAssertionAttribute", "v2.relationship_to_saml_assertion_attribute_data" => "RelationshipToSAMLAssertionAttributeData", + "v2.relationship_to_team" => "RelationshipToTeam", + "v2.relationship_to_team_data" => "RelationshipToTeamData", "v2.relationship_to_team_link_data" => "RelationshipToTeamLinkData", "v2.relationship_to_team_links" => "RelationshipToTeamLinks", "v2.relationship_to_user" => "RelationshipToUser", diff --git a/lib/datadog_api_client/v2/models/authn_mapping_create_data.rb b/lib/datadog_api_client/v2/models/authn_mapping_create_data.rb index 31d1e6bb59ce..f90893f84c2f 100644 --- a/lib/datadog_api_client/v2/models/authn_mapping_create_data.rb +++ b/lib/datadog_api_client/v2/models/authn_mapping_create_data.rb @@ -24,7 +24,7 @@ class AuthNMappingCreateData # Key/Value pair of attributes used for create request. attr_accessor :attributes - # Relationship of AuthN Mapping create object to Role. + # Relationship of AuthN Mapping create object to a Role or Team. attr_accessor :relationships # AuthN Mappings resource type. diff --git a/lib/datadog_api_client/v2/models/authn_mapping_create_relationships.rb b/lib/datadog_api_client/v2/models/authn_mapping_create_relationships.rb index c25df9f35aac..e093171657f4 100644 --- a/lib/datadog_api_client/v2/models/authn_mapping_create_relationships.rb +++ b/lib/datadog_api_client/v2/models/authn_mapping_create_relationships.rb @@ -17,64 +17,47 @@ require 'time' module DatadogAPIClient::V2 - # Relationship of AuthN Mapping create object to Role. - class AuthNMappingCreateRelationships - include BaseGenericModel - - # Relationship to role. - attr_accessor :role - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'role' => :'role' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'role' => :'RelationshipToRole' - } - 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::AuthNMappingCreateRelationships` initialize method" + # Relationship of AuthN Mapping create object to a Role or Team. + module AuthNMappingCreateRelationships + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'AuthNMappingRelationshipToRole', + :'AuthNMappingRelationshipToTeam' + ] end - - # 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)) - fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::AuthNMappingCreateRelationships`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - h[k.to_sym] = v - } - if attributes.key?(:'role') - self.role = attributes[:'role'] + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end end 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 && - role == o.role - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [role].hash - end end end diff --git a/lib/datadog_api_client/v2/models/authn_mapping_included.rb b/lib/datadog_api_client/v2/models/authn_mapping_included.rb index 7ddf6946d80b..5eb119767cc7 100644 --- a/lib/datadog_api_client/v2/models/authn_mapping_included.rb +++ b/lib/datadog_api_client/v2/models/authn_mapping_included.rb @@ -27,7 +27,8 @@ class << self def openapi_one_of [ :'SAMLAssertionAttribute', - :'Role' + :'Role', + :'AuthNMappingTeam' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/authn_mapping_relationship_to_role.rb b/lib/datadog_api_client/v2/models/authn_mapping_relationship_to_role.rb new file mode 100644 index 000000000000..7b11295f2e04 --- /dev/null +++ b/lib/datadog_api_client/v2/models/authn_mapping_relationship_to_role.rb @@ -0,0 +1,98 @@ +=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 + # Relationship of AuthN Mapping to a Role. + class AuthNMappingRelationshipToRole + include BaseGenericModel + + # Relationship to role. + attr_reader :role + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'role' => :'role' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'role' => :'RelationshipToRole' + } + 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::AuthNMappingRelationshipToRole` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::AuthNMappingRelationshipToRole`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'role') + self.role = attributes[:'role'] + 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 @role.nil? + true + end + + # Custom attribute writer method with validation + # @param role [Object] Object to be assigned + # @!visibility private + def role=(role) + if role.nil? + fail ArgumentError, 'invalid value for "role", role cannot be nil.' + end + @role = role + 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 && + role == o.role + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [role].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/authn_mapping_relationship_to_team.rb b/lib/datadog_api_client/v2/models/authn_mapping_relationship_to_team.rb new file mode 100644 index 000000000000..c340a902ac9a --- /dev/null +++ b/lib/datadog_api_client/v2/models/authn_mapping_relationship_to_team.rb @@ -0,0 +1,98 @@ +=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 + # Relationship of AuthN Mapping to a Team. + class AuthNMappingRelationshipToTeam + include BaseGenericModel + + # Relationship to team. + attr_reader :team + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'team' => :'team' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'team' => :'RelationshipToTeam' + } + 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::AuthNMappingRelationshipToTeam` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::AuthNMappingRelationshipToTeam`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'team') + self.team = attributes[:'team'] + 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 @team.nil? + true + end + + # Custom attribute writer method with validation + # @param team [Object] Object to be assigned + # @!visibility private + def team=(team) + if team.nil? + fail ArgumentError, 'invalid value for "team", team cannot be nil.' + end + @team = team + 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 && + team == o.team + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [team].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/authn_mapping_relationships.rb b/lib/datadog_api_client/v2/models/authn_mapping_relationships.rb index 74bb3a71c174..870e72af8129 100644 --- a/lib/datadog_api_client/v2/models/authn_mapping_relationships.rb +++ b/lib/datadog_api_client/v2/models/authn_mapping_relationships.rb @@ -27,12 +27,16 @@ class AuthNMappingRelationships # AuthN Mapping relationship to SAML Assertion Attribute. attr_accessor :saml_assertion_attribute + # Relationship to team. + attr_accessor :team + # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { :'role' => :'role', - :'saml_assertion_attribute' => :'saml_assertion_attribute' + :'saml_assertion_attribute' => :'saml_assertion_attribute', + :'team' => :'team' } end @@ -41,7 +45,8 @@ def self.attribute_map def self.openapi_types { :'role' => :'RelationshipToRole', - :'saml_assertion_attribute' => :'RelationshipToSAMLAssertionAttribute' + :'saml_assertion_attribute' => :'RelationshipToSAMLAssertionAttribute', + :'team' => :'RelationshipToTeam' } end @@ -68,6 +73,10 @@ def initialize(attributes = {}) if attributes.key?(:'saml_assertion_attribute') self.saml_assertion_attribute = attributes[:'saml_assertion_attribute'] end + + if attributes.key?(:'team') + self.team = attributes[:'team'] + end end # Checks equality by comparing each attribute. @@ -77,14 +86,15 @@ def ==(o) return true if self.equal?(o) self.class == o.class && role == o.role && - saml_assertion_attribute == o.saml_assertion_attribute + saml_assertion_attribute == o.saml_assertion_attribute && + team == o.team end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [role, saml_assertion_attribute].hash + [role, saml_assertion_attribute, team].hash end end end diff --git a/lib/datadog_api_client/v2/models/authn_mapping_team.rb b/lib/datadog_api_client/v2/models/authn_mapping_team.rb new file mode 100644 index 000000000000..ebcbd03d8541 --- /dev/null +++ b/lib/datadog_api_client/v2/models/authn_mapping_team.rb @@ -0,0 +1,100 @@ +=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 + # Team. + class AuthNMappingTeam + include BaseGenericModel + + # Team attributes. + attr_accessor :attributes + + # The ID of the Team. + attr_accessor :id + + # Team type + attr_accessor :type + + # 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' => :'AuthNMappingTeamAttributes', + :'id' => :'String', + :'type' => :'TeamType' + } + 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::AuthNMappingTeam` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::AuthNMappingTeam`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + 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 + + # 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 + 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/authn_mapping_team_attributes.rb b/lib/datadog_api_client/v2/models/authn_mapping_team_attributes.rb new file mode 100644 index 000000000000..ba0757c80764 --- /dev/null +++ b/lib/datadog_api_client/v2/models/authn_mapping_team_attributes.rb @@ -0,0 +1,212 @@ +=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 + # Team attributes. + class AuthNMappingTeamAttributes + include BaseGenericModel + + # Unicode representation of the avatar for the team, limited to a single grapheme + attr_accessor :avatar + + # Banner selection for the team + attr_accessor :banner + + # The team's identifier + attr_reader :handle + + # The number of links belonging to the team + attr_reader :link_count + + # The name of the team + attr_reader :name + + # A brief summary of the team, derived from the `description` + attr_reader :summary + + # The number of users belonging to the team + attr_reader :user_count + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'avatar' => :'avatar', + :'banner' => :'banner', + :'handle' => :'handle', + :'link_count' => :'link_count', + :'name' => :'name', + :'summary' => :'summary', + :'user_count' => :'user_count' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'avatar' => :'String', + :'banner' => :'Integer', + :'handle' => :'String', + :'link_count' => :'Integer', + :'name' => :'String', + :'summary' => :'String', + :'user_count' => :'Integer' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'avatar', + :'banner', + :'summary', + ]) + 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::AuthNMappingTeamAttributes` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::AuthNMappingTeamAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'avatar') + self.avatar = attributes[:'avatar'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'handle') + self.handle = attributes[:'handle'] + end + + if attributes.key?(:'link_count') + self.link_count = attributes[:'link_count'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'summary') + self.summary = attributes[:'summary'] + end + + if attributes.key?(:'user_count') + self.user_count = attributes[:'user_count'] + 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 !@handle.nil? && @handle.to_s.length > 195 + return false if !@link_count.nil? && @link_count > 2147483647 + return false if !@name.nil? && @name.to_s.length > 200 + return false if !@summary.nil? && @summary.to_s.length > 120 + return false if !@user_count.nil? && @user_count > 2147483647 + true + end + + # Custom attribute writer method with validation + # @param handle [Object] Object to be assigned + # @!visibility private + def handle=(handle) + if !handle.nil? && handle.to_s.length > 195 + fail ArgumentError, 'invalid value for "handle", the character length must be smaller than or equal to 195.' + end + @handle = handle + end + + # Custom attribute writer method with validation + # @param link_count [Object] Object to be assigned + # @!visibility private + def link_count=(link_count) + if !link_count.nil? && link_count > 2147483647 + fail ArgumentError, 'invalid value for "link_count", must be smaller than or equal to 2147483647.' + end + @link_count = link_count + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if !name.nil? && name.to_s.length > 200 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param summary [Object] Object to be assigned + # @!visibility private + def summary=(summary) + if !summary.nil? && summary.to_s.length > 120 + fail ArgumentError, 'invalid value for "summary", the character length must be smaller than or equal to 120.' + end + @summary = summary + end + + # Custom attribute writer method with validation + # @param user_count [Object] Object to be assigned + # @!visibility private + def user_count=(user_count) + if !user_count.nil? && user_count > 2147483647 + fail ArgumentError, 'invalid value for "user_count", must be smaller than or equal to 2147483647.' + end + @user_count = user_count + 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 && + avatar == o.avatar && + banner == o.banner && + handle == o.handle && + link_count == o.link_count && + name == o.name && + summary == o.summary && + user_count == o.user_count + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [avatar, banner, handle, link_count, name, summary, user_count].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/authn_mapping_update_data.rb b/lib/datadog_api_client/v2/models/authn_mapping_update_data.rb index 89a20a55d517..36716fc028ab 100644 --- a/lib/datadog_api_client/v2/models/authn_mapping_update_data.rb +++ b/lib/datadog_api_client/v2/models/authn_mapping_update_data.rb @@ -27,7 +27,7 @@ class AuthNMappingUpdateData # ID of the AuthN Mapping. attr_reader :id - # Relationship of AuthN Mapping update object to Role. + # Relationship of AuthN Mapping update object to a Role or Team. attr_accessor :relationships # AuthN Mappings resource type. diff --git a/lib/datadog_api_client/v2/models/authn_mapping_update_relationships.rb b/lib/datadog_api_client/v2/models/authn_mapping_update_relationships.rb index f635145e6581..671e741a9766 100644 --- a/lib/datadog_api_client/v2/models/authn_mapping_update_relationships.rb +++ b/lib/datadog_api_client/v2/models/authn_mapping_update_relationships.rb @@ -17,64 +17,47 @@ require 'time' module DatadogAPIClient::V2 - # Relationship of AuthN Mapping update object to Role. - class AuthNMappingUpdateRelationships - include BaseGenericModel - - # Relationship to role. - attr_accessor :role - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'role' => :'role' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'role' => :'RelationshipToRole' - } - 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::AuthNMappingUpdateRelationships` initialize method" + # Relationship of AuthN Mapping update object to a Role or Team. + module AuthNMappingUpdateRelationships + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'AuthNMappingRelationshipToRole', + :'AuthNMappingRelationshipToTeam' + ] end - - # 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)) - fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::AuthNMappingUpdateRelationships`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - h[k.to_sym] = v - } - if attributes.key?(:'role') - self.role = attributes[:'role'] + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end end 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 && - role == o.role - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [role].hash - end end end diff --git a/lib/datadog_api_client/v2/models/relationship_to_team.rb b/lib/datadog_api_client/v2/models/relationship_to_team.rb new file mode 100644 index 000000000000..36edf6649265 --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_team.rb @@ -0,0 +1,80 @@ +=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 + # Relationship to team. + class RelationshipToTeam + include BaseGenericModel + + # Relationship to Team object. + attr_accessor :data + + # 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' => :'RelationshipToTeamData' + } + 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::RelationshipToTeam` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::RelationshipToTeam`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + 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 + 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/relationship_to_team_data.rb b/lib/datadog_api_client/v2/models/relationship_to_team_data.rb new file mode 100644 index 000000000000..920954253e6c --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_team_data.rb @@ -0,0 +1,90 @@ +=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 + # Relationship to Team object. + class RelationshipToTeamData + include BaseGenericModel + + # The unique identifier of the team. + attr_accessor :id + + # Team type + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'TeamType' + } + 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::RelationshipToTeamData` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::RelationshipToTeamData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type].hash + end + end +end