From 6ea4b26a4a73db6f1c9bd83ad7bbdf5f84d663df Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 5 Dec 2023 19:41:55 +0000 Subject: [PATCH] Regenerate client from commit 334a5ac9 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 288 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 70 +++++ .../v2/okta-integration/CreateOktaAccount.py | 31 ++ .../v2/okta-integration/DeleteOktaAccount.py | 13 + .../v2/okta-integration/GetOktaAccount.py | 19 ++ .../v2/okta-integration/ListOktaAccounts.py | 13 + .../v2/okta-integration/UpdateOktaAccount.py | 33 ++ .../v2/api/okta_integration_api.py | 215 +++++++++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../v2/model/okta_account.py | 59 ++++ .../v2/model/okta_account_attributes.py | 78 +++++ .../v2/model/okta_account_request.py | 40 +++ .../v2/model/okta_account_response.py | 42 +++ .../v2/model/okta_account_response_data.py | 54 ++++ .../v2/model/okta_account_type.py | 35 +++ .../v2/model/okta_account_update_request.py | 53 ++++ .../okta_account_update_request_attributes.py | 71 +++++ .../model/okta_account_update_request_data.py | 58 ++++ .../v2/model/okta_accounts_response.py | 42 +++ src/datadog_api_client/v2/models/__init__.py | 20 ++ ...dd_okta_account_returns_ok_response.frozen | 1 + ..._add_okta_account_returns_ok_response.yaml | 38 +++ ...et_okta_account_returns_ok_response.frozen | 1 + ..._get_okta_account_returns_ok_response.yaml | 56 ++++ ...t_okta_accounts_returns_ok_response.frozen | 1 + ...ist_okta_accounts_returns_ok_response.yaml | 56 ++++ ...te_okta_account_returns_ok_response.frozen | 1 + ...date_okta_account_returns_ok_response.yaml | 58 ++++ tests/v2/features/given.json | 12 + tests/v2/features/okta_integration.feature | 117 +++++++ tests/v2/features/undo.json | 37 +++ 33 files changed, 1625 insertions(+), 4 deletions(-) create mode 100644 examples/v2/okta-integration/CreateOktaAccount.py create mode 100644 examples/v2/okta-integration/DeleteOktaAccount.py create mode 100644 examples/v2/okta-integration/GetOktaAccount.py create mode 100644 examples/v2/okta-integration/ListOktaAccounts.py create mode 100644 examples/v2/okta-integration/UpdateOktaAccount.py create mode 100644 src/datadog_api_client/v2/api/okta_integration_api.py create mode 100644 src/datadog_api_client/v2/model/okta_account.py create mode 100644 src/datadog_api_client/v2/model/okta_account_attributes.py create mode 100644 src/datadog_api_client/v2/model/okta_account_request.py create mode 100644 src/datadog_api_client/v2/model/okta_account_response.py create mode 100644 src/datadog_api_client/v2/model/okta_account_response_data.py create mode 100644 src/datadog_api_client/v2/model/okta_account_type.py create mode 100644 src/datadog_api_client/v2/model/okta_account_update_request.py create mode 100644 src/datadog_api_client/v2/model/okta_account_update_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/okta_account_update_request_data.py create mode 100644 src/datadog_api_client/v2/model/okta_accounts_response.py create mode 100644 tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.yaml create mode 100644 tests/v2/features/okta_integration.feature diff --git a/.apigentools-info b/.apigentools-info index 45ffad40a6..8dc1f4cc99 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-12-05 09:51:16.969824", - "spec_repo_commit": "60646909" + "regenerated": "2023-12-05 19:41:02.582570", + "spec_repo_commit": "334a5ac9" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-12-05 09:51:16.984197", - "spec_repo_commit": "60646909" + "regenerated": "2023-12-05 19:41:02.608203", + "spec_repo_commit": "334a5ac9" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6c41845209..f30f514b62 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -11302,6 +11302,141 @@ components: - id - type type: object + OktaAccount: + description: Schema for an Okta account. + properties: + attributes: + $ref: '#/components/schemas/OktaAccountAttributes' + id: + description: The ID of the Okta account, a UUID hash of the account name. + example: f749daaf-682e-4208-a38d-c9b43162c609 + type: string + type: + $ref: '#/components/schemas/OktaAccountType' + required: + - attributes + - type + type: object + OktaAccountAttributes: + description: Attributes object for an Okta account. + properties: + api_key: + description: The API key of the Okta account. + type: string + writeOnly: true + auth_method: + description: The authorization method for an Okta account. + example: oauth + type: string + client_id: + description: The Client ID of an Okta app integration. + type: string + client_secret: + description: The client secret of an Okta app integration. + type: string + writeOnly: true + domain: + description: The domain of the Okta account. + example: https://example.okta.com/ + type: string + name: + description: The name of the Okta account. + example: Okta-Prod + type: string + required: + - auth_method + - domain + - name + type: object + OktaAccountRequest: + description: Request object for an Okta account. + properties: + data: + $ref: '#/components/schemas/OktaAccount' + required: + - data + type: object + OktaAccountResponse: + description: Response object for an Okta account. + properties: + data: + $ref: '#/components/schemas/OktaAccount' + type: object + OktaAccountResponseData: + description: Data object of an Okta account + properties: + attributes: + $ref: '#/components/schemas/OktaAccountAttributes' + id: + description: The ID of the Okta account, a UUID hash of the account name. + example: f749daaf-682e-4208-a38d-c9b43162c609 + type: string + type: + $ref: '#/components/schemas/OktaAccountType' + required: + - attributes + - id + - type + type: object + OktaAccountType: + default: okta-accounts + description: Account type for an Okta account. + enum: + - okta-accounts + example: okta-accounts + type: string + x-enum-varnames: + - OKTA_ACCOUNTS + OktaAccountUpdateRequest: + description: Payload schema when updating an Okta account. + properties: + data: + $ref: '#/components/schemas/OktaAccountUpdateRequestData' + required: + - data + type: object + OktaAccountUpdateRequestAttributes: + description: Attributes object for updating an Okta account. + properties: + api_key: + description: The API key of the Okta account. + type: string + writeOnly: true + auth_method: + description: The authorization method for an Okta account. + example: oauth + type: string + client_id: + description: The Client ID of an Okta app integration. + type: string + client_secret: + description: The client secret of an Okta app integration. + type: string + writeOnly: true + domain: + description: The domain associated with an Okta account. + example: https://dev-test.okta.com/ + type: string + required: + - auth_method + - domain + type: object + OktaAccountUpdateRequestData: + description: Data object for updating an Okta account. + properties: + attributes: + $ref: '#/components/schemas/OktaAccountUpdateRequestAttributes' + type: + $ref: '#/components/schemas/OktaAccountType' + OktaAccountsResponse: + description: The expected response schema when getting Okta accounts. + properties: + data: + description: List of Okta accounts. + items: + $ref: '#/components/schemas/OktaAccountResponseData' + type: array + type: object OnDemandConcurrencyCap: description: On-demand concurrency cap. properties: @@ -23835,6 +23970,156 @@ paths: tags: - Fastly Integration x-codegen-request-body-name: body + /api/v2/integrations/okta/accounts: + get: + description: List Okta accounts. + operationId: ListOktaAccounts + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OktaAccountsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List Okta accounts + tags: + - Okta Integration + post: + description: Create an Okta account. + operationId: CreateOktaAccount + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OktaAccountRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/OktaAccountResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Add Okta account + tags: + - Okta Integration + x-codegen-request-body-name: body + /api/v2/integrations/okta/accounts/{account_id}: + delete: + description: Delete an Okta account. + operationId: DeleteOktaAccount + parameters: + - description: None + in: path + name: account_id + required: true + schema: + type: string + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete Okta account + tags: + - Okta Integration + get: + description: Get an Okta account. + operationId: GetOktaAccount + parameters: + - description: None + in: path + name: account_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OktaAccountResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get Okta account + tags: + - Okta Integration + patch: + description: Update an Okta account. + operationId: UpdateOktaAccount + parameters: + - description: None + in: path + name: account_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OktaAccountUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OktaAccountResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update Okta account + tags: + - Okta Integration + x-codegen-request-body-name: body /api/v2/ip_allowlist: get: description: Returns the IP allowlist and its enabled or disabled state. @@ -31540,6 +31825,9 @@ tags: description: Find out more at url: https://docs.datadoghq.com/monitors/create/types/ name: Monitors +- description: Configure your Datadog Okta integration directly through the Datadog + API. + name: Okta Integration - description: 'Configure your [Datadog Opsgenie integration](https://docs.datadoghq.com/integrations/opsgenie/) directly through the Datadog API.' diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index f2f23add9f..c229e6e70b 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -183,6 +183,13 @@ monitors\_api :members: :show-inheritance: +okta\_integration\_api +---------------------- + +.. automodule:: datadog_api_client.v2.api.okta_integration_api + :members: + :show-inheritance: + opsgenie\_integration\_api -------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 558e9a1ec0..2884d1252d 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -4936,6 +4936,76 @@ nullable\_relationship\_to\_user\_data :members: :show-inheritance: +okta\_account +------------- + +.. automodule:: datadog_api_client.v2.model.okta_account + :members: + :show-inheritance: + +okta\_account\_attributes +------------------------- + +.. automodule:: datadog_api_client.v2.model.okta_account_attributes + :members: + :show-inheritance: + +okta\_account\_request +---------------------- + +.. automodule:: datadog_api_client.v2.model.okta_account_request + :members: + :show-inheritance: + +okta\_account\_response +----------------------- + +.. automodule:: datadog_api_client.v2.model.okta_account_response + :members: + :show-inheritance: + +okta\_account\_response\_data +----------------------------- + +.. automodule:: datadog_api_client.v2.model.okta_account_response_data + :members: + :show-inheritance: + +okta\_account\_type +------------------- + +.. automodule:: datadog_api_client.v2.model.okta_account_type + :members: + :show-inheritance: + +okta\_account\_update\_request +------------------------------ + +.. automodule:: datadog_api_client.v2.model.okta_account_update_request + :members: + :show-inheritance: + +okta\_account\_update\_request\_attributes +------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.okta_account_update_request_attributes + :members: + :show-inheritance: + +okta\_account\_update\_request\_data +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.okta_account_update_request_data + :members: + :show-inheritance: + +okta\_accounts\_response +------------------------ + +.. automodule:: datadog_api_client.v2.model.okta_accounts_response + :members: + :show-inheritance: + on\_demand\_concurrency\_cap ---------------------------- diff --git a/examples/v2/okta-integration/CreateOktaAccount.py b/examples/v2/okta-integration/CreateOktaAccount.py new file mode 100644 index 0000000000..aa46cce5a4 --- /dev/null +++ b/examples/v2/okta-integration/CreateOktaAccount.py @@ -0,0 +1,31 @@ +""" +Add Okta account returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi +from datadog_api_client.v2.model.okta_account import OktaAccount +from datadog_api_client.v2.model.okta_account_attributes import OktaAccountAttributes +from datadog_api_client.v2.model.okta_account_request import OktaAccountRequest +from datadog_api_client.v2.model.okta_account_type import OktaAccountType + +body = OktaAccountRequest( + data=OktaAccount( + attributes=OktaAccountAttributes( + auth_method="oauth", + domain="https://example.okta.com/", + name="Okta_Prod", + client_id="client_id", + client_secret="client_secret", + ), + id="f749daaf-682e-4208-a38d-c9b43162c609", + type=OktaAccountType.OKTA_ACCOUNTS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OktaIntegrationApi(api_client) + response = api_instance.create_okta_account(body=body) + + print(response) diff --git a/examples/v2/okta-integration/DeleteOktaAccount.py b/examples/v2/okta-integration/DeleteOktaAccount.py new file mode 100644 index 0000000000..d6b27530b3 --- /dev/null +++ b/examples/v2/okta-integration/DeleteOktaAccount.py @@ -0,0 +1,13 @@ +""" +Delete Okta account returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OktaIntegrationApi(api_client) + api_instance.delete_okta_account( + account_id="account_id", + ) diff --git a/examples/v2/okta-integration/GetOktaAccount.py b/examples/v2/okta-integration/GetOktaAccount.py new file mode 100644 index 0000000000..5b70632fc2 --- /dev/null +++ b/examples/v2/okta-integration/GetOktaAccount.py @@ -0,0 +1,19 @@ +""" +Get Okta account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi + +# there is a valid "okta_account" in the system +OKTA_ACCOUNT_DATA_ID = environ["OKTA_ACCOUNT_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OktaIntegrationApi(api_client) + response = api_instance.get_okta_account( + account_id=OKTA_ACCOUNT_DATA_ID, + ) + + print(response) diff --git a/examples/v2/okta-integration/ListOktaAccounts.py b/examples/v2/okta-integration/ListOktaAccounts.py new file mode 100644 index 0000000000..df8860d26d --- /dev/null +++ b/examples/v2/okta-integration/ListOktaAccounts.py @@ -0,0 +1,13 @@ +""" +List Okta accounts returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OktaIntegrationApi(api_client) + response = api_instance.list_okta_accounts() + + print(response) diff --git a/examples/v2/okta-integration/UpdateOktaAccount.py b/examples/v2/okta-integration/UpdateOktaAccount.py new file mode 100644 index 0000000000..606458e6a8 --- /dev/null +++ b/examples/v2/okta-integration/UpdateOktaAccount.py @@ -0,0 +1,33 @@ +""" +Update Okta account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi +from datadog_api_client.v2.model.okta_account_type import OktaAccountType +from datadog_api_client.v2.model.okta_account_update_request import OktaAccountUpdateRequest +from datadog_api_client.v2.model.okta_account_update_request_attributes import OktaAccountUpdateRequestAttributes +from datadog_api_client.v2.model.okta_account_update_request_data import OktaAccountUpdateRequestData + +# there is a valid "okta_account" in the system +OKTA_ACCOUNT_DATA_ID = environ["OKTA_ACCOUNT_DATA_ID"] + +body = OktaAccountUpdateRequest( + data=OktaAccountUpdateRequestData( + attributes=OktaAccountUpdateRequestAttributes( + auth_method="oauth", + domain="https://example.okta.com/", + client_id="client_id", + client_secret="client_secret", + ), + type=OktaAccountType.OKTA_ACCOUNTS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OktaIntegrationApi(api_client) + response = api_instance.update_okta_account(account_id=OKTA_ACCOUNT_DATA_ID, body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/okta_integration_api.py b/src/datadog_api_client/v2/api/okta_integration_api.py new file mode 100644 index 0000000000..227bdc154a --- /dev/null +++ b/src/datadog_api_client/v2/api/okta_integration_api.py @@ -0,0 +1,215 @@ +# 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.okta_accounts_response import OktaAccountsResponse +from datadog_api_client.v2.model.okta_account_response import OktaAccountResponse +from datadog_api_client.v2.model.okta_account_request import OktaAccountRequest +from datadog_api_client.v2.model.okta_account_update_request import OktaAccountUpdateRequest + + +class OktaIntegrationApi: + """ + Configure your Datadog Okta integration directly through the Datadog API. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_okta_account_endpoint = _Endpoint( + settings={ + "response_type": (OktaAccountResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integrations/okta/accounts", + "operation_id": "create_okta_account", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (OktaAccountRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_okta_account_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integrations/okta/accounts/{account_id}", + "operation_id": "delete_okta_account", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "account_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_okta_account_endpoint = _Endpoint( + settings={ + "response_type": (OktaAccountResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integrations/okta/accounts/{account_id}", + "operation_id": "get_okta_account", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "account_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_okta_accounts_endpoint = _Endpoint( + settings={ + "response_type": (OktaAccountsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integrations/okta/accounts", + "operation_id": "list_okta_accounts", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_okta_account_endpoint = _Endpoint( + settings={ + "response_type": (OktaAccountResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integrations/okta/accounts/{account_id}", + "operation_id": "update_okta_account", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "account_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (OktaAccountUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_okta_account( + self, + body: OktaAccountRequest, + ) -> OktaAccountResponse: + """Add Okta account. + + Create an Okta account. + + :type body: OktaAccountRequest + :rtype: OktaAccountResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_okta_account_endpoint.call_with_http_info(**kwargs) + + def delete_okta_account( + self, + account_id: str, + ) -> None: + """Delete Okta account. + + Delete an Okta account. + + :param account_id: None + :type account_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["account_id"] = account_id + + return self._delete_okta_account_endpoint.call_with_http_info(**kwargs) + + def get_okta_account( + self, + account_id: str, + ) -> OktaAccountResponse: + """Get Okta account. + + Get an Okta account. + + :param account_id: None + :type account_id: str + :rtype: OktaAccountResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["account_id"] = account_id + + return self._get_okta_account_endpoint.call_with_http_info(**kwargs) + + def list_okta_accounts( + self, + ) -> OktaAccountsResponse: + """List Okta accounts. + + List Okta accounts. + + :rtype: OktaAccountsResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_okta_accounts_endpoint.call_with_http_info(**kwargs) + + def update_okta_account( + self, + account_id: str, + body: OktaAccountUpdateRequest, + ) -> OktaAccountResponse: + """Update Okta account. + + Update an Okta account. + + :param account_id: None + :type account_id: str + :type body: OktaAccountUpdateRequest + :rtype: OktaAccountResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["account_id"] = account_id + + kwargs["body"] = body + + return self._update_okta_account_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index a1841126bb..8069ec3b32 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -24,6 +24,7 @@ from datadog_api_client.v2.api.logs_metrics_api import LogsMetricsApi from datadog_api_client.v2.api.metrics_api import MetricsApi from datadog_api_client.v2.api.monitors_api import MonitorsApi +from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi from datadog_api_client.v2.api.opsgenie_integration_api import OpsgenieIntegrationApi from datadog_api_client.v2.api.organizations_api import OrganizationsApi from datadog_api_client.v2.api.powerpack_api import PowerpackApi @@ -71,6 +72,7 @@ "LogsMetricsApi", "MetricsApi", "MonitorsApi", + "OktaIntegrationApi", "OpsgenieIntegrationApi", "OrganizationsApi", "PowerpackApi", diff --git a/src/datadog_api_client/v2/model/okta_account.py b/src/datadog_api_client/v2/model/okta_account.py new file mode 100644 index 0000000000..91bea9abea --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account.py @@ -0,0 +1,59 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.okta_account_attributes import OktaAccountAttributes + from datadog_api_client.v2.model.okta_account_type import OktaAccountType + + +class OktaAccount(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.okta_account_attributes import OktaAccountAttributes + from datadog_api_client.v2.model.okta_account_type import OktaAccountType + + return { + "attributes": (OktaAccountAttributes,), + "id": (str,), + "type": (OktaAccountType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: OktaAccountAttributes, type: OktaAccountType, id: Union[str, UnsetType] = unset, **kwargs + ): + """ + Schema for an Okta account. + + :param attributes: Attributes object for an Okta account. + :type attributes: OktaAccountAttributes + + :param id: The ID of the Okta account, a UUID hash of the account name. + :type id: str, optional + + :param type: Account type for an Okta account. + :type type: OktaAccountType + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/okta_account_attributes.py b/src/datadog_api_client/v2/model/okta_account_attributes.py new file mode 100644 index 0000000000..d72c7d9b87 --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_attributes.py @@ -0,0 +1,78 @@ +# 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 Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class OktaAccountAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "api_key": (str,), + "auth_method": (str,), + "client_id": (str,), + "client_secret": (str,), + "domain": (str,), + "name": (str,), + } + + attribute_map = { + "api_key": "api_key", + "auth_method": "auth_method", + "client_id": "client_id", + "client_secret": "client_secret", + "domain": "domain", + "name": "name", + } + + def __init__( + self_, + auth_method: str, + domain: str, + name: str, + api_key: Union[str, UnsetType] = unset, + client_id: Union[str, UnsetType] = unset, + client_secret: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes object for an Okta account. + + :param api_key: The API key of the Okta account. + :type api_key: str, optional + + :param auth_method: The authorization method for an Okta account. + :type auth_method: str + + :param client_id: The Client ID of an Okta app integration. + :type client_id: str, optional + + :param client_secret: The client secret of an Okta app integration. + :type client_secret: str, optional + + :param domain: The domain of the Okta account. + :type domain: str + + :param name: The name of the Okta account. + :type name: str + """ + if api_key is not unset: + kwargs["api_key"] = api_key + if client_id is not unset: + kwargs["client_id"] = client_id + if client_secret is not unset: + kwargs["client_secret"] = client_secret + super().__init__(kwargs) + + self_.auth_method = auth_method + self_.domain = domain + self_.name = name diff --git a/src/datadog_api_client/v2/model/okta_account_request.py b/src/datadog_api_client/v2/model/okta_account_request.py new file mode 100644 index 0000000000..ae15173df9 --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.okta_account import OktaAccount + + +class OktaAccountRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.okta_account import OktaAccount + + return { + "data": (OktaAccount,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OktaAccount, **kwargs): + """ + Request object for an Okta account. + + :param data: Schema for an Okta account. + :type data: OktaAccount + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/okta_account_response.py b/src/datadog_api_client/v2/model/okta_account_response.py new file mode 100644 index 0000000000..d257c1d37d --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_response.py @@ -0,0 +1,42 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.okta_account import OktaAccount + + +class OktaAccountResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.okta_account import OktaAccount + + return { + "data": (OktaAccount,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[OktaAccount, UnsetType] = unset, **kwargs): + """ + Response object for an Okta account. + + :param data: Schema for an Okta account. + :type data: OktaAccount, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/okta_account_response_data.py b/src/datadog_api_client/v2/model/okta_account_response_data.py new file mode 100644 index 0000000000..10dbb35e55 --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_response_data.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.okta_account_attributes import OktaAccountAttributes + from datadog_api_client.v2.model.okta_account_type import OktaAccountType + + +class OktaAccountResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.okta_account_attributes import OktaAccountAttributes + from datadog_api_client.v2.model.okta_account_type import OktaAccountType + + return { + "attributes": (OktaAccountAttributes,), + "id": (str,), + "type": (OktaAccountType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: OktaAccountAttributes, id: str, type: OktaAccountType, **kwargs): + """ + Data object of an Okta account + + :param attributes: Attributes object for an Okta account. + :type attributes: OktaAccountAttributes + + :param id: The ID of the Okta account, a UUID hash of the account name. + :type id: str + + :param type: Account type for an Okta account. + :type type: OktaAccountType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/okta_account_type.py b/src/datadog_api_client/v2/model/okta_account_type.py new file mode 100644 index 0000000000..4d59518ab2 --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OktaAccountType(ModelSimple): + """ + Account type for an Okta account. + + :param value: If omitted defaults to "okta-accounts". Must be one of ["okta-accounts"]. + :type value: str + """ + + allowed_values = { + "okta-accounts", + } + OKTA_ACCOUNTS: ClassVar["OktaAccountType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OktaAccountType.OKTA_ACCOUNTS = OktaAccountType("okta-accounts") diff --git a/src/datadog_api_client/v2/model/okta_account_update_request.py b/src/datadog_api_client/v2/model/okta_account_update_request.py new file mode 100644 index 0000000000..048be8d9eb --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_update_request.py @@ -0,0 +1,53 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + UUID, +) + + +if TYPE_CHECKING: + pass + + +class OktaAccountUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "data": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Any, **kwargs): + """ + Payload schema when updating an Okta account. + + :param data: Data object for updating an Okta account. + :type data: bool, date, datetime, dict, float, int, list, str, UUID, none_type + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/okta_account_update_request_attributes.py b/src/datadog_api_client/v2/model/okta_account_update_request_attributes.py new file mode 100644 index 0000000000..e13d8dd332 --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_update_request_attributes.py @@ -0,0 +1,71 @@ +# 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 Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class OktaAccountUpdateRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "api_key": (str,), + "auth_method": (str,), + "client_id": (str,), + "client_secret": (str,), + "domain": (str,), + } + + attribute_map = { + "api_key": "api_key", + "auth_method": "auth_method", + "client_id": "client_id", + "client_secret": "client_secret", + "domain": "domain", + } + + def __init__( + self_, + auth_method: str, + domain: str, + api_key: Union[str, UnsetType] = unset, + client_id: Union[str, UnsetType] = unset, + client_secret: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes object for updating an Okta account. + + :param api_key: The API key of the Okta account. + :type api_key: str, optional + + :param auth_method: The authorization method for an Okta account. + :type auth_method: str + + :param client_id: The Client ID of an Okta app integration. + :type client_id: str, optional + + :param client_secret: The client secret of an Okta app integration. + :type client_secret: str, optional + + :param domain: The domain associated with an Okta account. + :type domain: str + """ + if api_key is not unset: + kwargs["api_key"] = api_key + if client_id is not unset: + kwargs["client_id"] = client_id + if client_secret is not unset: + kwargs["client_secret"] = client_secret + super().__init__(kwargs) + + self_.auth_method = auth_method + self_.domain = domain diff --git a/src/datadog_api_client/v2/model/okta_account_update_request_data.py b/src/datadog_api_client/v2/model/okta_account_update_request_data.py new file mode 100644 index 0000000000..4b888c0a83 --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_account_update_request_data.py @@ -0,0 +1,58 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.okta_account_update_request_attributes import OktaAccountUpdateRequestAttributes + from datadog_api_client.v2.model.okta_account_type import OktaAccountType + + +class OktaAccountUpdateRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.okta_account_update_request_attributes import ( + OktaAccountUpdateRequestAttributes, + ) + from datadog_api_client.v2.model.okta_account_type import OktaAccountType + + return { + "attributes": (OktaAccountUpdateRequestAttributes,), + "type": (OktaAccountType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: Union[OktaAccountUpdateRequestAttributes, UnsetType] = unset, + type: Union[OktaAccountType, UnsetType] = unset, + **kwargs, + ): + """ + Data object for updating an Okta account. + + :param attributes: Attributes object for updating an Okta account. + :type attributes: OktaAccountUpdateRequestAttributes, optional + + :param type: Account type for an Okta account. + :type type: OktaAccountType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/okta_accounts_response.py b/src/datadog_api_client/v2/model/okta_accounts_response.py new file mode 100644 index 0000000000..ee60323f09 --- /dev/null +++ b/src/datadog_api_client/v2/model/okta_accounts_response.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.okta_account_response_data import OktaAccountResponseData + + +class OktaAccountsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.okta_account_response_data import OktaAccountResponseData + + return { + "data": ([OktaAccountResponseData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[OktaAccountResponseData], UnsetType] = unset, **kwargs): + """ + The expected response schema when getting Okta accounts. + + :param data: List of Okta accounts. + :type data: [OktaAccountResponseData], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index a783f23121..0e1125fff1 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -815,6 +815,16 @@ from datadog_api_client.v2.model.monthly_cost_attribution_response import MonthlyCostAttributionResponse from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData +from datadog_api_client.v2.model.okta_account import OktaAccount +from datadog_api_client.v2.model.okta_account_attributes import OktaAccountAttributes +from datadog_api_client.v2.model.okta_account_request import OktaAccountRequest +from datadog_api_client.v2.model.okta_account_response import OktaAccountResponse +from datadog_api_client.v2.model.okta_account_response_data import OktaAccountResponseData +from datadog_api_client.v2.model.okta_account_type import OktaAccountType +from datadog_api_client.v2.model.okta_account_update_request import OktaAccountUpdateRequest +from datadog_api_client.v2.model.okta_account_update_request_attributes import OktaAccountUpdateRequestAttributes +from datadog_api_client.v2.model.okta_account_update_request_data import OktaAccountUpdateRequestData +from datadog_api_client.v2.model.okta_accounts_response import OktaAccountsResponse from datadog_api_client.v2.model.on_demand_concurrency_cap import OnDemandConcurrencyCap from datadog_api_client.v2.model.on_demand_concurrency_cap_attributes import OnDemandConcurrencyCapAttributes from datadog_api_client.v2.model.on_demand_concurrency_cap_response import OnDemandConcurrencyCapResponse @@ -2218,6 +2228,16 @@ "MonthlyCostAttributionResponse", "NullableRelationshipToUser", "NullableRelationshipToUserData", + "OktaAccount", + "OktaAccountAttributes", + "OktaAccountRequest", + "OktaAccountResponse", + "OktaAccountResponseData", + "OktaAccountType", + "OktaAccountUpdateRequest", + "OktaAccountUpdateRequestAttributes", + "OktaAccountUpdateRequestData", + "OktaAccountsResponse", "OnDemandConcurrencyCap", "OnDemandConcurrencyCapAttributes", "OnDemandConcurrencyCapResponse", diff --git a/tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.frozen new file mode 100644 index 0000000000..04e51eb1c5 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-11-21T16:59:43.805Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.yaml new file mode 100644 index 0000000000..a8f8f6aa38 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_okta_account_returns_ok_response.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: '{"data":{"attributes":{"auth_method":"oauth","client_id":"client_id","client_secret":"client_secret","domain":"https://example.okta.com/","name":"Okta_Prod"},"id":"f749daaf-682e-4208-a38d-c9b43162c609","type":"okta-accounts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts + response: + body: + string: '{"data":{"type":"okta-accounts","attributes":{"domain":"https://example.okta.com/","client_id":"client_id","auth_method":"oauth","name":"Okta_Prod"},"id":"6330b376-d352-4a06-a169-107002bd6e6c"}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts/6330b376-d352-4a06-a169-107002bd6e6c + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.frozen new file mode 100644 index 0000000000..25029ca6da --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-11-21T16:59:44.767Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.yaml new file mode 100644 index 0000000000..4d4a06b920 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_okta_account_returns_ok_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"data":{"attributes":{"auth_method":"oauth","client_id":"fakeclientid","client_secret":"fakeclientsecret","domain":"https://dev-test.okta.com/","name":"testgetoktaaccountreturnsokresponse1700585984"},"type":"okta-accounts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts + response: + body: + string: '{"data":{"type":"okta-accounts","attributes":{"client_id":"fakeclientid","auth_method":"oauth","domain":"https://dev-test.okta.com/","name":"testgetoktaaccountreturnsokresponse1700585984"},"id":"2bf39935-f5c8-46b1-b41b-eda0b4bd2e78"}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts/2bf39935-f5c8-46b1-b41b-eda0b4bd2e78 + response: + body: + string: '{"data":{"type":"okta-accounts","attributes":{"client_id":"fakeclientid","auth_method":"oauth","domain":"https://dev-test.okta.com/","name":"testgetoktaaccountreturnsokresponse1700585984"},"id":"2bf39935-f5c8-46b1-b41b-eda0b4bd2e78"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts/2bf39935-f5c8-46b1-b41b-eda0b4bd2e78 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.frozen new file mode 100644 index 0000000000..9b10d8fa84 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-11-21T16:59:46.153Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.yaml new file mode 100644 index 0000000000..9bf90b1850 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_okta_accounts_returns_ok_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"data":{"attributes":{"auth_method":"oauth","client_id":"fakeclientid","client_secret":"fakeclientsecret","domain":"https://dev-test.okta.com/","name":"testlistoktaaccountsreturnsokresponse1700585986"},"type":"okta-accounts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts + response: + body: + string: '{"data":{"type":"okta-accounts","attributes":{"client_id":"fakeclientid","name":"testlistoktaaccountsreturnsokresponse1700585986","auth_method":"oauth","domain":"https://dev-test.okta.com/"},"id":"a5e9a04b-ac5b-4a5c-a4d5-c697deb232aa"}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts + response: + body: + string: '{"data":[{"type":"okta-accounts","attributes":{"name":"testoktapublicupdateaccountreturnsokresponse1699978854","auth_method":"oauth","domain":"https://example.okta.com/","client_id":"client_id"},"id":"9637ddf0-4f5e-4adb-89b0-72b7c843116f"},{"type":"okta-accounts","attributes":{"name":"testoktapublicupdateaccountreturnsokresponse1699978979","auth_method":"oauth","domain":"https://example.okta.com/","client_id":"client_id"},"id":"199e06bf-6805-403c-8b97-34c10f526485"},{"type":"okta-accounts","attributes":{"name":"testoktapublicupdateaccountreturnsokresponse1699989540","auth_method":"oauth","domain":"https://example.okta.com/","client_id":"client_id"},"id":"2770caff-0eb2-4edf-b3dd-63b42d706c79"},{"type":"okta-accounts","attributes":{"name":"testoktapublicupdateaccountreturnsokresponse1699990165","auth_method":"oauth","domain":"https://example.okta.com/","client_id":"client_id"},"id":"ee163be4-1a6d-466e-ba9d-539e5c505645"},{"type":"okta-accounts","attributes":{"name":"testupdateoktaaccountreturnsokresponse1700585947","auth_method":"oauth","domain":"https://example.okta.com/","client_id":"client_id"},"id":"474f2d62-fb47-40fc-a201-f0c59c90d3e3"},{"type":"okta-accounts","attributes":{"name":"testlistoktaaccountsreturnsokresponse1700585986","auth_method":"oauth","domain":"https://dev-test.okta.com/","client_id":"fakeclientid"},"id":"a5e9a04b-ac5b-4a5c-a4d5-c697deb232aa"}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts/a5e9a04b-ac5b-4a5c-a4d5-c697deb232aa + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.frozen new file mode 100644 index 0000000000..2292c7c300 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-11-21T16:59:47.501Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.yaml new file mode 100644 index 0000000000..96337e8095 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_okta_account_returns_ok_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: '{"data":{"attributes":{"auth_method":"oauth","client_id":"fakeclientid","client_secret":"fakeclientsecret","domain":"https://dev-test.okta.com/","name":"testupdateoktaaccountreturnsokresponse1700585987"},"type":"okta-accounts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts + response: + body: + string: '{"data":{"type":"okta-accounts","attributes":{"domain":"https://dev-test.okta.com/","auth_method":"oauth","client_id":"fakeclientid","name":"testupdateoktaaccountreturnsokresponse1700585987"},"id":"c847a349-9687-4b80-8b0f-996e0e75f73e"}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"auth_method":"oauth","client_id":"client_id","client_secret":"client_secret","domain":"https://example.okta.com/"},"type":"okta-accounts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts/c847a349-9687-4b80-8b0f-996e0e75f73e + response: + body: + string: '{"data":{"type":"okta-accounts","id":"7343985f-6e86-4327-8792-538b4c9b38e9","attributes":{"auth_method":"oauth","client_id":"client_id","domain":"https://example.okta.com/","name":"testupdateoktaaccountreturnsokresponse1700585987"}}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integrations/okta/accounts/c847a349-9687-4b80-8b0f-996e0e75f73e + response: + body: + string: '{"errors":["Unknown error occurred: "]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 396c5f5089..87cad5da34 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -223,6 +223,18 @@ "tag": "Fastly Integration", "operationId": "CreateFastlyAccount" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"okta-accounts\",\n \"attributes\": {\n \"auth_method\": \"oauth\",\n \"name\": \"{{ unique_lower_alnum }}\",\n \"domain\": \"https://dev-test.okta.com/\",\n \"client_id\": \"fakeclientid\",\n \"client_secret\": \"fakeclientsecret\"\n }\n }\n}" + } + ], + "step": "there is a valid \"okta_account\" in the system", + "key": "okta_account", + "tag": "Okta Integration", + "operationId": "CreateOktaAccount" + }, { "parameters": [ { diff --git a/tests/v2/features/okta_integration.feature b/tests/v2/features/okta_integration.feature new file mode 100644 index 0000000000..a623c27e54 --- /dev/null +++ b/tests/v2/features/okta_integration.feature @@ -0,0 +1,117 @@ +@endpoint(okta-integration) @endpoint(okta-integration-v2) +Feature: Okta Integration + Configure your Datadog Okta integration directly through the Datadog API. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "OktaIntegration" API + + @generated @skip @team:Datadog/web-integrations + Scenario: Add Okta account returns "Bad Request" response + Given new "CreateOktaAccount" request + And body with value {"data": {"attributes": {"auth_method": "oauth", "domain": "https://example.okta.com/", "name": "Okta-Prod"}, "id": "f749daaf-682e-4208-a38d-c9b43162c609", "type": "okta-accounts"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/web-integrations + Scenario: Add Okta account returns "Not Found" response + Given new "CreateOktaAccount" request + And body with value {"data": {"attributes": {"auth_method": "oauth", "domain": "https://example.okta.com/", "name": "Okta-Prod"}, "id": "f749daaf-682e-4208-a38d-c9b43162c609", "type": "okta-accounts"}} + When the request is sent + Then the response status is 404 Not Found + + @team:Datadog/web-integrations + Scenario: Add Okta account returns "OK" response + Given new "CreateOktaAccount" request + And body with value {"data": {"attributes": {"auth_method": "oauth", "domain": "https://example.okta.com/", "name": "Okta_Prod", "client_id": "client_id", "client_secret":"client_secret"},"id": "f749daaf-682e-4208-a38d-c9b43162c609", "type": "okta-accounts"}} + When the request is sent + Then the response status is 201 OK + + @generated @skip @team:Datadog/web-integrations + Scenario: Delete Okta account returns "Bad Request" response + Given new "DeleteOktaAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/web-integrations + Scenario: Delete Okta account returns "Not Found" response + Given new "DeleteOktaAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/web-integrations + Scenario: Delete Okta account returns "OK" response + Given new "DeleteOktaAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:Datadog/web-integrations + Scenario: Get Okta account returns "Bad Request" response + Given new "GetOktaAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/web-integrations + Scenario: Get Okta account returns "Not Found" response + Given new "GetOktaAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:Datadog/web-integrations + Scenario: Get Okta account returns "OK" response + Given there is a valid "okta_account" in the system + And new "GetOktaAccount" request + And request contains "account_id" parameter from "okta_account.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "okta-accounts" + + @generated @skip @team:Datadog/web-integrations + Scenario: List Okta accounts returns "Bad Request" response + Given new "ListOktaAccounts" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/web-integrations + Scenario: List Okta accounts returns "Not Found" response + Given new "ListOktaAccounts" request + When the request is sent + Then the response status is 404 Not Found + + @team:Datadog/web-integrations + Scenario: List Okta accounts returns "OK" response + Given there is a valid "okta_account" in the system + And new "ListOktaAccounts" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:Datadog/web-integrations + Scenario: Update Okta account returns "Bad Request" response + Given new "UpdateOktaAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/web-integrations + Scenario: Update Okta account returns "Not Found" response + Given new "UpdateOktaAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {} + When the request is sent + Then the response status is 404 Not Found + + @team:Datadog/web-integrations + Scenario: Update Okta account returns "OK" response + Given there is a valid "okta_account" in the system + And new "UpdateOktaAccount" request + And request contains "account_id" parameter from "okta_account.data.id" + And body with value {"data": {"attributes": {"auth_method": "oauth", "domain": "https://example.okta.com/", "client_id": "client_id", "client_secret":"client_secret"}, "type": "okta-accounts"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index a85545fbbd..3830272741 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -772,6 +772,43 @@ "type": "safe" } }, + "ListOktaAccounts": { + "tag": "Okta Integration", + "undo": { + "type": "safe" + } + }, + "CreateOktaAccount": { + "tag": "Okta Integration", + "undo": { + "operationId": "DeleteOktaAccount", + "parameters": [ + { + "name": "account_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteOktaAccount": { + "tag": "Okta Integration", + "undo": { + "type": "idempotent" + } + }, + "GetOktaAccount": { + "tag": "Okta Integration", + "undo": { + "type": "safe" + } + }, + "UpdateOktaAccount": { + "tag": "Okta Integration", + "undo": { + "type": "idempotent" + } + }, "GetIPAllowlist": { "tag": "IP Allowlist", "undo": {