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
19 changes: 19 additions & 0 deletions examples/v2/customer-org/DisableCustomerOrg.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Disable the authenticated customer organization returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.disable_customer_org".to_sym] = true
end
api_instance = DatadogAPIClient::V2::CustomerOrgAPI.new

body = DatadogAPIClient::V2::CustomerOrgDisableRequest.new({
data: DatadogAPIClient::V2::CustomerOrgDisableRequestData.new({
attributes: DatadogAPIClient::V2::CustomerOrgDisableRequestAttributes.new({
org_id: 123,
org_uuid: "abcdef01-2345-6789-abcd-ef0123456789",
}),
id: "1",
type: DatadogAPIClient::V2::CustomerOrgDisableType::CUSTOMER_ORG_DISABLE,
}),
})
p api_instance.disable_customer_org(body)
3 changes: 3 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,9 @@
"query" => "String",
"order_direction" => "OrderDirection",
},
"v2.DisableCustomerOrg" => {
"body" => "CustomerOrgDisableRequest",
},
"v2.DeleteDashboardListItems" => {
"dashboard_list_id" => "Integer",
"body" => "DashboardListDeleteItemsRequest",
Expand Down
23 changes: 23 additions & 0 deletions features/v2/customer_org.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@endpoint(customer-org) @endpoint(customer-org-v2)
Feature: Customer Org
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.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "CustomerOrg" API
And operation "DisableCustomerOrg" enabled
And new "DisableCustomerOrg" request
And body with value {"data": {"attributes": {"org_id": 123, "org_uuid": "abcdef01-2345-6789-abcd-ef0123456789"}, "id": "1", "type": "customer_org_disable"}}

@generated @skip @team:DataDog/governance-tooling-and-systems
Scenario: Disable the authenticated customer organization returns "Bad Request" response
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/governance-tooling-and-systems
Scenario: Disable the authenticated customer organization returns "OK" response
When the request is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,12 @@
"type": "idempotent"
}
},
"DisableCustomerOrg": {
"tag": "Customer Org",
"undo": {
"type": "unsafe"
}
},
"DeleteDashboardListItems": {
"tag": "Dashboard Lists",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def initialize
"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
8 changes: 8 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2412,6 +2412,13 @@ def overrides
"v2.custom_destination_update_request" => "CustomDestinationUpdateRequest",
"v2.custom_destination_update_request_attributes" => "CustomDestinationUpdateRequestAttributes",
"v2.custom_destination_update_request_definition" => "CustomDestinationUpdateRequestDefinition",
"v2.customer_org_disable_request" => "CustomerOrgDisableRequest",
"v2.customer_org_disable_request_attributes" => "CustomerOrgDisableRequestAttributes",
"v2.customer_org_disable_request_data" => "CustomerOrgDisableRequestData",
"v2.customer_org_disable_response" => "CustomerOrgDisableResponse",
"v2.customer_org_disable_response_attributes" => "CustomerOrgDisableResponseAttributes",
"v2.customer_org_disable_response_data" => "CustomerOrgDisableResponseData",
"v2.customer_org_disable_type" => "CustomerOrgDisableType",
"v2.custom_framework_control" => "CustomFrameworkControl",
"v2.custom_framework_data" => "CustomFrameworkData",
"v2.custom_framework_data_attributes" => "CustomFrameworkDataAttributes",
Expand Down Expand Up @@ -6794,6 +6801,7 @@ def overrides
"v2.csm_agents_api" => "CSMAgentsAPI",
"v2.csm_coverage_analysis_api" => "CSMCoverageAnalysisAPI",
"v2.csm_threats_api" => "CSMThreatsAPI",
"v2.customer_org_api" => "CustomerOrgAPI",
"v2.dashboard_lists_api" => "DashboardListsAPI",
"v2.dashboard_secure_embed_api" => "DashboardSecureEmbedAPI",
"v2.dashboards_api" => "DashboardsAPI",
Expand Down
103 changes: 103 additions & 0 deletions lib/datadog_api_client/v2/api/customer_org_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
=begin
#Datadog API V2 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator

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 2020-Present Datadog, Inc.

=end

require 'cgi'

module DatadogAPIClient::V2
class CustomerOrgAPI
attr_accessor :api_client

def initialize(api_client = DatadogAPIClient::APIClient.default)
@api_client = api_client
end

# Disable the authenticated customer organization.
#
# @see #disable_customer_org_with_http_info
def disable_customer_org(body, opts = {})
data, _status_code, _headers = disable_customer_org_with_http_info(body, opts)
data
end

# 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.
#
# @param body [CustomerOrgDisableRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(CustomerOrgDisableResponse, Integer, Hash)>] CustomerOrgDisableResponse data, response status code and response headers
def disable_customer_org_with_http_info(body, opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.disable_customer_org".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.disable_customer_org")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.disable_customer_org"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CustomerOrgAPI.disable_customer_org ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling CustomerOrgAPI.disable_customer_org"
end
# resource path
local_var_path = '/api/v2/customer/org/disable'

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

# return_type
return_type = opts[:debug_return_type] || 'CustomerOrgDisableResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :disable_customer_org,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomerOrgAPI#disable_customer_org\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
Loading
Loading