Skip to content
Open
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
154 changes: 154 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23190,6 +23190,91 @@ components:
required:
- data
type: object
CustomerOrgDisableRequest:
description: Request payload for disabling the authenticated customer organization.
properties:
data:
$ref: "#/components/schemas/CustomerOrgDisableRequestData"
required:
- data
type: object
CustomerOrgDisableRequestAttributes:
description: |-
Optional attributes for a customer org disable request. When supplied, `org_id` and
`org_uuid` must match the authenticated organization or the request is rejected.
properties:
org_id:
description: |-
Numeric Datadog organization identifier. If supplied, must match the
authenticated organization.
example: 123
format: int64
type: integer
org_uuid:
description: |-
Datadog organization UUID. If supplied, must match the authenticated
organization.
example: "abcdef01-2345-6789-abcd-ef0123456789"
type: string
type: object
CustomerOrgDisableRequestData:
description: Data object for a customer org disable request.
properties:
attributes:
$ref: "#/components/schemas/CustomerOrgDisableRequestAttributes"
id:
description: |-
Optional client-supplied identifier for the request. Useful for client-side
correlation; the server does not use this value.
example: "1"
type: string
type:
$ref: "#/components/schemas/CustomerOrgDisableType"
required:
- type
type: object
CustomerOrgDisableResponse:
description: Response describing the outcome of disabling the customer organization.
properties:
data:
$ref: "#/components/schemas/CustomerOrgDisableResponseData"
required:
- data
type: object
CustomerOrgDisableResponseAttributes:
description: Attributes describing the outcome of the disable action on the customer organization.
properties:
status:
description: Resulting lifecycle status of the organization after the disable action.
example: "disabled"
type: string
required:
- status
type: object
CustomerOrgDisableResponseData:
description: Data object returned after disabling the customer organization.
properties:
attributes:
$ref: "#/components/schemas/CustomerOrgDisableResponseAttributes"
id:
description: Identifier of the disabled organization.
example: "abcdef01-2345-6789-abcd-ef0123456789"
type: string
type:
$ref: "#/components/schemas/CustomerOrgDisableType"
required:
- type
- id
- attributes
type: object
CustomerOrgDisableType:
description: JSON:API resource type for a customer org disable action.
enum:
- customer_org_disable
example: "customer_org_disable"
type: string
x-enum-varnames:
- CUSTOMER_ORG_DISABLE
DORACustomTags:
description: A list of user-defined tags. The tags must follow the `key:value` pattern. Up to 100 may be added per event.
example:
Expand Down Expand Up @@ -107238,6 +107323,71 @@ paths:
operator: OR
permissions:
- user_app_keys
/api/v2/customer/org/disable:
post:
description: |-
Disable the Datadog organization associated with the authenticated user or API key.
The request body uses JSON:API format. If `org_id` or `org_uuid` are supplied, they
must match the authenticated org or the request is rejected. Successful calls disable
the org and return the resulting state from the downstream service. Requires the
`org_management` permission.
operationId: DisableCustomerOrg
requestBody:
content:
application/json:
examples:
default:
value:
data:
attributes:
org_id: 123
org_uuid: "abcdef01-2345-6789-abcd-ef0123456789"
id: "1"
type: "customer_org_disable"
schema:
$ref: "#/components/schemas/CustomerOrgDisableRequest"
required: true
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
status: "disabled"
id: "abcdef01-2345-6789-abcd-ef0123456789"
type: "customer_org_disable"
schema:
$ref: "#/components/schemas/CustomerOrgDisableResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Bad Request
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Unauthorized
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Forbidden
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
summary: Disable the authenticated customer organization
tags:
- Customer Org
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards:
delete:
description: Delete dashboards from an existing dashboard list.
Expand Down Expand Up @@ -158499,6 +158649,10 @@ tags:
- description: |-
The Containers API allows you to query container data for your organization. See the [Container Monitoring page](https://docs.datadoghq.com/containers/) for more information.
name: Containers
- description: |-
Programmatic management of a customer's own Datadog organization. Use this API to perform
self-service organization lifecycle actions such as disabling the authenticated org.
name: Customer Org
- description: |-
Search, send, or delete events for DORA Metrics to measure and improve your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) for more information.

Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ datadog\_api\_client.v2.api.csm\_threats\_api module
:members:
:show-inheritance:

datadog\_api\_client.v2.api.customer\_org\_api module
-----------------------------------------------------

.. automodule:: datadog_api_client.v2.api.customer_org_api
:members:
:show-inheritance:

datadog\_api\_client.v2.api.dashboard\_lists\_api module
--------------------------------------------------------

Expand Down
49 changes: 49 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9384,6 +9384,55 @@ datadog\_api\_client.v2.model.custom\_ruleset\_response module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.customer\_org\_disable\_request module
--------------------------------------------------------------------

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

