diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 82c52ea77c72..7131ce19a0c1 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -13177,13 +13177,16 @@ components: type: object SLOCorrectionCreateRequest: description: |- - An object that defines a correction to be applied to an SLO. + An object that defines a correction to be applied to one or more SLOs. properties: data: $ref: "#/components/schemas/SLOCorrectionCreateData" type: object SLOCorrectionCreateRequestAttributes: - description: The attribute object associated with the SLO correction to be created. + description: |- + The attribute object associated with the SLO correction to be created. + + Exactly one of `slo_id` or `slo_query` must be provided. properties: category: $ref: "#/components/schemas/SLOCorrectionCategory" @@ -13207,9 +13210,16 @@ components: example: FREQ=DAILY;INTERVAL=10;COUNT=5 type: string slo_id: - description: ID of the SLO that this correction applies to. + description: ID of the single SLO that this correction applies to. example: sloId type: string + slo_query: + description: |- + Query that matches the SLOs this correction applies to. + The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/) + and can filter SLOs by SLO tags. + example: "env:prod service:checkout" + type: string start: description: Starting time of the correction in epoch seconds. example: 1600000000 @@ -13220,7 +13230,6 @@ components: example: UTC type: string required: - - slo_id - start - category type: object @@ -13284,7 +13293,12 @@ components: nullable: true type: string slo_id: - description: ID of the SLO that this correction applies to. + description: ID of the single SLO that this correction applies to. + nullable: true + type: string + slo_query: + description: Query that matches the SLOs this correction applies to. + nullable: true type: string start: description: Starting time of the correction in epoch seconds. @@ -13356,6 +13370,13 @@ components: are `FREQ`, `INTERVAL`, `COUNT`, `UNTIL` and `BYDAY`. example: FREQ=DAILY;INTERVAL=10;COUNT=5 type: string + slo_query: + description: |- + Query that matches the SLOs this correction applies to. + The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/) + and can filter SLOs by SLO tags. + example: "env:prod service:checkout" + type: string start: description: Starting time of the correction in epoch seconds. example: 1600000000 @@ -37493,7 +37514,8 @@ paths: - slos_read post: description: |- - Create an SLO Correction. + Create an SLO correction. Use `slo_id` to apply the correction to a single SLO, or `slo_query` to apply the + correction to SLOs that match a query. Exactly one of `slo_id` or `slo_query` is required. operationId: CreateSLOCorrection requestBody: content: @@ -37510,6 +37532,17 @@ paths: start: 1600000000 timezone: UTC type: correction + slo_query: + value: + data: + attributes: + category: "Scheduled Maintenance" + description: "Planned maintenance window for checkout services." + end: 1600003600 + slo_query: "env:prod service:checkout" + start: 1600000000 + timezone: UTC + type: correction schema: $ref: "#/components/schemas/SLOCorrectionCreateRequest" description: Create an SLO Correction @@ -37669,6 +37702,17 @@ paths: start: 1600000000 timezone: UTC type: correction + slo_query: + value: + data: + attributes: + category: "Scheduled Maintenance" + description: "Updated correction for checkout services." + end: 1600003600 + slo_query: "env:prod service:checkout" + start: 1600000000 + timezone: UTC + type: correction schema: $ref: "#/components/schemas/SLOCorrectionUpdateRequest" description: The edited SLO correction object. diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index cf112d7eaa44..85c263148490 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -26647,6 +26647,100 @@ 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_uuid` + must match the authenticated organization or the request is rejected. + properties: + 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: + $ref: "#/components/schemas/CustomerOrgDisableStatus" + 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/CustomerOrgDisableResponseType" + required: + - type + - id + - attributes + type: object + CustomerOrgDisableResponseType: + description: JSON:API resource type for a customer org disable response. + enum: + - org_disable + example: "org_disable" + type: string + x-enum-varnames: + - ORG_DISABLE + CustomerOrgDisableStatus: + description: Resulting lifecycle status of the organization after the disable action. + enum: + - disabled + - pending_disable + example: "disabled" + type: string + x-enum-varnames: + - DISABLED + - PENDING_DISABLE + CustomerOrgDisableType: + description: JSON:API resource type for a customer org disable request. + 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: @@ -144869,6 +144963,81 @@ paths: permissions: - org_management - org_connections_write + /api/v2/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_uuid` is supplied, it 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_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: "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" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + 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/org_configs: get: description: Returns all Org Configs (name, description, and value). @@ -178361,6 +178530,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 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. diff --git a/cassettes/features/v1/service_level_objective_corrections/Create-an-SLO-correction-with-slo-query-returns-OK-response.frozen b/cassettes/features/v1/service_level_objective_corrections/Create-an-SLO-correction-with-slo-query-returns-OK-response.frozen new file mode 100644 index 000000000000..d4db7da28f63 --- /dev/null +++ b/cassettes/features/v1/service_level_objective_corrections/Create-an-SLO-correction-with-slo-query-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-05-27T20:45:22.423Z \ No newline at end of file diff --git a/cassettes/features/v1/service_level_objective_corrections/Create-an-SLO-correction-with-slo-query-returns-OK-response.yml b/cassettes/features/v1/service_level_objective_corrections/Create-an-SLO-correction-with-slo-query-returns-OK-response.yml new file mode 100644 index 000000000000..b2aa1d4411a4 --- /dev/null +++ b/cassettes/features/v1/service_level_objective_corrections/Create-an-SLO-correction-with-slo-query-returns-OK-response.yml @@ -0,0 +1,48 @@ +http_interactions: +- recorded_at: Wed, 27 May 2026 20:45:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"Scheduled Maintenance","description":"Test-Create_an_SLO_correction_with_slo_query_returns_OK_response-1779914722","end":1779918322,"slo_query":"env:prod + service:checkout","start":1779914722,"timezone":"UTC"},"type":"correction"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/slo/correction + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"correction","id":"fb3a5c0a-5a0c-11f1-8207-da7ad0902002","attributes":{"slo_id":null,"start":1779914722,"end":1779918322,"description":"Test-Create_an_SLO_correction_with_slo_query_returns_OK_response-1779914722","category":"Scheduled + Maintenance","timezone":"UTC","created_at":null,"modified_at":null,"rrule":null,"duration":null,"slo_query":"env:prod + service:checkout","creator":{"data":{"type":"users","id":"780cfef8-1736-4a4e-a826-b875b1cadcec","attributes":{"uuid":"780cfef8-1736-4a4e-a826-b875b1cadcec","handle":"blaise.vonohlen@datadoghq.com","email":"blaise.vonohlen@datadoghq.com","name":"Blaise + von Ohlen","icon":"https://secure.gravatar.com/avatar/c78d8282d57321884e8f77172229634f?s=48&d=retro"}}},"modifier":null}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:45:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v1/slo/correction/fb3a5c0a-5a0c-11f1-8207-da7ad0902002 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/service_level_objective_corrections/Update-an-SLO-correction-with-slo-query-returns-OK-response.frozen b/cassettes/features/v1/service_level_objective_corrections/Update-an-SLO-correction-with-slo-query-returns-OK-response.frozen new file mode 100644 index 000000000000..2772dc4740e0 --- /dev/null +++ b/cassettes/features/v1/service_level_objective_corrections/Update-an-SLO-correction-with-slo-query-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-03T15:43:01.600Z \ No newline at end of file diff --git a/cassettes/features/v1/service_level_objective_corrections/Update-an-SLO-correction-with-slo-query-returns-OK-response.yml b/cassettes/features/v1/service_level_objective_corrections/Update-an-SLO-correction-with-slo-query-returns-OK-response.yml new file mode 100644 index 000000000000..120d0b1d7b90 --- /dev/null +++ b/cassettes/features/v1/service_level_objective_corrections/Update-an-SLO-correction-with-slo-query-returns-OK-response.yml @@ -0,0 +1,77 @@ +http_interactions: +- recorded_at: Wed, 03 Jun 2026 15:43:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"Other","description":"Test Correction","end":1780504981,"slo_query":"env:prod + service:checkout","start":1780501381,"timezone":"UTC"},"type":"correction"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/slo/correction + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"correction","id":"e74cc4de-5f62-11f1-a69d-da7ad0902002","attributes":{"slo_id":null,"start":1780501381,"end":1780504981,"description":"Test + Correction","category":"Other","timezone":"UTC","created_at":null,"modified_at":null,"rrule":null,"duration":null,"slo_query":"env:prod + service:checkout","creator":{"data":{"type":"users","id":"780cfef8-1736-4a4e-a826-b875b1cadcec","attributes":{"uuid":"780cfef8-1736-4a4e-a826-b875b1cadcec","handle":"blaise.vonohlen@datadoghq.com","email":"blaise.vonohlen@datadoghq.com","name":"Blaise + von Ohlen","icon":"https://secure.gravatar.com/avatar/c78d8282d57321884e8f77172229634f?s=48&d=retro"}}},"modifier":null}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 03 Jun 2026 15:43:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"Scheduled Maintenance","description":"Test-Update_an_SLO_correction_with_slo_query_returns_OK_response-1780501381","end":1780504981,"slo_query":"env:staging + service:checkout","start":1780501381,"timezone":"UTC"},"type":"correction"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v1/slo/correction/e74cc4de-5f62-11f1-a69d-da7ad0902002 + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"correction","id":"e74cc4de-5f62-11f1-a69d-da7ad0902002","attributes":{"slo_id":null,"start":1780501381,"end":1780504981,"description":"Test-Update_an_SLO_correction_with_slo_query_returns_OK_response-1780501381","category":"Scheduled + Maintenance","timezone":"UTC","created_at":1780501381,"modified_at":1780501381,"rrule":null,"duration":null,"slo_query":"env:staging + service:checkout","creator":{"data":{"type":"users","id":"780cfef8-1736-4a4e-a826-b875b1cadcec","attributes":{"uuid":"780cfef8-1736-4a4e-a826-b875b1cadcec","handle":"blaise.vonohlen@datadoghq.com","email":"blaise.vonohlen@datadoghq.com","name":"Blaise + von Ohlen","icon":"https://secure.gravatar.com/avatar/c78d8282d57321884e8f77172229634f?s=48&d=retro"}}},"modifier":{"data":{"type":"users","id":"780cfef8-1736-4a4e-a826-b875b1cadcec","attributes":{"uuid":"780cfef8-1736-4a4e-a826-b875b1cadcec","handle":"blaise.vonohlen@datadoghq.com","email":"blaise.vonohlen@datadoghq.com","name":"Blaise + von Ohlen","icon":"https://secure.gravatar.com/avatar/c78d8282d57321884e8f77172229634f?s=48&d=retro"}}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 03 Jun 2026 15:43:01 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v1/slo/correction/e74cc4de-5f62-11f1-a69d-da7ad0902002 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v1/service-level-objective-corrections/CreateSLOCorrection_2888963657.rb b/examples/v1/service-level-objective-corrections/CreateSLOCorrection_2888963657.rb new file mode 100644 index 000000000000..dd9fba9ef0c4 --- /dev/null +++ b/examples/v1/service-level-objective-corrections/CreateSLOCorrection_2888963657.rb @@ -0,0 +1,19 @@ +# Create an SLO correction with slo_query returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new + +body = DatadogAPIClient::V1::SLOCorrectionCreateRequest.new({ + data: DatadogAPIClient::V1::SLOCorrectionCreateData.new({ + attributes: DatadogAPIClient::V1::SLOCorrectionCreateRequestAttributes.new({ + category: DatadogAPIClient::V1::SLOCorrectionCategory::SCHEDULED_MAINTENANCE, + description: "Example-Service-Level-Objective-Correction", + _end: (Time.now + 1 * 3600).to_i, + slo_query: "env:prod service:checkout", + start: Time.now.to_i, + timezone: "UTC", + }), + type: DatadogAPIClient::V1::SLOCorrectionType::CORRECTION, + }), +}) +p api_instance.create_slo_correction(body) diff --git a/examples/v1/service-level-objective-corrections/UpdateSLOCorrection_2949191256.rb b/examples/v1/service-level-objective-corrections/UpdateSLOCorrection_2949191256.rb new file mode 100644 index 000000000000..0637c5b9e5bd --- /dev/null +++ b/examples/v1/service-level-objective-corrections/UpdateSLOCorrection_2949191256.rb @@ -0,0 +1,22 @@ +# Update an SLO correction with slo_query returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new + +# there is a valid "correction_with_query" in the system +CORRECTION_WITH_QUERY_DATA_ID = ENV["CORRECTION_WITH_QUERY_DATA_ID"] + +body = DatadogAPIClient::V1::SLOCorrectionUpdateRequest.new({ + data: DatadogAPIClient::V1::SLOCorrectionUpdateData.new({ + attributes: DatadogAPIClient::V1::SLOCorrectionUpdateRequestAttributes.new({ + category: DatadogAPIClient::V1::SLOCorrectionCategory::SCHEDULED_MAINTENANCE, + description: "Example-Service-Level-Objective-Correction", + _end: (Time.now + 1 * 3600).to_i, + slo_query: "env:staging service:checkout", + start: Time.now.to_i, + timezone: "UTC", + }), + type: DatadogAPIClient::V1::SLOCorrectionType::CORRECTION, + }), +}) +p api_instance.update_slo_correction(CORRECTION_WITH_QUERY_DATA_ID, body) diff --git a/examples/v2/customer-org/DisableCustomerOrg.rb b/examples/v2/customer-org/DisableCustomerOrg.rb new file mode 100644 index 000000000000..196a8b82b428 --- /dev/null +++ b/examples/v2/customer-org/DisableCustomerOrg.rb @@ -0,0 +1,18 @@ +# 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_uuid: "abcdef01-2345-6789-abcd-ef0123456789", + }), + id: "1", + type: DatadogAPIClient::V2::CustomerOrgDisableType::CUSTOMER_ORG_DISABLE, + }), +}) +p api_instance.disable_customer_org(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 695810922cfc..403725296b92 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4177,6 +4177,9 @@ "v2.UploadIdPMetadata" => { "idp_file" => "File", }, + "v2.DisableCustomerOrg" => { + "body" => "CustomerOrgDisableRequest", + }, "v2.ListOrgConnections" => { "sink_org_id" => "String", "source_org_id" => "String", diff --git a/features/v1/given.json b/features/v1/given.json index 4415a28bc00c..3c1540f6faa5 100644 --- a/features/v1/given.json +++ b/features/v1/given.json @@ -234,6 +234,18 @@ "tag": "Service Level Objective Corrections", "operationId": "CreateSLOCorrection" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"slo_query\": \"env:prod service:checkout\",\n \"start\": {{ timestamp(\"now\") }},\n \"end\": {{ timestamp(\"now + 1h\") }},\n \"category\": \"Other\",\n \"timezone\": \"UTC\",\n \"description\": \"Test Correction\"\n },\n \"type\": \"correction\"\n }\n}" + } + ], + "step": "there is a valid \"correction_with_query\" in the system", + "key": "correction_with_query", + "tag": "Service Level Objective Corrections", + "operationId": "CreateSLOCorrection" + }, { "parameters": [ { diff --git a/features/v1/service_level_objective_corrections.feature b/features/v1/service_level_objective_corrections.feature index d301d8e6764f..5b89ea6df2d9 100644 --- a/features/v1/service_level_objective_corrections.feature +++ b/features/v1/service_level_objective_corrections.feature @@ -49,6 +49,16 @@ Feature: Service Level Objective Corrections And the response "data.type" is equal to "correction" And the response "data.attributes.rrule" is equal to "FREQ=DAILY;INTERVAL=10;COUNT=5" + @team:DataDog/slo-app + Scenario: Create an SLO correction with slo_query returns "OK" response + Given new "CreateSLOCorrection" request + And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "description": "{{ unique }}", "end": {{ timestamp("now + 1h") }}, "slo_query": "env:prod service:checkout", "start": {{ timestamp("now") }}, "timezone": "UTC"}, "type": "correction"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "correction" + And the response "data.attributes.category" is equal to "Scheduled Maintenance" + And the response "data.attributes.slo_query" is equal to "env:prod service:checkout" + @generated @skip @team:DataDog/slo-app Scenario: Delete an SLO correction returns "Not found" response Given new "DeleteSLOCorrection" request @@ -114,7 +124,7 @@ Feature: Service Level Objective Corrections Scenario: Update an SLO correction returns "Not Found" response Given new "UpdateSLOCorrection" request And request contains "slo_correction_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "duration": 3600, "end": 1600000000, "rrule": "FREQ=DAILY;INTERVAL=10;COUNT=5", "start": 1600000000, "timezone": "UTC"}, "type": "correction"}} + And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "duration": 3600, "end": 1600000000, "rrule": "FREQ=DAILY;INTERVAL=10;COUNT=5", "slo_query": "env:prod service:checkout", "start": 1600000000, "timezone": "UTC"}, "type": "correction"}} When the request is sent Then the response status is 404 Not Found @@ -130,3 +140,14 @@ Feature: Service Level Objective Corrections And the response "data.id" has the same value as "correction.data.id" And the response "data.attributes.slo_id" has the same value as "correction.data.attributes.slo_id" And the response "data.attributes.category" is equal to "Deployment" + + @team:DataDog/slo-app + Scenario: Update an SLO correction with slo_query returns "OK" response + Given there is a valid "correction_with_query" in the system + And new "UpdateSLOCorrection" request + And request contains "slo_correction_id" parameter from "correction_with_query.data.id" + And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "description": "{{ unique }}", "end": {{ timestamp("now + 1h") }}, "slo_query": "env:staging service:checkout", "start": {{ timestamp("now") }}, "timezone": "UTC"}, "type": "correction"}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "correction_with_query.data.id" + And the response "data.attributes.slo_query" is equal to "env:staging service:checkout" diff --git a/features/v2/customer_org.feature b/features/v2/customer_org.feature new file mode 100644 index 000000000000..319625f6d0bd --- /dev/null +++ b/features/v2/customer_org.feature @@ -0,0 +1,23 @@ +@endpoint(customer-org) @endpoint(customer-org-v2) +Feature: Customer Org + Programmatic management of a customer's 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_uuid": "abcdef01-2345-6789-abcd-ef0123456789"}, "id": "1", "type": "customer_org_disable"}} + + @generated @skip @team:DataDog/org-management + 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/org-management + Scenario: Disable the authenticated customer organization returns "OK" response + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index f582e0e3de86..a2ff6ce184cb 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5202,6 +5202,12 @@ "type": "safe" } }, + "DisableCustomerOrg": { + "tag": "Customer Org", + "undo": { + "type": "unsafe" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index e72c6648bef5..c22dd8749e04 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -540,6 +540,7 @@ def initialize "v2.get_scopes_restriction": false, "v2.register_o_auth_client": false, "v2.upsert_scopes_restriction": false, + "v2.disable_customer_org": false, "v2.bulk_update_org_group_memberships": false, "v2.create_org_group": false, "v2.create_org_group_policy": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b7831f1e2f41..c1dbc42206b8 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2582,6 +2582,15 @@ 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_response_type" => "CustomerOrgDisableResponseType", + "v2.customer_org_disable_status" => "CustomerOrgDisableStatus", + "v2.customer_org_disable_type" => "CustomerOrgDisableType", "v2.custom_framework_control" => "CustomFrameworkControl", "v2.custom_framework_data" => "CustomFrameworkData", "v2.custom_framework_data_attributes" => "CustomFrameworkDataAttributes", @@ -7390,6 +7399,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", diff --git a/lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb b/lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb index 01e9acc7f899..eaac1f77baab 100644 --- a/lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb +++ b/lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb @@ -33,7 +33,8 @@ def create_slo_correction(body, opts = {}) # Create an SLO correction. # - # Create an SLO Correction. + # Create an SLO correction. Use `slo_id` to apply the correction to a single SLO, or `slo_query` to apply the + # correction to SLOs that match a query. Exactly one of `slo_id` or `slo_query` is required. # # @param body [SLOCorrectionCreateRequest] Create an SLO Correction # @param opts [Hash] the optional parameters diff --git a/lib/datadog_api_client/v1/models/slo_correction_create_data.rb b/lib/datadog_api_client/v1/models/slo_correction_create_data.rb index 697d4d3f4a57..635df8b71137 100644 --- a/lib/datadog_api_client/v1/models/slo_correction_create_data.rb +++ b/lib/datadog_api_client/v1/models/slo_correction_create_data.rb @@ -22,6 +22,8 @@ class SLOCorrectionCreateData include BaseGenericModel # The attribute object associated with the SLO correction to be created. + # + # Exactly one of `slo_id` or `slo_query` must be provided. attr_accessor :attributes # SLO correction resource type. diff --git a/lib/datadog_api_client/v1/models/slo_correction_create_request.rb b/lib/datadog_api_client/v1/models/slo_correction_create_request.rb index c5e0d8e0aa81..c575f346f36a 100644 --- a/lib/datadog_api_client/v1/models/slo_correction_create_request.rb +++ b/lib/datadog_api_client/v1/models/slo_correction_create_request.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V1 - # An object that defines a correction to be applied to an SLO. + # An object that defines a correction to be applied to one or more SLOs. class SLOCorrectionCreateRequest include BaseGenericModel diff --git a/lib/datadog_api_client/v1/models/slo_correction_create_request_attributes.rb b/lib/datadog_api_client/v1/models/slo_correction_create_request_attributes.rb index efd21a9fe3a5..0320b499e768 100644 --- a/lib/datadog_api_client/v1/models/slo_correction_create_request_attributes.rb +++ b/lib/datadog_api_client/v1/models/slo_correction_create_request_attributes.rb @@ -18,6 +18,8 @@ module DatadogAPIClient::V1 # The attribute object associated with the SLO correction to be created. + # + # Exactly one of `slo_id` or `slo_query` must be provided. class SLOCorrectionCreateRequestAttributes include BaseGenericModel @@ -37,8 +39,13 @@ class SLOCorrectionCreateRequestAttributes # are `FREQ`, `INTERVAL`, `COUNT`, `UNTIL` and `BYDAY`. attr_accessor :rrule - # ID of the SLO that this correction applies to. - attr_reader :slo_id + # ID of the single SLO that this correction applies to. + attr_accessor :slo_id + + # Query that matches the SLOs this correction applies to. + # The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/) + # and can filter SLOs by SLO tags. + attr_accessor :slo_query # Starting time of the correction in epoch seconds. attr_reader :start @@ -58,6 +65,7 @@ def self.attribute_map :'_end' => :'end', :'rrule' => :'rrule', :'slo_id' => :'slo_id', + :'slo_query' => :'slo_query', :'start' => :'start', :'timezone' => :'timezone' } @@ -73,6 +81,7 @@ def self.openapi_types :'_end' => :'Integer', :'rrule' => :'String', :'slo_id' => :'String', + :'slo_query' => :'String', :'start' => :'Integer', :'timezone' => :'String' } @@ -120,6 +129,10 @@ def initialize(attributes = {}) self.slo_id = attributes[:'slo_id'] end + if attributes.key?(:'slo_query') + self.slo_query = attributes[:'slo_query'] + end + if attributes.key?(:'start') self.start = attributes[:'start'] end @@ -134,7 +147,6 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @category.nil? - return false if @slo_id.nil? return false if @start.nil? true end @@ -149,16 +161,6 @@ def category=(category) @category = category end - # Custom attribute writer method with validation - # @param slo_id [Object] Object to be assigned - # @!visibility private - def slo_id=(slo_id) - if slo_id.nil? - fail ArgumentError, 'invalid value for "slo_id", slo_id cannot be nil.' - end - @slo_id = slo_id - end - # Custom attribute writer method with validation # @param start [Object] Object to be assigned # @!visibility private @@ -201,6 +203,7 @@ def ==(o) _end == o._end && rrule == o.rrule && slo_id == o.slo_id && + slo_query == o.slo_query && start == o.start && timezone == o.timezone && additional_properties == o.additional_properties @@ -210,7 +213,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [category, description, duration, _end, rrule, slo_id, start, timezone, additional_properties].hash + [category, description, duration, _end, rrule, slo_id, slo_query, start, timezone, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/slo_correction_response_attributes.rb b/lib/datadog_api_client/v1/models/slo_correction_response_attributes.rb index ae601255889f..7b5602775eaf 100644 --- a/lib/datadog_api_client/v1/models/slo_correction_response_attributes.rb +++ b/lib/datadog_api_client/v1/models/slo_correction_response_attributes.rb @@ -49,9 +49,12 @@ class SLOCorrectionResponseAttributes # are `FREQ`, `INTERVAL`, `COUNT`, `UNTIL` and `BYDAY`. attr_accessor :rrule - # ID of the SLO that this correction applies to. + # ID of the single SLO that this correction applies to. attr_accessor :slo_id + # Query that matches the SLOs this correction applies to. + attr_accessor :slo_query + # Starting time of the correction in epoch seconds. attr_accessor :start @@ -74,6 +77,7 @@ def self.attribute_map :'modifier' => :'modifier', :'rrule' => :'rrule', :'slo_id' => :'slo_id', + :'slo_query' => :'slo_query', :'start' => :'start', :'timezone' => :'timezone' } @@ -93,6 +97,7 @@ def self.openapi_types :'modifier' => :'SLOCorrectionResponseAttributesModifier', :'rrule' => :'String', :'slo_id' => :'String', + :'slo_query' => :'String', :'start' => :'Integer', :'timezone' => :'String' } @@ -108,6 +113,8 @@ def self.openapi_nullable :'modified_at', :'modifier', :'rrule', + :'slo_id', + :'slo_query', ]) end @@ -169,6 +176,10 @@ def initialize(attributes = {}) self.slo_id = attributes[:'slo_id'] end + if attributes.key?(:'slo_query') + self.slo_query = attributes[:'slo_query'] + end + if attributes.key?(:'start') self.start = attributes[:'start'] end @@ -214,6 +225,7 @@ def ==(o) modifier == o.modifier && rrule == o.rrule && slo_id == o.slo_id && + slo_query == o.slo_query && start == o.start && timezone == o.timezone && additional_properties == o.additional_properties @@ -223,7 +235,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [category, created_at, creator, description, duration, _end, modified_at, modifier, rrule, slo_id, start, timezone, additional_properties].hash + [category, created_at, creator, description, duration, _end, modified_at, modifier, rrule, slo_id, slo_query, start, timezone, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/slo_correction_update_request_attributes.rb b/lib/datadog_api_client/v1/models/slo_correction_update_request_attributes.rb index 3beecde9f196..236cc61af40d 100644 --- a/lib/datadog_api_client/v1/models/slo_correction_update_request_attributes.rb +++ b/lib/datadog_api_client/v1/models/slo_correction_update_request_attributes.rb @@ -37,6 +37,11 @@ class SLOCorrectionUpdateRequestAttributes # are `FREQ`, `INTERVAL`, `COUNT`, `UNTIL` and `BYDAY`. attr_accessor :rrule + # Query that matches the SLOs this correction applies to. + # The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/) + # and can filter SLOs by SLO tags. + attr_accessor :slo_query + # Starting time of the correction in epoch seconds. attr_accessor :start @@ -54,6 +59,7 @@ def self.attribute_map :'duration' => :'duration', :'_end' => :'end', :'rrule' => :'rrule', + :'slo_query' => :'slo_query', :'start' => :'start', :'timezone' => :'timezone' } @@ -68,6 +74,7 @@ def self.openapi_types :'duration' => :'Integer', :'_end' => :'Integer', :'rrule' => :'String', + :'slo_query' => :'String', :'start' => :'Integer', :'timezone' => :'String' } @@ -111,6 +118,10 @@ def initialize(attributes = {}) self.rrule = attributes[:'rrule'] end + if attributes.key?(:'slo_query') + self.slo_query = attributes[:'slo_query'] + end + if attributes.key?(:'start') self.start = attributes[:'start'] end @@ -151,6 +162,7 @@ def ==(o) duration == o.duration && _end == o._end && rrule == o.rrule && + slo_query == o.slo_query && start == o.start && timezone == o.timezone && additional_properties == o.additional_properties @@ -160,7 +172,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [category, description, duration, _end, rrule, start, timezone, additional_properties].hash + [category, description, duration, _end, rrule, slo_query, start, timezone, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/api/customer_org_api.rb b/lib/datadog_api_client/v2/api/customer_org_api.rb new file mode 100644 index 000000000000..afb417166475 --- /dev/null +++ b/lib/datadog_api_client/v2/api/customer_org_api.rb @@ -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_uuid` is supplied, it 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/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, :AuthZ] + + 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 diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_request.rb b/lib/datadog_api_client/v2/models/customer_org_disable_request.rb new file mode 100644 index 000000000000..d34e53cb35d1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_request.rb @@ -0,0 +1,123 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request payload for disabling the authenticated customer organization. + class CustomerOrgDisableRequest + include BaseGenericModel + + # Data object for a customer org disable request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomerOrgDisableRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomerOrgDisableRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_request_attributes.rb b/lib/datadog_api_client/v2/models/customer_org_disable_request_attributes.rb new file mode 100644 index 000000000000..17de4b2a317b --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_request_attributes.rb @@ -0,0 +1,107 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Optional attributes for a customer org disable request. When supplied, `org_uuid` + # must match the authenticated organization or the request is rejected. + class CustomerOrgDisableRequestAttributes + include BaseGenericModel + + # Datadog organization UUID. If supplied, must match the authenticated + # organization. + attr_accessor :org_uuid + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'org_uuid' => :'org_uuid' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'org_uuid' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomerOrgDisableRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'org_uuid') + self.org_uuid = attributes[:'org_uuid'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + org_uuid == o.org_uuid && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [org_uuid, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_request_data.rb b/lib/datadog_api_client/v2/models/customer_org_disable_request_data.rb new file mode 100644 index 000000000000..0e7deaf4833d --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_request_data.rb @@ -0,0 +1,145 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for a customer org disable request. + class CustomerOrgDisableRequestData + include BaseGenericModel + + # Optional attributes for a customer org disable request. When supplied, `org_uuid` + # must match the authenticated organization or the request is rejected. + attr_accessor :attributes + + # Optional client-supplied identifier for the request. Useful for client-side + # correlation; the server does not use this value. + attr_accessor :id + + # JSON:API resource type for a customer org disable request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CustomerOrgDisableRequestAttributes', + :'id' => :'String', + :'type' => :'CustomerOrgDisableType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomerOrgDisableRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_response.rb b/lib/datadog_api_client/v2/models/customer_org_disable_response.rb new file mode 100644 index 000000000000..ea2536313794 --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_response.rb @@ -0,0 +1,123 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response describing the outcome of disabling the customer organization. + class CustomerOrgDisableResponse + include BaseGenericModel + + # Data object returned after disabling the customer organization. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomerOrgDisableResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomerOrgDisableResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_response_attributes.rb b/lib/datadog_api_client/v2/models/customer_org_disable_response_attributes.rb new file mode 100644 index 000000000000..bb838a2ec3b4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_response_attributes.rb @@ -0,0 +1,123 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes describing the outcome of the disable action on the customer organization. + class CustomerOrgDisableResponseAttributes + include BaseGenericModel + + # Resulting lifecycle status of the organization after the disable action. + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'status' => :'CustomerOrgDisableStatus' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomerOrgDisableResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_response_data.rb b/lib/datadog_api_client/v2/models/customer_org_disable_response_data.rb new file mode 100644 index 000000000000..20a2641bb997 --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_response_data.rb @@ -0,0 +1,165 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object returned after disabling the customer organization. + class CustomerOrgDisableResponseData + include BaseGenericModel + + # Attributes describing the outcome of the disable action on the customer organization. + attr_reader :attributes + + # Identifier of the disabled organization. + attr_reader :id + + # JSON:API resource type for a customer org disable response. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CustomerOrgDisableResponseAttributes', + :'id' => :'String', + :'type' => :'CustomerOrgDisableResponseType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomerOrgDisableResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_response_type.rb b/lib/datadog_api_client/v2/models/customer_org_disable_response_type.rb new file mode 100644 index 000000000000..682d9010c891 --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_response_type.rb @@ -0,0 +1,26 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for a customer org disable response. + class CustomerOrgDisableResponseType + include BaseEnumModel + + ORG_DISABLE = "org_disable".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_status.rb b/lib/datadog_api_client/v2/models/customer_org_disable_status.rb new file mode 100644 index 000000000000..1ac18f34cde6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_status.rb @@ -0,0 +1,27 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Resulting lifecycle status of the organization after the disable action. + class CustomerOrgDisableStatus + include BaseEnumModel + + DISABLED = "disabled".freeze + PENDING_DISABLE = "pending_disable".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/customer_org_disable_type.rb b/lib/datadog_api_client/v2/models/customer_org_disable_type.rb new file mode 100644 index 000000000000..bf633e1ae3fc --- /dev/null +++ b/lib/datadog_api_client/v2/models/customer_org_disable_type.rb @@ -0,0 +1,26 @@ +=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 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for a customer org disable request. + class CustomerOrgDisableType + include BaseEnumModel + + CUSTOMER_ORG_DISABLE = "customer_org_disable".freeze + end +end