Skip to content

Commit

Permalink
Include user data with team membership resource (#1863)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Feb 21, 2024
1 parent 0707019 commit b2664c5
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 6 deletions.
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-02-21 12:50:36.140864",
"spec_repo_commit": "1ec2d96a"
"regenerated": "2024-02-21 20:20:09.813942",
"spec_repo_commit": "90ae1ed9"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-02-21 12:50:36.176011",
"spec_repo_commit": "1ec2d96a"
"regenerated": "2024-02-21 20:20:09.828646",
"spec_repo_commit": "90ae1ed9"
}
}
}
9 changes: 9 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21288,6 +21288,10 @@ components:
required:
- type
type: object
UserTeamIncluded:
description: Included resources related to the team membership
oneOf:
- $ref: '#/components/schemas/User'
UserTeamPermission:
description: A user's permissions for a given team
properties:
Expand Down Expand Up @@ -21342,6 +21346,11 @@ components:
properties:
data:
$ref: '#/components/schemas/UserTeam'
included:
description: Resources related to the team memberships
items:
$ref: '#/components/schemas/UserTeamIncluded'
type: array
type: object
UserTeamRole:
description: The user's role within the team
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9640,6 +9640,13 @@ user\_team\_create
:members:
:show-inheritance:

user\_team\_included
--------------------

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

user\_team\_permission
----------------------

Expand Down
47 changes: 47 additions & 0 deletions src/datadog_api_client/v2/model/user_team_included.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelComposed,
cached_property,
)


class UserTeamIncluded(ModelComposed):
def __init__(self, **kwargs):
"""
Included resources related to the team membership
:param attributes: Attributes of user object returned by the API.
:type attributes: UserAttributes, optional
:param id: ID of the user.
:type id: str, optional
:param relationships: Relationships of the user object returned by the API.
:type relationships: UserResponseRelationships, optional
:param type: Users resource type.
:type type: UsersType, optional
"""
super().__init__(kwargs)

@cached_property
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.user import User

return {
"oneOf": [
User,
],
}
19 changes: 17 additions & 2 deletions src/datadog_api_client/v2/model/user_team_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union, TYPE_CHECKING
from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
Expand All @@ -15,28 +15,43 @@

if TYPE_CHECKING:
from datadog_api_client.v2.model.user_team import UserTeam
from datadog_api_client.v2.model.user_team_included import UserTeamIncluded
from datadog_api_client.v2.model.user import User


class UserTeamResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.user_team import UserTeam
from datadog_api_client.v2.model.user_team_included import UserTeamIncluded

return {
"data": (UserTeam,),
"included": ([UserTeamIncluded],),
}

attribute_map = {
"data": "data",
"included": "included",
}

def __init__(self_, data: Union[UserTeam, UnsetType] = unset, **kwargs):
def __init__(
self_,
data: Union[UserTeam, UnsetType] = unset,
included: Union[List[Union[UserTeamIncluded, User]], UnsetType] = unset,
**kwargs,
):
"""
Team membership response
:param data: A user's relationship with a team
:type data: UserTeam, optional
:param included: Resources related to the team memberships
:type included: [UserTeamIncluded], optional
"""
if data is not unset:
kwargs["data"] = data
if included is not unset:
kwargs["included"] = included
super().__init__(kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,7 @@
from datadog_api_client.v2.model.user_team import UserTeam
from datadog_api_client.v2.model.user_team_attributes import UserTeamAttributes
from datadog_api_client.v2.model.user_team_create import UserTeamCreate
from datadog_api_client.v2.model.user_team_included import UserTeamIncluded
from datadog_api_client.v2.model.user_team_permission import UserTeamPermission
from datadog_api_client.v2.model.user_team_permission_attributes import UserTeamPermissionAttributes
from datadog_api_client.v2.model.user_team_permission_type import UserTeamPermissionType
Expand Down Expand Up @@ -3036,6 +3037,7 @@
"UserTeam",
"UserTeamAttributes",
"UserTeamCreate",
"UserTeamIncluded",
"UserTeamPermission",
"UserTeamPermissionAttributes",
"UserTeamPermissionType",
Expand Down

0 comments on commit b2664c5

Please sign in to comment.