From f60c720c8550b80a79d6400023736c700001f0c4 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 20 Dec 2023 18:12:57 +0000 Subject: [PATCH] Regenerate client from commit 0ea19912 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 46 +++++++ examples/v2/teams/CreateTeamMembership.rb | 6 + features/v2/teams.feature | 4 +- lib/datadog_api_client/inflector.rb | 3 + .../models/relationship_to_user_team_team.rb | 98 +++++++++++++++ .../relationship_to_user_team_team_data.rb | 119 ++++++++++++++++++ .../v2/models/user_team_attributes.rb | 25 +++- .../v2/models/user_team_relationships.rb | 12 +- .../v2/models/user_team_team_type.rb | 26 ++++ 10 files changed, 339 insertions(+), 8 deletions(-) create mode 100644 lib/datadog_api_client/v2/models/relationship_to_user_team_team.rb create mode 100644 lib/datadog_api_client/v2/models/relationship_to_user_team_team_data.rb create mode 100644 lib/datadog_api_client/v2/models/user_team_team_type.rb diff --git a/.apigentools-info b/.apigentools-info index 08a1d8c46128..c131139dd51a 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-12-20 13:53:12.279073", - "spec_repo_commit": "1e75e401" + "regenerated": "2023-12-20 18:12:27.522466", + "spec_repo_commit": "0ea19912" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-12-20 13:53:12.293425", - "spec_repo_commit": "1e75e401" + "regenerated": "2023-12-20 18:12:27.538857", + "spec_repo_commit": "0ea19912" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fba681546eaa..1c5f46bfd51a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13640,6 +13640,27 @@ components: - id - type type: object + RelationshipToUserTeamTeam: + description: Relationship between team membership and team + properties: + data: + $ref: '#/components/schemas/RelationshipToUserTeamTeamData' + required: + - data + type: object + RelationshipToUserTeamTeamData: + description: The team associated with the membership + properties: + id: + description: The ID of the team associated with the membership + example: d7e15d9d-d346-43da-81d8-3d9e71d9a5e9 + type: string + type: + $ref: '#/components/schemas/UserTeamTeamType' + required: + - id + - type + type: object RelationshipToUserTeamUser: description: Relationship between team membership and user properties: @@ -19614,6 +19635,20 @@ components: UserTeamAttributes: description: Team membership attributes properties: + provisioned_by: + description: 'The mechanism responsible for provisioning the team relationship. + + Possible values: null for added by a user, "service_account" if added + by a service account, and "saml_mapping" if provisioned via SAML mapping.' + nullable: true + readOnly: true + type: string + provisioned_by_id: + description: UUID of the User or Service Account who provisioned this team + membership, or null if provisioned via SAML mapping. + nullable: true + readOnly: true + type: string role: $ref: '#/components/schemas/UserTeamRole' type: object @@ -19665,6 +19700,8 @@ components: UserTeamRelationships: description: Relationship between membership and a user properties: + team: + $ref: '#/components/schemas/RelationshipToUserTeamTeam' user: $ref: '#/components/schemas/RelationshipToUserTeamUser' type: object @@ -19690,6 +19727,15 @@ components: type: string x-enum-varnames: - ADMIN + UserTeamTeamType: + default: team + description: User team team type + enum: + - team + example: team + type: string + x-enum-varnames: + - TEAM UserTeamType: default: team_memberships description: Team membership type diff --git a/examples/v2/teams/CreateTeamMembership.rb b/examples/v2/teams/CreateTeamMembership.rb index ee03f382ddca..154fa151a7b5 100644 --- a/examples/v2/teams/CreateTeamMembership.rb +++ b/examples/v2/teams/CreateTeamMembership.rb @@ -9,6 +9,12 @@ role: DatadogAPIClient::V2::UserTeamRole::ADMIN, }), relationships: DatadogAPIClient::V2::UserTeamRelationships.new({ + team: DatadogAPIClient::V2::RelationshipToUserTeamTeam.new({ + data: DatadogAPIClient::V2::RelationshipToUserTeamTeamData.new({ + id: "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", + type: DatadogAPIClient::V2::UserTeamTeamType::TEAM, + }), + }), user: DatadogAPIClient::V2::RelationshipToUserTeamUser.new({ data: DatadogAPIClient::V2::RelationshipToUserTeamUserData.new({ id: "b8626d7e-cedd-11eb-abf5-da7ad0900001", diff --git a/features/v2/teams.feature b/features/v2/teams.feature index c226790f553c..c59a3a3654ef 100644 --- a/features/v2/teams.feature +++ b/features/v2/teams.feature @@ -11,7 +11,7 @@ Feature: Teams Scenario: Add a user to a team returns "API error response." response Given new "CreateTeamMembership" request And request contains "team_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} + And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"team": {"data": {"id": "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", "type": "team"}}, "user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} When the request is sent Then the response status is 409 API error response. @@ -19,7 +19,7 @@ Feature: Teams Scenario: Add a user to a team returns "Represents a user's association to a team" response Given new "CreateTeamMembership" request And request contains "team_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} + And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"team": {"data": {"id": "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", "type": "team"}}, "user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} When the request is sent Then the response status is 200 Represents a user's association to a team diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index a528da2a82da..5c20e58acc15 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1648,6 +1648,8 @@ def overrides "v2.relationship_to_users" => "RelationshipToUsers", "v2.relationship_to_user_team_permission" => "RelationshipToUserTeamPermission", "v2.relationship_to_user_team_permission_data" => "RelationshipToUserTeamPermissionData", + "v2.relationship_to_user_team_team" => "RelationshipToUserTeamTeam", + "v2.relationship_to_user_team_team_data" => "RelationshipToUserTeamTeamData", "v2.relationship_to_user_team_user" => "RelationshipToUserTeamUser", "v2.relationship_to_user_team_user_data" => "RelationshipToUserTeamUserData", "v2.reorder_retention_filters_request" => "ReorderRetentionFiltersRequest", @@ -2098,6 +2100,7 @@ def overrides "v2.user_team_response" => "UserTeamResponse", "v2.user_team_role" => "UserTeamRole", "v2.user_teams_response" => "UserTeamsResponse", + "v2.user_team_team_type" => "UserTeamTeamType", "v2.user_team_type" => "UserTeamType", "v2.user_team_update" => "UserTeamUpdate", "v2.user_team_update_request" => "UserTeamUpdateRequest", diff --git a/lib/datadog_api_client/v2/models/relationship_to_user_team_team.rb b/lib/datadog_api_client/v2/models/relationship_to_user_team_team.rb new file mode 100644 index 000000000000..e836b4ca9f30 --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_user_team_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 between team membership and team + class RelationshipToUserTeamTeam + include BaseGenericModel + + # The team associated with the membership + attr_reader :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' => :'RelationshipToUserTeamTeamData' + } + 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::RelationshipToUserTeamTeam` 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::RelationshipToUserTeamTeam`. 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 + + # 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 + + # 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_user_team_team_data.rb b/lib/datadog_api_client/v2/models/relationship_to_user_team_team_data.rb new file mode 100644 index 000000000000..ac17ac4281bf --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_user_team_team_data.rb @@ -0,0 +1,119 @@ +=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 team associated with the membership + class RelationshipToUserTeamTeamData + include BaseGenericModel + + # The ID of the team associated with the membership + attr_reader :id + + # User team team type + attr_reader :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' => :'UserTeamTeamType' + } + 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::RelationshipToUserTeamTeamData` 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::RelationshipToUserTeamTeamData`. 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 + + # 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 @id.nil? + return false if @type.nil? + true + 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 + + # 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 diff --git a/lib/datadog_api_client/v2/models/user_team_attributes.rb b/lib/datadog_api_client/v2/models/user_team_attributes.rb index 51a6111da1a2..bafbd73723fb 100644 --- a/lib/datadog_api_client/v2/models/user_team_attributes.rb +++ b/lib/datadog_api_client/v2/models/user_team_attributes.rb @@ -21,6 +21,13 @@ module DatadogAPIClient::V2 class UserTeamAttributes include BaseGenericModel + # The mechanism responsible for provisioning the team relationship. + # Possible values: null for added by a user, "service_account" if added by a service account, and "saml_mapping" if provisioned via SAML mapping. + attr_accessor :provisioned_by + + # UUID of the User or Service Account who provisioned this team membership, or null if provisioned via SAML mapping. + attr_accessor :provisioned_by_id + # The user's role within the team attr_accessor :role @@ -28,6 +35,8 @@ class UserTeamAttributes # @!visibility private def self.attribute_map { + :'provisioned_by' => :'provisioned_by', + :'provisioned_by_id' => :'provisioned_by_id', :'role' => :'role' } end @@ -36,6 +45,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'provisioned_by' => :'String', + :'provisioned_by_id' => :'String', :'role' => :'UserTeamRole' } end @@ -44,6 +55,8 @@ def self.openapi_types # @!visibility private def self.openapi_nullable Set.new([ + :'provisioned_by', + :'provisioned_by_id', :'role', ]) end @@ -64,6 +77,14 @@ def initialize(attributes = {}) h[k.to_sym] = v } + if attributes.key?(:'provisioned_by') + self.provisioned_by = attributes[:'provisioned_by'] + end + + if attributes.key?(:'provisioned_by_id') + self.provisioned_by_id = attributes[:'provisioned_by_id'] + end + if attributes.key?(:'role') self.role = attributes[:'role'] end @@ -75,6 +96,8 @@ def initialize(attributes = {}) def ==(o) return true if self.equal?(o) self.class == o.class && + provisioned_by == o.provisioned_by && + provisioned_by_id == o.provisioned_by_id && role == o.role end @@ -82,7 +105,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [role].hash + [provisioned_by, provisioned_by_id, role].hash end end end diff --git a/lib/datadog_api_client/v2/models/user_team_relationships.rb b/lib/datadog_api_client/v2/models/user_team_relationships.rb index 74f367e3678d..6217ee82aa28 100644 --- a/lib/datadog_api_client/v2/models/user_team_relationships.rb +++ b/lib/datadog_api_client/v2/models/user_team_relationships.rb @@ -21,6 +21,9 @@ module DatadogAPIClient::V2 class UserTeamRelationships include BaseGenericModel + # Relationship between team membership and team + attr_accessor :team + # Relationship between team membership and user attr_accessor :user @@ -28,6 +31,7 @@ class UserTeamRelationships # @!visibility private def self.attribute_map { + :'team' => :'team', :'user' => :'user' } end @@ -36,6 +40,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'team' => :'RelationshipToUserTeamTeam', :'user' => :'RelationshipToUserTeamUser' } end @@ -56,6 +61,10 @@ def initialize(attributes = {}) h[k.to_sym] = v } + if attributes.key?(:'team') + self.team = attributes[:'team'] + end + if attributes.key?(:'user') self.user = attributes[:'user'] end @@ -67,6 +76,7 @@ def initialize(attributes = {}) def ==(o) return true if self.equal?(o) self.class == o.class && + team == o.team && user == o.user end @@ -74,7 +84,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [user].hash + [team, user].hash end end end diff --git a/lib/datadog_api_client/v2/models/user_team_team_type.rb b/lib/datadog_api_client/v2/models/user_team_team_type.rb new file mode 100644 index 000000000000..0f2a20923c80 --- /dev/null +++ b/lib/datadog_api_client/v2/models/user_team_team_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 + # User team team type + class UserTeamTeamType + include BaseEnumModel + + TEAM = "team".freeze + end +end