From b58b1e91dfdf28fcfe17b9e2ad30b639af39b5b5 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 8 Apr 2026 19:48:16 +0000 Subject: [PATCH] Regenerate client from commit 406e40f of spec repo --- .generator/schemas/v2/openapi.yaml | 274 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 70 +++++ examples/v2/organizations/ListOrgsV2.py | 13 + examples/v2/users/DeleteUserInvitations.py | 14 + .../v2/api/organizations_api.py | 42 +++ src/datadog_api_client/v2/api/users_api.py | 42 +++ .../v2/model/managed_orgs_data.py | 55 ++++ .../model/managed_orgs_relationship_to_org.py | 40 +++ .../managed_orgs_relationship_to_orgs.py | 40 +++ .../v2/model/managed_orgs_relationships.py | 50 ++++ .../v2/model/managed_orgs_response.py | 48 +++ .../v2/model/managed_orgs_type.py | 35 +++ .../v2/model/org_attributes.py | 87 ++++++ src/datadog_api_client/v2/model/org_data.py | 55 ++++ .../v2/model/org_relationship_data.py | 47 +++ .../v2/model/org_resource_type.py | 35 +++ src/datadog_api_client/v2/models/__init__.py | 20 ++ tests/v2/features/organizations.feature | 6 + tests/v2/features/undo.json | 12 + tests/v2/features/users.feature | 14 + 20 files changed, 999 insertions(+) create mode 100644 examples/v2/organizations/ListOrgsV2.py create mode 100644 examples/v2/users/DeleteUserInvitations.py create mode 100644 src/datadog_api_client/v2/model/managed_orgs_data.py create mode 100644 src/datadog_api_client/v2/model/managed_orgs_relationship_to_org.py create mode 100644 src/datadog_api_client/v2/model/managed_orgs_relationship_to_orgs.py create mode 100644 src/datadog_api_client/v2/model/managed_orgs_relationships.py create mode 100644 src/datadog_api_client/v2/model/managed_orgs_response.py create mode 100644 src/datadog_api_client/v2/model/managed_orgs_type.py create mode 100644 src/datadog_api_client/v2/model/org_attributes.py create mode 100644 src/datadog_api_client/v2/model/org_data.py create mode 100644 src/datadog_api_client/v2/model/org_relationship_data.py create mode 100644 src/datadog_api_client/v2/model/org_resource_type.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d235bdcd3d..c5aea6aff5 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -39547,6 +39547,74 @@ components: - type - id type: object + ManagedOrgsData: + description: The managed organizations resource. + properties: + id: + description: The UUID of the current organization. + example: "4dee724d-00cc-11ea-a77b-570c9d03c6c5" + format: uuid + type: string + relationships: + $ref: "#/components/schemas/ManagedOrgsRelationships" + type: + $ref: "#/components/schemas/ManagedOrgsType" + required: + - id + - type + - relationships + type: object + ManagedOrgsRelationshipToOrg: + description: Relationship to the current organization. + properties: + data: + $ref: "#/components/schemas/OrgRelationshipData" + required: + - data + type: object + ManagedOrgsRelationshipToOrgs: + description: Relationship to the managed organizations. + properties: + data: + description: List of managed organization references. + items: + $ref: "#/components/schemas/OrgRelationshipData" + type: array + required: + - data + type: object + ManagedOrgsRelationships: + description: Relationships of the managed organizations resource. + properties: + current_org: + $ref: "#/components/schemas/ManagedOrgsRelationshipToOrg" + managed_orgs: + $ref: "#/components/schemas/ManagedOrgsRelationshipToOrgs" + required: + - current_org + - managed_orgs + type: object + ManagedOrgsResponse: + description: Response containing the current organization and its managed organizations. + properties: + data: + $ref: "#/components/schemas/ManagedOrgsData" + included: + description: Included organization resources. + items: + $ref: "#/components/schemas/OrgData" + type: array + required: + - data + - included + type: object + ManagedOrgsType: + description: The resource type for managed organizations. + enum: [managed_orgs] + example: "managed_orgs" + type: string + x-enum-varnames: + - MANAGED_ORGS MemberTeam: description: A member team properties: @@ -48114,6 +48182,53 @@ components: x-enum-varnames: - ASC - DESC + OrgAttributes: + description: Attributes of an organization. + properties: + created_at: + description: The creation timestamp of the organization. + example: "2019-09-26T17:28:28Z" + format: date-time + type: string + description: + description: A description of the organization. + example: "Production organization." + type: string + disabled: + description: Whether the organization is disabled. + example: false + type: boolean + modified_at: + description: The last modification timestamp of the organization. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + name: + description: The name of the organization. + example: "My Organization" + type: string + public_id: + description: The public identifier of the organization. + example: "abcdef12345" + type: string + sharing: + description: The sharing setting of the organization. + example: "none" + type: string + url: + description: The URL of the organization. + example: "https://app.datadoghq.com/account/my-org" + type: string + required: + - public_id + - name + - description + - sharing + - url + - disabled + - created_at + - modified_at + type: object OrgConfigGetResponse: description: A response with a single Org Config. properties: @@ -48415,6 +48530,44 @@ components: type: string x-enum-varnames: - USERS + OrgData: + description: An organization resource. + properties: + attributes: + $ref: "#/components/schemas/OrgAttributes" + id: + description: The UUID of the organization. + example: "4dee724d-00cc-11ea-a77b-570c9d03c6c5" + format: uuid + type: string + type: + $ref: "#/components/schemas/OrgResourceType" + required: + - id + - type + - attributes + type: object + OrgRelationshipData: + description: Reference to an organization resource. + properties: + id: + description: The UUID of the organization. + example: "4dee724d-00cc-11ea-a77b-570c9d03c6c5" + format: uuid + type: string + type: + $ref: "#/components/schemas/OrgResourceType" + required: + - id + - type + type: object + OrgResourceType: + description: The resource type for organizations. + enum: [orgs] + example: "orgs" + type: string + x-enum-varnames: + - ORGS Organization: description: Organization object. properties: @@ -98143,6 +98296,83 @@ paths: operator: OR permissions: - on_call_read + /api/v2/org: + get: + description: Returns the current organization and its managed organizations in JSON:API format. + operationId: ListOrgsV2 + parameters: + - description: Filter managed organizations by name. + example: "My Child Org" + in: query + name: "filter[name]" + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + id: "4dee724d-00cc-11ea-a77b-570c9d03c6c5" + relationships: + current_org: + data: + id: "4dee724d-00cc-11ea-a77b-570c9d03c6c5" + type: "orgs" + managed_orgs: + data: + - id: "a1b2c3d4-00cc-11ea-a77b-570c9d03c6c5" + type: "orgs" + type: "managed_orgs" + included: + - attributes: + created_at: "2019-09-26T17:28:28Z" + description: "Production organization." + disabled: false + modified_at: "2024-01-15T10:30:00Z" + name: "My Organization" + public_id: "abcdef12345" + sharing: "none" + url: "https://app.datadoghq.com/account/my-org" + id: "4dee724d-00cc-11ea-a77b-570c9d03c6c5" + type: "orgs" + - attributes: + created_at: "2020-05-10T12:00:00Z" + description: "Child organization." + disabled: false + modified_at: "2024-06-20T08:15:00Z" + name: "My Child Org" + public_id: "ghijkl67890" + sharing: "none" + url: "https://app.datadoghq.com/account/my-child-org" + id: "a1b2c3d4-00cc-11ea-a77b-570c9d03c6c5" + type: "orgs" + schema: + $ref: "#/components/schemas/ManagedOrgsResponse" + description: OK + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + - org_connections_write + summary: List your managed organizations + tags: + - Organizations + "x-permission": + operator: OR + permissions: + - org_management + - org_connections_write /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). @@ -114716,6 +114946,50 @@ paths: permissions: - user_access_manage - service_account_write + /api/v2/users/{user_id}/invitations: + delete: + description: |- + Cancel all pending invitations for a specified user. + Requires the `user_access_invite` permission. + operationId: DeleteUserInvitations + parameters: + - description: The UUID of the user whose pending invitations should be canceled. + in: path + name: user_id + required: true + schema: + example: "4dee724d-00cc-11ea-a77b-570c9d03c6c5" + format: uuid + type: string + responses: + "200": + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Authentication error + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_invite + summary: Delete a pending user's invitations + tags: + - Users + "x-permission": + operator: OR + permissions: + - user_access_invite /api/v2/users/{user_id}/orgs: get: description: |- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index e714684121..6e7183f866 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -17392,6 +17392,48 @@ datadog\_api\_client.v2.model.maintenance\_data\_relationships\_status\_page\_da :members: :show-inheritance: +datadog\_api\_client.v2.model.managed\_orgs\_data module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.managed_orgs_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.managed\_orgs\_relationship\_to\_org module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.managed_orgs_relationship_to_org + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.managed\_orgs\_relationship\_to\_orgs module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.managed_orgs_relationship_to_orgs + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.managed\_orgs\_relationships module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.managed_orgs_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.managed\_orgs\_response module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.managed_orgs_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.managed\_orgs\_type module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.managed_orgs_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.member\_team module ------------------------------------------------- @@ -21375,6 +21417,13 @@ datadog\_api\_client.v2.model.order\_direction module :members: :show-inheritance: +datadog\_api\_client.v2.model.org\_attributes module +---------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.org_attributes + :members: + :show-inheritance: + datadog\_api\_client.v2.model.org\_config\_get\_response module --------------------------------------------------------------- @@ -21585,6 +21634,27 @@ datadog\_api\_client.v2.model.org\_connection\_user\_relationship\_data\_type mo :members: :show-inheritance: +datadog\_api\_client.v2.model.org\_data module +---------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.org_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.org\_relationship\_data module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.org_relationship_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.org\_resource\_type module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.org_resource_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.organization module ------------------------------------------------- diff --git a/examples/v2/organizations/ListOrgsV2.py b/examples/v2/organizations/ListOrgsV2.py new file mode 100644 index 0000000000..38e39cc621 --- /dev/null +++ b/examples/v2/organizations/ListOrgsV2.py @@ -0,0 +1,13 @@ +""" +List your managed organizations returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.organizations_api import OrganizationsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OrganizationsApi(api_client) + response = api_instance.list_orgs_v2() + + print(response) diff --git a/examples/v2/users/DeleteUserInvitations.py b/examples/v2/users/DeleteUserInvitations.py new file mode 100644 index 0000000000..fe441dfb5f --- /dev/null +++ b/examples/v2/users/DeleteUserInvitations.py @@ -0,0 +1,14 @@ +""" +Delete a pending user's invitations returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.users_api import UsersApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = UsersApi(api_client) + api_instance.delete_user_invitations( + user_id=UUID("4dee724d-00cc-11ea-a77b-570c9d03c6c5"), + ) diff --git a/src/datadog_api_client/v2/api/organizations_api.py b/src/datadog_api_client/v2/api/organizations_api.py index 68d83731f7..d233adac4c 100644 --- a/src/datadog_api_client/v2/api/organizations_api.py +++ b/src/datadog_api_client/v2/api/organizations_api.py @@ -12,6 +12,7 @@ UnsetType, unset, ) +from datadog_api_client.v2.model.managed_orgs_response import ManagedOrgsResponse from datadog_api_client.v2.model.org_config_list_response import OrgConfigListResponse from datadog_api_client.v2.model.org_config_get_response import OrgConfigGetResponse from datadog_api_client.v2.model.org_config_write_request import OrgConfigWriteRequest @@ -66,6 +67,28 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_orgs_v2_endpoint = _Endpoint( + settings={ + "response_type": (ManagedOrgsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/org", + "operation_id": "list_orgs_v2", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_name": { + "openapi_types": (str,), + "attribute": "filter[name]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._update_org_config_endpoint = _Endpoint( settings={ "response_type": (OrgConfigGetResponse,), @@ -141,6 +164,25 @@ def list_org_configs( kwargs: Dict[str, Any] = {} return self._list_org_configs_endpoint.call_with_http_info(**kwargs) + def list_orgs_v2( + self, + *, + filter_name: Union[str, UnsetType] = unset, + ) -> ManagedOrgsResponse: + """List your managed organizations. + + Returns the current organization and its managed organizations in JSON:API format. + + :param filter_name: Filter managed organizations by name. + :type filter_name: str, optional + :rtype: ManagedOrgsResponse + """ + kwargs: Dict[str, Any] = {} + if filter_name is not unset: + kwargs["filter_name"] = filter_name + + return self._list_orgs_v2_endpoint.call_with_http_info(**kwargs) + def update_org_config( self, org_config_name: str, diff --git a/src/datadog_api_client/v2/api/users_api.py b/src/datadog_api_client/v2/api/users_api.py index 7f08f1aa8e..b815c2527a 100644 --- a/src/datadog_api_client/v2/api/users_api.py +++ b/src/datadog_api_client/v2/api/users_api.py @@ -13,6 +13,7 @@ get_attribute_from_path, UnsetType, unset, + UUID, ) from datadog_api_client.v2.model.user_invitations_response import UserInvitationsResponse from datadog_api_client.v2.model.user_invitations_request import UserInvitationsRequest @@ -56,6 +57,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_user_invitations_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/users/{user_id}/invitations", + "operation_id": "delete_user_invitations", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "user_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "user_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._disable_user_endpoint = _Endpoint( settings={ "response_type": None, @@ -280,6 +304,24 @@ def create_user( return self._create_user_endpoint.call_with_http_info(**kwargs) + def delete_user_invitations( + self, + user_id: UUID, + ) -> None: + """Delete a pending user's invitations. + + Cancel all pending invitations for a specified user. + Requires the ``user_access_invite`` permission. + + :param user_id: The UUID of the user whose pending invitations should be canceled. + :type user_id: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["user_id"] = user_id + + return self._delete_user_invitations_endpoint.call_with_http_info(**kwargs) + def disable_user( self, user_id: str, diff --git a/src/datadog_api_client/v2/model/managed_orgs_data.py b/src/datadog_api_client/v2/model/managed_orgs_data.py new file mode 100644 index 0000000000..edc0c70be2 --- /dev/null +++ b/src/datadog_api_client/v2/model/managed_orgs_data.py @@ -0,0 +1,55 @@ +# 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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.managed_orgs_relationships import ManagedOrgsRelationships + from datadog_api_client.v2.model.managed_orgs_type import ManagedOrgsType + + +class ManagedOrgsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.managed_orgs_relationships import ManagedOrgsRelationships + from datadog_api_client.v2.model.managed_orgs_type import ManagedOrgsType + + return { + "id": (UUID,), + "relationships": (ManagedOrgsRelationships,), + "type": (ManagedOrgsType,), + } + + attribute_map = { + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__(self_, id: UUID, relationships: ManagedOrgsRelationships, type: ManagedOrgsType, **kwargs): + """ + The managed organizations resource. + + :param id: The UUID of the current organization. + :type id: UUID + + :param relationships: Relationships of the managed organizations resource. + :type relationships: ManagedOrgsRelationships + + :param type: The resource type for managed organizations. + :type type: ManagedOrgsType + """ + super().__init__(kwargs) + + self_.id = id + self_.relationships = relationships + self_.type = type diff --git a/src/datadog_api_client/v2/model/managed_orgs_relationship_to_org.py b/src/datadog_api_client/v2/model/managed_orgs_relationship_to_org.py new file mode 100644 index 0000000000..4fca6becd4 --- /dev/null +++ b/src/datadog_api_client/v2/model/managed_orgs_relationship_to_org.py @@ -0,0 +1,40 @@ +# 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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.org_relationship_data import OrgRelationshipData + + +class ManagedOrgsRelationshipToOrg(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_relationship_data import OrgRelationshipData + + return { + "data": (OrgRelationshipData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OrgRelationshipData, **kwargs): + """ + Relationship to the current organization. + + :param data: Reference to an organization resource. + :type data: OrgRelationshipData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/managed_orgs_relationship_to_orgs.py b/src/datadog_api_client/v2/model/managed_orgs_relationship_to_orgs.py new file mode 100644 index 0000000000..90c3187e8b --- /dev/null +++ b/src/datadog_api_client/v2/model/managed_orgs_relationship_to_orgs.py @@ -0,0 +1,40 @@ +# 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 typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.org_relationship_data import OrgRelationshipData + + +class ManagedOrgsRelationshipToOrgs(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_relationship_data import OrgRelationshipData + + return { + "data": ([OrgRelationshipData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[OrgRelationshipData], **kwargs): + """ + Relationship to the managed organizations. + + :param data: List of managed organization references. + :type data: [OrgRelationshipData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/managed_orgs_relationships.py b/src/datadog_api_client/v2/model/managed_orgs_relationships.py new file mode 100644 index 0000000000..6a25bfdbf4 --- /dev/null +++ b/src/datadog_api_client/v2/model/managed_orgs_relationships.py @@ -0,0 +1,50 @@ +# 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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.managed_orgs_relationship_to_org import ManagedOrgsRelationshipToOrg + from datadog_api_client.v2.model.managed_orgs_relationship_to_orgs import ManagedOrgsRelationshipToOrgs + + +class ManagedOrgsRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.managed_orgs_relationship_to_org import ManagedOrgsRelationshipToOrg + from datadog_api_client.v2.model.managed_orgs_relationship_to_orgs import ManagedOrgsRelationshipToOrgs + + return { + "current_org": (ManagedOrgsRelationshipToOrg,), + "managed_orgs": (ManagedOrgsRelationshipToOrgs,), + } + + attribute_map = { + "current_org": "current_org", + "managed_orgs": "managed_orgs", + } + + def __init__( + self_, current_org: ManagedOrgsRelationshipToOrg, managed_orgs: ManagedOrgsRelationshipToOrgs, **kwargs + ): + """ + Relationships of the managed organizations resource. + + :param current_org: Relationship to the current organization. + :type current_org: ManagedOrgsRelationshipToOrg + + :param managed_orgs: Relationship to the managed organizations. + :type managed_orgs: ManagedOrgsRelationshipToOrgs + """ + super().__init__(kwargs) + + self_.current_org = current_org + self_.managed_orgs = managed_orgs diff --git a/src/datadog_api_client/v2/model/managed_orgs_response.py b/src/datadog_api_client/v2/model/managed_orgs_response.py new file mode 100644 index 0000000000..71578e288f --- /dev/null +++ b/src/datadog_api_client/v2/model/managed_orgs_response.py @@ -0,0 +1,48 @@ +# 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 typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.managed_orgs_data import ManagedOrgsData + from datadog_api_client.v2.model.org_data import OrgData + + +class ManagedOrgsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.managed_orgs_data import ManagedOrgsData + from datadog_api_client.v2.model.org_data import OrgData + + return { + "data": (ManagedOrgsData,), + "included": ([OrgData],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__(self_, data: ManagedOrgsData, included: List[OrgData], **kwargs): + """ + Response containing the current organization and its managed organizations. + + :param data: The managed organizations resource. + :type data: ManagedOrgsData + + :param included: Included organization resources. + :type included: [OrgData] + """ + super().__init__(kwargs) + + self_.data = data + self_.included = included diff --git a/src/datadog_api_client/v2/model/managed_orgs_type.py b/src/datadog_api_client/v2/model/managed_orgs_type.py new file mode 100644 index 0000000000..1416c7cb0f --- /dev/null +++ b/src/datadog_api_client/v2/model/managed_orgs_type.py @@ -0,0 +1,35 @@ +# 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 ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ManagedOrgsType(ModelSimple): + """ + The resource type for managed organizations. + + :param value: If omitted defaults to "managed_orgs". Must be one of ["managed_orgs"]. + :type value: str + """ + + allowed_values = { + "managed_orgs", + } + MANAGED_ORGS: ClassVar["ManagedOrgsType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ManagedOrgsType.MANAGED_ORGS = ManagedOrgsType("managed_orgs") diff --git a/src/datadog_api_client/v2/model/org_attributes.py b/src/datadog_api_client/v2/model/org_attributes.py new file mode 100644 index 0000000000..7780253859 --- /dev/null +++ b/src/datadog_api_client/v2/model/org_attributes.py @@ -0,0 +1,87 @@ +# 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 ( + ModelNormal, + cached_property, + datetime, +) + + +class OrgAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "description": (str,), + "disabled": (bool,), + "modified_at": (datetime,), + "name": (str,), + "public_id": (str,), + "sharing": (str,), + "url": (str,), + } + + attribute_map = { + "created_at": "created_at", + "description": "description", + "disabled": "disabled", + "modified_at": "modified_at", + "name": "name", + "public_id": "public_id", + "sharing": "sharing", + "url": "url", + } + + def __init__( + self_, + created_at: datetime, + description: str, + disabled: bool, + modified_at: datetime, + name: str, + public_id: str, + sharing: str, + url: str, + **kwargs, + ): + """ + Attributes of an organization. + + :param created_at: The creation timestamp of the organization. + :type created_at: datetime + + :param description: A description of the organization. + :type description: str + + :param disabled: Whether the organization is disabled. + :type disabled: bool + + :param modified_at: The last modification timestamp of the organization. + :type modified_at: datetime + + :param name: The name of the organization. + :type name: str + + :param public_id: The public identifier of the organization. + :type public_id: str + + :param sharing: The sharing setting of the organization. + :type sharing: str + + :param url: The URL of the organization. + :type url: str + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.description = description + self_.disabled = disabled + self_.modified_at = modified_at + self_.name = name + self_.public_id = public_id + self_.sharing = sharing + self_.url = url diff --git a/src/datadog_api_client/v2/model/org_data.py b/src/datadog_api_client/v2/model/org_data.py new file mode 100644 index 0000000000..eb9eb6d22f --- /dev/null +++ b/src/datadog_api_client/v2/model/org_data.py @@ -0,0 +1,55 @@ +# 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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.org_attributes import OrgAttributes + from datadog_api_client.v2.model.org_resource_type import OrgResourceType + + +class OrgData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_attributes import OrgAttributes + from datadog_api_client.v2.model.org_resource_type import OrgResourceType + + return { + "attributes": (OrgAttributes,), + "id": (UUID,), + "type": (OrgResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: OrgAttributes, id: UUID, type: OrgResourceType, **kwargs): + """ + An organization resource. + + :param attributes: Attributes of an organization. + :type attributes: OrgAttributes + + :param id: The UUID of the organization. + :type id: UUID + + :param type: The resource type for organizations. + :type type: OrgResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/org_relationship_data.py b/src/datadog_api_client/v2/model/org_relationship_data.py new file mode 100644 index 0000000000..772190899e --- /dev/null +++ b/src/datadog_api_client/v2/model/org_relationship_data.py @@ -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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.org_resource_type import OrgResourceType + + +class OrgRelationshipData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.org_resource_type import OrgResourceType + + return { + "id": (UUID,), + "type": (OrgResourceType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: UUID, type: OrgResourceType, **kwargs): + """ + Reference to an organization resource. + + :param id: The UUID of the organization. + :type id: UUID + + :param type: The resource type for organizations. + :type type: OrgResourceType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/org_resource_type.py b/src/datadog_api_client/v2/model/org_resource_type.py new file mode 100644 index 0000000000..e4d8c37c99 --- /dev/null +++ b/src/datadog_api_client/v2/model/org_resource_type.py @@ -0,0 +1,35 @@ +# 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 ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OrgResourceType(ModelSimple): + """ + The resource type for organizations. + + :param value: If omitted defaults to "orgs". Must be one of ["orgs"]. + :type value: str + """ + + allowed_values = { + "orgs", + } + ORGS: ClassVar["OrgResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OrgResourceType.ORGS = OrgResourceType("orgs") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index b3a7bf728c..98b753da9a 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3267,6 +3267,12 @@ from datadog_api_client.v2.model.maintenance_data_relationships_status_page_data import ( MaintenanceDataRelationshipsStatusPageData, ) +from datadog_api_client.v2.model.managed_orgs_data import ManagedOrgsData +from datadog_api_client.v2.model.managed_orgs_relationship_to_org import ManagedOrgsRelationshipToOrg +from datadog_api_client.v2.model.managed_orgs_relationship_to_orgs import ManagedOrgsRelationshipToOrgs +from datadog_api_client.v2.model.managed_orgs_relationships import ManagedOrgsRelationships +from datadog_api_client.v2.model.managed_orgs_response import ManagedOrgsResponse +from datadog_api_client.v2.model.managed_orgs_type import ManagedOrgsType from datadog_api_client.v2.model.member_team import MemberTeam from datadog_api_client.v2.model.member_team_type import MemberTeamType from datadog_api_client.v2.model.metadata import Metadata @@ -4413,6 +4419,7 @@ from datadog_api_client.v2.model.opsgenie_service_update_request import OpsgenieServiceUpdateRequest from datadog_api_client.v2.model.opsgenie_services_response import OpsgenieServicesResponse from datadog_api_client.v2.model.order_direction import OrderDirection +from datadog_api_client.v2.model.org_attributes import OrgAttributes from datadog_api_client.v2.model.org_config_get_response import OrgConfigGetResponse from datadog_api_client.v2.model.org_config_list_response import OrgConfigListResponse from datadog_api_client.v2.model.org_config_read import OrgConfigRead @@ -4443,6 +4450,9 @@ from datadog_api_client.v2.model.org_connection_user_relationship import OrgConnectionUserRelationship from datadog_api_client.v2.model.org_connection_user_relationship_data import OrgConnectionUserRelationshipData from datadog_api_client.v2.model.org_connection_user_relationship_data_type import OrgConnectionUserRelationshipDataType +from datadog_api_client.v2.model.org_data import OrgData +from datadog_api_client.v2.model.org_relationship_data import OrgRelationshipData +from datadog_api_client.v2.model.org_resource_type import OrgResourceType from datadog_api_client.v2.model.organization import Organization from datadog_api_client.v2.model.organization_attributes import OrganizationAttributes from datadog_api_client.v2.model.organizations_type import OrganizationsType @@ -9330,6 +9340,12 @@ "MaintenanceDataRelationshipsLastModifiedByUserData", "MaintenanceDataRelationshipsStatusPage", "MaintenanceDataRelationshipsStatusPageData", + "ManagedOrgsData", + "ManagedOrgsRelationshipToOrg", + "ManagedOrgsRelationshipToOrgs", + "ManagedOrgsRelationships", + "ManagedOrgsResponse", + "ManagedOrgsType", "MemberTeam", "MemberTeamType", "Metadata", @@ -9898,6 +9914,7 @@ "OpsgenieServiceUpdateRequest", "OpsgenieServicesResponse", "OrderDirection", + "OrgAttributes", "OrgConfigGetResponse", "OrgConfigListResponse", "OrgConfigRead", @@ -9928,6 +9945,9 @@ "OrgConnectionUserRelationship", "OrgConnectionUserRelationshipData", "OrgConnectionUserRelationshipDataType", + "OrgData", + "OrgRelationshipData", + "OrgResourceType", "Organization", "OrganizationAttributes", "OrganizationsType", diff --git a/tests/v2/features/organizations.feature b/tests/v2/features/organizations.feature index ddec7484e7..b5e870d0d9 100644 --- a/tests/v2/features/organizations.feature +++ b/tests/v2/features/organizations.feature @@ -41,6 +41,12 @@ Feature: Organizations When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/org-management + Scenario: List your managed organizations returns "OK" response + Given new "ListOrgsV2" request + When the request is sent + Then the response status is 200 OK + @team:DataDog/team-aaa-identity Scenario: Update a specific Org Config returns "Bad Request" response Given new "UpdateOrgConfig" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 02afc91a4b..0e7f9515ea 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3951,6 +3951,12 @@ "type": "safe" } }, + "ListOrgsV2": { + "tag": "Organizations", + "undo": { + "type": "safe" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { @@ -6543,6 +6549,12 @@ "type": "idempotent" } }, + "DeleteUserInvitations": { + "tag": "Users", + "undo": { + "type": "safe" + } + }, "ListUserOrganizations": { "tag": "Users", "undo": { diff --git a/tests/v2/features/users.feature b/tests/v2/features/users.feature index ce27d72998..3fc0a99938 100644 --- a/tests/v2/features/users.feature +++ b/tests/v2/features/users.feature @@ -25,6 +25,20 @@ Feature: Users And the response "data.attributes.disabled" is false And the response "data.attributes.service_account" is false + @generated @skip @team:DataDog/org-management + Scenario: Delete a pending user's invitations returns "Not found" response + Given new "DeleteUserInvitations" request + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not found + + @generated @skip @team:DataDog/org-management + Scenario: Delete a pending user's invitations returns "OK" response + Given new "DeleteUserInvitations" request + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/team-aaa-identity Scenario: Disable a user returns "Not found" response Given new "DisableUser" request