Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
107 changes: 97 additions & 10 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -1343,13 +1342,32 @@ 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:
role:
$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.
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/authn-mappings/CreateAuthNMapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/authn-mappings/UpdateAuthNMapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class << self
def openapi_one_of
[
:'SAMLAssertionAttribute',
:'Role'
:'Role',
:'AuthNMappingTeam'
]
end
# Builds the object
Expand Down
Loading