Skip to content

Add Team relationship to AuthNMappings #1864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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:32.515208",
"spec_repo_commit": "cdcf2ed6"
"regenerated": "2024-04-08 20:24:03.354891",
"spec_repo_commit": "037e376a"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-05 19:46:32.532018",
"spec_repo_commit": "cdcf2ed6"
"regenerated": "2024-04-08 20:24:03.371418",
"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
42 changes: 42 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,20 @@ authn\_mapping\_included
:members:
:show-inheritance:

authn\_mapping\_relationship\_to\_role
--------------------------------------

.. automodule:: datadog_api_client.v2.model.authn_mapping_relationship_to_role
:members:
:show-inheritance:

authn\_mapping\_relationship\_to\_team
--------------------------------------

.. automodule:: datadog_api_client.v2.model.authn_mapping_relationship_to_team
:members:
:show-inheritance:

authn\_mapping\_relationships
-----------------------------

Expand All @@ -393,6 +407,20 @@ authn\_mapping\_response
:members:
:show-inheritance:

authn\_mapping\_team
--------------------

.. automodule:: datadog_api_client.v2.model.authn_mapping_team
:members:
:show-inheritance:

authn\_mapping\_team\_attributes
--------------------------------

.. automodule:: datadog_api_client.v2.model.authn_mapping_team_attributes
:members:
:show-inheritance:

authn\_mapping\_update\_attributes
----------------------------------

Expand Down Expand Up @@ -6707,6 +6735,20 @@ relationship\_to\_saml\_assertion\_attribute\_data
:members:
:show-inheritance:

relationship\_to\_team
----------------------

.. automodule:: datadog_api_client.v2.model.relationship_to_team
:members:
:show-inheritance:

relationship\_to\_team\_data
----------------------------

.. automodule:: datadog_api_client.v2.model.relationship_to_team_data
:members:
:show-inheritance:

relationship\_to\_team\_link\_data
----------------------------------

Expand Down
4 changes: 2 additions & 2 deletions examples/v2/authn-mappings/CreateAuthNMapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi
from datadog_api_client.v2.model.authn_mapping_create_attributes import AuthNMappingCreateAttributes
from datadog_api_client.v2.model.authn_mapping_create_data import AuthNMappingCreateData
from datadog_api_client.v2.model.authn_mapping_create_relationships import AuthNMappingCreateRelationships
from datadog_api_client.v2.model.authn_mapping_create_request import AuthNMappingCreateRequest
from datadog_api_client.v2.model.authn_mapping_relationship_to_role import AuthNMappingRelationshipToRole
from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType
from datadog_api_client.v2.model.relationship_to_role import RelationshipToRole
from datadog_api_client.v2.model.relationship_to_role_data import RelationshipToRoleData
Expand All @@ -23,7 +23,7 @@
attribute_key="exampleauthnmapping",
attribute_value="Example-AuthN-Mapping",
),
relationships=AuthNMappingCreateRelationships(
relationships=AuthNMappingRelationshipToRole(
role=RelationshipToRole(
data=RelationshipToRoleData(
id=ROLE_DATA_ID,
Expand Down
4 changes: 2 additions & 2 deletions examples/v2/authn-mappings/UpdateAuthNMapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi
from datadog_api_client.v2.model.authn_mapping_relationship_to_role import AuthNMappingRelationshipToRole
from datadog_api_client.v2.model.authn_mapping_update_attributes import AuthNMappingUpdateAttributes
from datadog_api_client.v2.model.authn_mapping_update_data import AuthNMappingUpdateData
from datadog_api_client.v2.model.authn_mapping_update_relationships import AuthNMappingUpdateRelationships
from datadog_api_client.v2.model.authn_mapping_update_request import AuthNMappingUpdateRequest
from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType
from datadog_api_client.v2.model.relationship_to_role import RelationshipToRole
Expand All @@ -27,7 +27,7 @@
attribute_value="Development",
),
id=AUTHN_MAPPING_DATA_ID,
relationships=AuthNMappingUpdateRelationships(
relationships=AuthNMappingRelationshipToRole(
role=RelationshipToRole(
data=RelationshipToRoleData(
id=ROLE_DATA_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from datadog_api_client.v2.model.authn_mapping_create_attributes import AuthNMappingCreateAttributes
from datadog_api_client.v2.model.authn_mapping_create_relationships import AuthNMappingCreateRelationships
from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType
from datadog_api_client.v2.model.authn_mapping_relationship_to_role import AuthNMappingRelationshipToRole
from datadog_api_client.v2.model.authn_mapping_relationship_to_team import AuthNMappingRelationshipToTeam


class AuthNMappingCreateData(ModelNormal):
Expand All @@ -42,7 +44,9 @@ def __init__(
self_,
type: AuthNMappingsType,
attributes: Union[AuthNMappingCreateAttributes, UnsetType] = unset,
relationships: Union[AuthNMappingCreateRelationships, UnsetType] = unset,
relationships: Union[
AuthNMappingCreateRelationships, AuthNMappingRelationshipToRole, AuthNMappingRelationshipToTeam, UnsetType
] = unset,
**kwargs,
):
"""
Expand All @@ -51,7 +55,7 @@ def __init__(
:param attributes: Key/Value pair of attributes used for create request.
:type attributes: AuthNMappingCreateAttributes, optional

:param relationships: Relationship of AuthN Mapping create object to Role.
:param relationships: Relationship of AuthN Mapping create object to a Role or Team.
:type relationships: AuthNMappingCreateRelationships, optional

:param type: AuthN Mappings resource type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,41 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
ModelComposed,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.relationship_to_role import RelationshipToRole
class AuthNMappingCreateRelationships(ModelComposed):
def __init__(self, **kwargs):
"""
Relationship of AuthN Mapping create object to a Role or Team.

:param role: Relationship to role.
:type role: RelationshipToRole

:param team: Relationship to team.
:type team: RelationshipToTeam
"""
super().__init__(kwargs)

class AuthNMappingCreateRelationships(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.relationship_to_role import RelationshipToRole
def _composed_schemas(_):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
from datadog_api_client.v2.model.authn_mapping_relationship_to_role import AuthNMappingRelationshipToRole
from datadog_api_client.v2.model.authn_mapping_relationship_to_team import AuthNMappingRelationshipToTeam

return {
"role": (RelationshipToRole,),
"oneOf": [
AuthNMappingRelationshipToRole,
AuthNMappingRelationshipToTeam,
],
}

attribute_map = {
"role": "role",
}

def __init__(self_, role: Union[RelationshipToRole, UnsetType] = unset, **kwargs):
"""
Relationship of AuthN Mapping create object to Role.

:param role: Relationship to role.
:type role: RelationshipToRole, optional
"""
if role is not unset:
kwargs["role"] = role
super().__init__(kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/model/authn_mapping_included.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ def _composed_schemas(_):
# loading
from datadog_api_client.v2.model.saml_assertion_attribute import SAMLAssertionAttribute
from datadog_api_client.v2.model.role import Role
from datadog_api_client.v2.model.authn_mapping_team import AuthNMappingTeam

return {
"oneOf": [
SAMLAssertionAttribute,
Role,
AuthNMappingTeam,
],
}
Loading