datadog\_api\_client.v2.model.customer\_org\_disable\_request\_attributes module
--------------------------------------------------------------------------------

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

datadog\_api\_client.v2.model.customer\_org\_disable\_request\_data module
--------------------------------------------------------------------------

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

datadog\_api\_client.v2.model.customer\_org\_disable\_response module
---------------------------------------------------------------------

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

datadog\_api\_client.v2.model.customer\_org\_disable\_response\_attributes module
---------------------------------------------------------------------------------

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

datadog\_api\_client.v2.model.customer\_org\_disable\_response\_data module
---------------------------------------------------------------------------

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

datadog\_api\_client.v2.model.customer\_org\_disable\_type module
-----------------------------------------------------------------

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

datadog\_api\_client.v2.model.cvss module
-----------------------------------------

Expand Down
29 changes: 29 additions & 0 deletions examples/v2/customer-org/DisableCustomerOrg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Disable the authenticated customer organization returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.customer_org_api import CustomerOrgApi
from datadog_api_client.v2.model.customer_org_disable_request import CustomerOrgDisableRequest
from datadog_api_client.v2.model.customer_org_disable_request_attributes import CustomerOrgDisableRequestAttributes
from datadog_api_client.v2.model.customer_org_disable_request_data import CustomerOrgDisableRequestData
from datadog_api_client.v2.model.customer_org_disable_type import CustomerOrgDisableType

body = CustomerOrgDisableRequest(
data=CustomerOrgDisableRequestData(
attributes=CustomerOrgDisableRequestAttributes(
org_id=123,
org_uuid="abcdef01-2345-6789-abcd-ef0123456789",
),
id="1",
type=CustomerOrgDisableType.CUSTOMER_ORG_DISABLE,
),
)

configuration = Configuration()
configuration.unstable_operations["disable_customer_org"] = True
with ApiClient(configuration) as api_client:
api_instance = CustomerOrgApi(api_client)
response = api_instance.disable_customer_org(body=body)

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def __init__(
"v2.list_cost_tag_metadata": False,
"v2.list_cost_tag_metadata_metrics": False,
"v2.list_cost_tag_metadata_orchestrators": False,
"v2.disable_customer_org": False,
"v2.create_dashboard_secure_embed": False,
"v2.delete_dashboard_secure_embed": False,
"v2.get_dashboard_secure_embed": False,
Expand Down
63 changes: 63 additions & 0 deletions src/datadog_api_client/v2/api/customer_org_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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 Any, Dict

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.v2.model.customer_org_disable_response import CustomerOrgDisableResponse
from datadog_api_client.v2.model.customer_org_disable_request import CustomerOrgDisableRequest


class CustomerOrgApi:
"""
Programmatic management of a customer's own Datadog organization. Use this API to perform
self-service organization lifecycle actions such as disabling the authenticated org.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient(Configuration())
self.api_client = api_client

self._disable_customer_org_endpoint = _Endpoint(
settings={
"response_type": (CustomerOrgDisableResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/customer/org/disable",
"operation_id": "disable_customer_org",
"http_method": "POST",
"version": "v2",
},
params_map={
"body": {
"required": True,
"openapi_types": (CustomerOrgDisableRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

def disable_customer_org(
self,
body: CustomerOrgDisableRequest,
) -> CustomerOrgDisableResponse:
"""Disable the authenticated customer organization.

Disable the Datadog organization associated with the authenticated user or API key.
The request body uses JSON:API format. If ``org_id`` or ``org_uuid`` are supplied, they
must match the authenticated org or the request is rejected. Successful calls disable
the org and return the resulting state from the downstream service. Requires the
``org_management`` permission.

:type body: CustomerOrgDisableRequest
:rtype: CustomerOrgDisableResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["body"] = body

return self._disable_customer_org_endpoint.call_with_http_info(**kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from datadog_api_client.v2.api.confluent_cloud_api import ConfluentCloudApi
from datadog_api_client.v2.api.container_images_api import ContainerImagesApi
from datadog_api_client.v2.api.containers_api import ContainersApi
from datadog_api_client.v2.api.customer_org_api import CustomerOrgApi
from datadog_api_client.v2.api.dora_metrics_api import DORAMetricsApi
from datadog_api_client.v2.api.dashboard_lists_api import DashboardListsApi
from datadog_api_client.v2.api.dashboard_secure_embed_api import DashboardSecureEmbedApi
Expand Down Expand Up @@ -144,6 +145,7 @@
"ConfluentCloudApi",
"ContainerImagesApi",
"ContainersApi",
"CustomerOrgApi",
"DORAMetricsApi",
"DashboardListsApi",
"DashboardSecureEmbedApi",
Expand Down
Loading
Loading