diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 97213ec2fe..aa59f26ddf 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -435,6 +435,14 @@ components: schema: example: "service:myservice" type: string + EntityIntegrationConfigID: + description: The identifier of the integration whose configuration is being managed. Supported values are `github`, `jira`, and `pagerduty`. + in: path + name: integration_id + required: true + schema: + example: github + type: string FastlyAccountID: description: Fastly Account id. in: path @@ -27199,6 +27207,103 @@ components: description: Entity. type: string type: object + EntityIntegrationConfigAttributes: + description: The organization ID, integration identifier, and integration-specific configuration payload for an entity integration configuration. + properties: + config: + $ref: "#/components/schemas/EntityIntegrationConfigPayload" + integration_id: + description: The identifier of the integration this configuration applies to (for example, `github`, `jira`, or `pagerduty`). + example: github + type: string + org_id: + description: The Datadog organization identifier that owns this configuration. + example: 1234 + format: int64 + type: integer + required: + - org_id + - integration_id + - config + type: object + EntityIntegrationConfigData: + description: JSON:API resource object for an entity integration configuration. + properties: + attributes: + $ref: "#/components/schemas/EntityIntegrationConfigAttributes" + id: + description: Unique identifier of the entity integration configuration. + example: 01HJABCD12345678ABCDEFGHIJ + type: string + type: + $ref: "#/components/schemas/EntityIntegrationConfigType" + required: + - id + - type + - attributes + type: object + EntityIntegrationConfigPayload: + additionalProperties: {} + description: Integration-specific configuration payload. The shape of this object depends on the integration identified by the path parameter. For `github`, the object must contain an `enabled_repos` array. For `jira`, it must contain an `enabled_projects` array. For `pagerduty`, it must contain an `accounts` array. + example: + enabled_repos: + - github_org_name: myorg + hostname: github.com + repo_name: myrepo + type: object + EntityIntegrationConfigRequest: + description: Request body used to create or replace the configuration for a given integration. + properties: + data: + $ref: "#/components/schemas/EntityIntegrationConfigRequestData" + required: + - data + type: object + EntityIntegrationConfigRequestAttributes: + description: Attributes used to create or update an entity integration configuration. + properties: + config: + $ref: "#/components/schemas/EntityIntegrationConfigPayload" + required: + - config + type: object + EntityIntegrationConfigRequestData: + description: JSON:API resource object used in a request to create or update an entity integration configuration. + properties: + attributes: + $ref: "#/components/schemas/EntityIntegrationConfigRequestAttributes" + type: + $ref: "#/components/schemas/EntityIntegrationConfigRequestType" + required: + - type + - attributes + type: object + EntityIntegrationConfigRequestType: + default: entity_integration_config_requests + description: JSON:API resource type for the entity integration configuration create or update request. Always `entity_integration_config_requests`. + enum: + - entity_integration_config_requests + example: entity_integration_config_requests + type: string + x-enum-varnames: + - ENTITY_INTEGRATION_CONFIG_REQUESTS + EntityIntegrationConfigResponse: + description: JSON:API document containing a single entity integration configuration resource. + properties: + data: + $ref: "#/components/schemas/EntityIntegrationConfigData" + required: + - data + type: object + EntityIntegrationConfigType: + default: entity_integration_configs + description: JSON:API resource type for an entity integration configuration. Always `entity_integration_configs`. + enum: + - entity_integration_configs + example: entity_integration_configs + type: string + x-enum-varnames: + - ENTITY_INTEGRATION_CONFIGS EntityMeta: description: Entity metadata. properties: @@ -114501,6 +114606,180 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/idp/entity_integrations/{integration_id}: + delete: + description: Delete the configuration stored for a given integration in the caller's organization. + operationId: DeleteEntityIntegrationConfig + parameters: + - $ref: "#/components/parameters/EntityIntegrationConfigID" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete an entity integration configuration + tags: + - Entity Integration Configs + x-permission: + operator: OR + permissions: + - manage_integrations + 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/). + get: + description: Retrieve the configuration currently stored for a given integration in the caller's organization. + operationId: GetEntityIntegrationConfig + parameters: + - $ref: "#/components/parameters/EntityIntegrationConfigID" + responses: + "200": + content: + application/json: + example: + data: + attributes: + config: + enabled_repos: + - github_org_name: myorg + hostname: github.com + repo_name: myrepo + integration_id: github + org_id: 1234 + id: 01HJABCD12345678ABCDEFGHIJ + type: entity_integration_configs + schema: + $ref: "#/components/schemas/EntityIntegrationConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an entity integration configuration + tags: + - Entity Integration Configs + x-permission: + operator: OR + permissions: + - integrations_read + 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/). + put: + description: |- + Create or replace the configuration for a given integration in the caller's organization. The shape of `data.attributes.config` depends on the integration: + + - For `github`: `config` must contain an `enabled_repos` array of objects with `hostname`, `github_org_name`, and `repo_name`. + - For `jira`: `config` must contain an `enabled_projects` array of objects with `hostname`, `account_id`, and `project_key`. + - For `pagerduty`: `config` must contain an `accounts` array of objects with a required `enabled` boolean and an optional `subdomain` string. + operationId: UpdateEntityIntegrationConfig + parameters: + - $ref: "#/components/parameters/EntityIntegrationConfigID" + requestBody: + content: + application/json: + examples: + default: + summary: GitHub integration configuration + value: + data: + attributes: + config: + enabled_repos: + - github_org_name: myorg + hostname: github.com + repo_name: myrepo + type: entity_integration_config_requests + jira: + summary: Jira integration configuration + value: + data: + attributes: + config: + enabled_projects: + - account_id: "123456789" + hostname: mycompany.atlassian.net + project_key: AAA + type: entity_integration_config_requests + pagerduty: + summary: PagerDuty integration configuration + value: + data: + attributes: + config: + accounts: + - enabled: true + subdomain: mycompany + type: entity_integration_config_requests + schema: + $ref: "#/components/schemas/EntityIntegrationConfigRequest" + required: true + responses: + "200": + content: + application/json: + example: + data: + attributes: + config: + enabled_repos: + - github_org_name: myorg + hostname: github.com + repo_name: myrepo + integration_id: github + org_id: 1234 + id: 01HJABCD12345678ABCDEFGHIJ + type: entity_integration_configs + schema: + $ref: "#/components/schemas/EntityIntegrationConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create or update entity integration configuration + tags: + - Entity Integration Configs + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - integrations_read + 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/incidents: get: description: >- @@ -161782,6 +162061,8 @@ tags: scopes from alerting. Downtime settings, which can be scheduled with start and end times, prevent all alerting related to specified Datadog tags. name: Downtimes + - description: Manage per-integration configurations for the Internal Developer Portal (IDP). These configurations control which external resources (for example, GitHub repositories, Jira projects, or PagerDuty services) are synced as entities into the Software Catalog. + name: Entity Integration Configs - description: Retrieves security risk scores for entities in your organization. name: Entity Risk Scores - description: View and manage issues within Error Tracking. See the [Error Tracking page](https://docs.datadoghq.com/error_tracking/) for more information. diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index f97716ab7f..b983e4d251 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -284,6 +284,13 @@ datadog\_api\_client.v2.api.downtimes\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.entity\_integration\_configs\_api module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.entity_integration_configs_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.entity\_risk\_scores\_api module ------------------------------------------------------------ diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 7343fa1af3..f88cb287be 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -11148,6 +11148,69 @@ datadog\_api\_client.v2.model.entity\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.entity\_integration\_config\_attributes module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_data module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_payload module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_payload + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_request module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_request\_attributes module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_request\_data module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_request\_type module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_response module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.entity\_integration\_config\_type module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.entity_integration_config_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.entity\_meta module ------------------------------------------------- diff --git a/examples/v2/entity-integration-configs/DeleteEntityIntegrationConfig.py b/examples/v2/entity-integration-configs/DeleteEntityIntegrationConfig.py new file mode 100644 index 0000000000..a449519d9c --- /dev/null +++ b/examples/v2/entity-integration-configs/DeleteEntityIntegrationConfig.py @@ -0,0 +1,14 @@ +""" +Delete an entity integration configuration returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.entity_integration_configs_api import EntityIntegrationConfigsApi + +configuration = Configuration() +configuration.unstable_operations["delete_entity_integration_config"] = True +with ApiClient(configuration) as api_client: + api_instance = EntityIntegrationConfigsApi(api_client) + api_instance.delete_entity_integration_config( + integration_id="github", + ) diff --git a/examples/v2/entity-integration-configs/GetEntityIntegrationConfig.py b/examples/v2/entity-integration-configs/GetEntityIntegrationConfig.py new file mode 100644 index 0000000000..baf761c21e --- /dev/null +++ b/examples/v2/entity-integration-configs/GetEntityIntegrationConfig.py @@ -0,0 +1,16 @@ +""" +Get an entity integration configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.entity_integration_configs_api import EntityIntegrationConfigsApi + +configuration = Configuration() +configuration.unstable_operations["get_entity_integration_config"] = True +with ApiClient(configuration) as api_client: + api_instance = EntityIntegrationConfigsApi(api_client) + response = api_instance.get_entity_integration_config( + integration_id="github", + ) + + print(response) diff --git a/examples/v2/entity-integration-configs/UpdateEntityIntegrationConfig.py b/examples/v2/entity-integration-configs/UpdateEntityIntegrationConfig.py new file mode 100644 index 0000000000..c6b6a4baf5 --- /dev/null +++ b/examples/v2/entity-integration-configs/UpdateEntityIntegrationConfig.py @@ -0,0 +1,32 @@ +""" +Create or update entity integration configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.entity_integration_configs_api import EntityIntegrationConfigsApi +from datadog_api_client.v2.model.entity_integration_config_payload import EntityIntegrationConfigPayload +from datadog_api_client.v2.model.entity_integration_config_request import EntityIntegrationConfigRequest +from datadog_api_client.v2.model.entity_integration_config_request_attributes import ( + EntityIntegrationConfigRequestAttributes, +) +from datadog_api_client.v2.model.entity_integration_config_request_data import EntityIntegrationConfigRequestData +from datadog_api_client.v2.model.entity_integration_config_request_type import EntityIntegrationConfigRequestType + +body = EntityIntegrationConfigRequest( + data=EntityIntegrationConfigRequestData( + attributes=EntityIntegrationConfigRequestAttributes( + config=EntityIntegrationConfigPayload( + [("enabled_repos", "[{'github_org_name': 'myorg', 'hostname': 'github.com', 'repo_name': 'myrepo'}]")] + ), + ), + type=EntityIntegrationConfigRequestType.ENTITY_INTEGRATION_CONFIG_REQUESTS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_entity_integration_config"] = True +with ApiClient(configuration) as api_client: + api_instance = EntityIntegrationConfigsApi(api_client) + response = api_instance.update_entity_integration_config(integration_id="github", body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 0103568f42..6a124ed094 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -455,6 +455,9 @@ def __init__( "v2.update_deployment_rule": False, "v2.create_hamr_org_connection": False, "v2.get_hamr_org_connection": False, + "v2.delete_entity_integration_config": False, + "v2.get_entity_integration_config": False, + "v2.update_entity_integration_config": False, "v2.create_global_incident_handle": False, "v2.create_incident": False, "v2.create_incident_attachment": False, diff --git a/src/datadog_api_client/v2/api/entity_integration_configs_api.py b/src/datadog_api_client/v2/api/entity_integration_configs_api.py new file mode 100644 index 0000000000..382b3dd86d --- /dev/null +++ b/src/datadog_api_client/v2/api/entity_integration_configs_api.py @@ -0,0 +1,153 @@ +# 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.entity_integration_config_response import EntityIntegrationConfigResponse +from datadog_api_client.v2.model.entity_integration_config_request import EntityIntegrationConfigRequest + + +class EntityIntegrationConfigsApi: + """ + Manage per-integration configurations for the Internal Developer Portal (IDP). These configurations control which external resources (for example, GitHub repositories, Jira projects, or PagerDuty services) are synced as entities into the Software Catalog. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._delete_entity_integration_config_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/idp/entity_integrations/{integration_id}", + "operation_id": "delete_entity_integration_config", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "integration_id": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_entity_integration_config_endpoint = _Endpoint( + settings={ + "response_type": (EntityIntegrationConfigResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/idp/entity_integrations/{integration_id}", + "operation_id": "get_entity_integration_config", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "integration_id": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_entity_integration_config_endpoint = _Endpoint( + settings={ + "response_type": (EntityIntegrationConfigResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/idp/entity_integrations/{integration_id}", + "operation_id": "update_entity_integration_config", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "integration_id": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (EntityIntegrationConfigRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def delete_entity_integration_config( + self, + integration_id: str, + ) -> None: + """Delete an entity integration configuration. + + Delete the configuration stored for a given integration in the caller's organization. + + :param integration_id: The identifier of the integration whose configuration is being managed. Supported values are ``github`` , ``jira`` , and ``pagerduty``. + :type integration_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_id"] = integration_id + + return self._delete_entity_integration_config_endpoint.call_with_http_info(**kwargs) + + def get_entity_integration_config( + self, + integration_id: str, + ) -> EntityIntegrationConfigResponse: + """Get an entity integration configuration. + + Retrieve the configuration currently stored for a given integration in the caller's organization. + + :param integration_id: The identifier of the integration whose configuration is being managed. Supported values are ``github`` , ``jira`` , and ``pagerduty``. + :type integration_id: str + :rtype: EntityIntegrationConfigResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_id"] = integration_id + + return self._get_entity_integration_config_endpoint.call_with_http_info(**kwargs) + + def update_entity_integration_config( + self, + integration_id: str, + body: EntityIntegrationConfigRequest, + ) -> EntityIntegrationConfigResponse: + """Create or update entity integration configuration. + + Create or replace the configuration for a given integration in the caller's organization. The shape of ``data.attributes.config`` depends on the integration: + + * For ``github`` : ``config`` must contain an ``enabled_repos`` array of objects with ``hostname`` , ``github_org_name`` , and ``repo_name``. + * For ``jira`` : ``config`` must contain an ``enabled_projects`` array of objects with ``hostname`` , ``account_id`` , and ``project_key``. + * For ``pagerduty`` : ``config`` must contain an ``accounts`` array of objects with a required ``enabled`` boolean and an optional ``subdomain`` string. + + :param integration_id: The identifier of the integration whose configuration is being managed. Supported values are ``github`` , ``jira`` , and ``pagerduty``. + :type integration_id: str + :type body: EntityIntegrationConfigRequest + :rtype: EntityIntegrationConfigResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_id"] = integration_id + + kwargs["body"] = body + + return self._update_entity_integration_config_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 4bec61e66e..6f2ebf73d1 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -38,6 +38,7 @@ from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi from datadog_api_client.v2.api.domain_allowlist_api import DomainAllowlistApi from datadog_api_client.v2.api.downtimes_api import DowntimesApi +from datadog_api_client.v2.api.entity_integration_configs_api import EntityIntegrationConfigsApi from datadog_api_client.v2.api.entity_risk_scores_api import EntityRiskScoresApi from datadog_api_client.v2.api.error_tracking_api import ErrorTrackingApi from datadog_api_client.v2.api.events_api import EventsApi @@ -153,6 +154,7 @@ "DeploymentGatesApi", "DomainAllowlistApi", "DowntimesApi", + "EntityIntegrationConfigsApi", "EntityRiskScoresApi", "ErrorTrackingApi", "EventsApi", diff --git a/src/datadog_api_client/v2/model/entity_integration_config_attributes.py b/src/datadog_api_client/v2/model/entity_integration_config_attributes.py new file mode 100644 index 0000000000..f8fb6bb7ad --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_attributes.py @@ -0,0 +1,52 @@ +# 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.entity_integration_config_payload import EntityIntegrationConfigPayload + + +class EntityIntegrationConfigAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.entity_integration_config_payload import EntityIntegrationConfigPayload + + return { + "config": (EntityIntegrationConfigPayload,), + "integration_id": (str,), + "org_id": (int,), + } + + attribute_map = { + "config": "config", + "integration_id": "integration_id", + "org_id": "org_id", + } + + def __init__(self_, config: EntityIntegrationConfigPayload, integration_id: str, org_id: int, **kwargs): + """ + The organization ID, integration identifier, and integration-specific configuration payload for an entity integration configuration. + + :param config: Integration-specific configuration payload. The shape of this object depends on the integration identified by the path parameter. For ``github`` , the object must contain an ``enabled_repos`` array. For ``jira`` , it must contain an ``enabled_projects`` array. For ``pagerduty`` , it must contain an ``accounts`` array. + :type config: EntityIntegrationConfigPayload + + :param integration_id: The identifier of the integration this configuration applies to (for example, ``github`` , ``jira`` , or ``pagerduty`` ). + :type integration_id: str + + :param org_id: The Datadog organization identifier that owns this configuration. + :type org_id: int + """ + super().__init__(kwargs) + + self_.config = config + self_.integration_id = integration_id + self_.org_id = org_id diff --git a/src/datadog_api_client/v2/model/entity_integration_config_data.py b/src/datadog_api_client/v2/model/entity_integration_config_data.py new file mode 100644 index 0000000000..1929415201 --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_data.py @@ -0,0 +1,56 @@ +# 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.entity_integration_config_attributes import EntityIntegrationConfigAttributes + from datadog_api_client.v2.model.entity_integration_config_type import EntityIntegrationConfigType + + +class EntityIntegrationConfigData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.entity_integration_config_attributes import EntityIntegrationConfigAttributes + from datadog_api_client.v2.model.entity_integration_config_type import EntityIntegrationConfigType + + return { + "attributes": (EntityIntegrationConfigAttributes,), + "id": (str,), + "type": (EntityIntegrationConfigType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: EntityIntegrationConfigAttributes, id: str, type: EntityIntegrationConfigType, **kwargs + ): + """ + JSON:API resource object for an entity integration configuration. + + :param attributes: The organization ID, integration identifier, and integration-specific configuration payload for an entity integration configuration. + :type attributes: EntityIntegrationConfigAttributes + + :param id: Unique identifier of the entity integration configuration. + :type id: str + + :param type: JSON:API resource type for an entity integration configuration. Always ``entity_integration_configs``. + :type type: EntityIntegrationConfigType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/entity_integration_config_payload.py b/src/datadog_api_client/v2/model/entity_integration_config_payload.py new file mode 100644 index 0000000000..5536e21c26 --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_payload.py @@ -0,0 +1,17 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, +) + + +class EntityIntegrationConfigPayload(ModelNormal): + def __init__(self_, **kwargs): + """ + Integration-specific configuration payload. The shape of this object depends on the integration identified by the path parameter. For ``github`` , the object must contain an ``enabled_repos`` array. For ``jira`` , it must contain an ``enabled_projects`` array. For ``pagerduty`` , it must contain an ``accounts`` array. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/entity_integration_config_request.py b/src/datadog_api_client/v2/model/entity_integration_config_request.py new file mode 100644 index 0000000000..cf4ef35aa0 --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_request.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.entity_integration_config_request_data import EntityIntegrationConfigRequestData + + +class EntityIntegrationConfigRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.entity_integration_config_request_data import ( + EntityIntegrationConfigRequestData, + ) + + return { + "data": (EntityIntegrationConfigRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: EntityIntegrationConfigRequestData, **kwargs): + """ + Request body used to create or replace the configuration for a given integration. + + :param data: JSON:API resource object used in a request to create or update an entity integration configuration. + :type data: EntityIntegrationConfigRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/entity_integration_config_request_attributes.py b/src/datadog_api_client/v2/model/entity_integration_config_request_attributes.py new file mode 100644 index 0000000000..32e5184909 --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_request_attributes.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.entity_integration_config_payload import EntityIntegrationConfigPayload + + +class EntityIntegrationConfigRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.entity_integration_config_payload import EntityIntegrationConfigPayload + + return { + "config": (EntityIntegrationConfigPayload,), + } + + attribute_map = { + "config": "config", + } + + def __init__(self_, config: EntityIntegrationConfigPayload, **kwargs): + """ + Attributes used to create or update an entity integration configuration. + + :param config: Integration-specific configuration payload. The shape of this object depends on the integration identified by the path parameter. For ``github`` , the object must contain an ``enabled_repos`` array. For ``jira`` , it must contain an ``enabled_projects`` array. For ``pagerduty`` , it must contain an ``accounts`` array. + :type config: EntityIntegrationConfigPayload + """ + super().__init__(kwargs) + + self_.config = config diff --git a/src/datadog_api_client/v2/model/entity_integration_config_request_data.py b/src/datadog_api_client/v2/model/entity_integration_config_request_data.py new file mode 100644 index 0000000000..0e03b39e2e --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_request_data.py @@ -0,0 +1,56 @@ +# 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.entity_integration_config_request_attributes import ( + EntityIntegrationConfigRequestAttributes, + ) + from datadog_api_client.v2.model.entity_integration_config_request_type import EntityIntegrationConfigRequestType + + +class EntityIntegrationConfigRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.entity_integration_config_request_attributes import ( + EntityIntegrationConfigRequestAttributes, + ) + from datadog_api_client.v2.model.entity_integration_config_request_type import ( + EntityIntegrationConfigRequestType, + ) + + return { + "attributes": (EntityIntegrationConfigRequestAttributes,), + "type": (EntityIntegrationConfigRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, attributes: EntityIntegrationConfigRequestAttributes, type: EntityIntegrationConfigRequestType, **kwargs + ): + """ + JSON:API resource object used in a request to create or update an entity integration configuration. + + :param attributes: Attributes used to create or update an entity integration configuration. + :type attributes: EntityIntegrationConfigRequestAttributes + + :param type: JSON:API resource type for the entity integration configuration create or update request. Always ``entity_integration_config_requests``. + :type type: EntityIntegrationConfigRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/entity_integration_config_request_type.py b/src/datadog_api_client/v2/model/entity_integration_config_request_type.py new file mode 100644 index 0000000000..46d8825c2a --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_request_type.py @@ -0,0 +1,37 @@ +# 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 EntityIntegrationConfigRequestType(ModelSimple): + """ + JSON:API resource type for the entity integration configuration create or update request. Always `entity_integration_config_requests`. + + :param value: If omitted defaults to "entity_integration_config_requests". Must be one of ["entity_integration_config_requests"]. + :type value: str + """ + + allowed_values = { + "entity_integration_config_requests", + } + ENTITY_INTEGRATION_CONFIG_REQUESTS: ClassVar["EntityIntegrationConfigRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +EntityIntegrationConfigRequestType.ENTITY_INTEGRATION_CONFIG_REQUESTS = EntityIntegrationConfigRequestType( + "entity_integration_config_requests" +) diff --git a/src/datadog_api_client/v2/model/entity_integration_config_response.py b/src/datadog_api_client/v2/model/entity_integration_config_response.py new file mode 100644 index 0000000000..6959fe9c2d --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_response.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.entity_integration_config_data import EntityIntegrationConfigData + + +class EntityIntegrationConfigResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.entity_integration_config_data import EntityIntegrationConfigData + + return { + "data": (EntityIntegrationConfigData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: EntityIntegrationConfigData, **kwargs): + """ + JSON:API document containing a single entity integration configuration resource. + + :param data: JSON:API resource object for an entity integration configuration. + :type data: EntityIntegrationConfigData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/entity_integration_config_type.py b/src/datadog_api_client/v2/model/entity_integration_config_type.py new file mode 100644 index 0000000000..2681fe5642 --- /dev/null +++ b/src/datadog_api_client/v2/model/entity_integration_config_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 EntityIntegrationConfigType(ModelSimple): + """ + JSON:API resource type for an entity integration configuration. Always `entity_integration_configs`. + + :param value: If omitted defaults to "entity_integration_configs". Must be one of ["entity_integration_configs"]. + :type value: str + """ + + allowed_values = { + "entity_integration_configs", + } + ENTITY_INTEGRATION_CONFIGS: ClassVar["EntityIntegrationConfigType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +EntityIntegrationConfigType.ENTITY_INTEGRATION_CONFIGS = EntityIntegrationConfigType("entity_integration_configs") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 02ac2fb4e8..83060ad550 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2131,6 +2131,17 @@ from datadog_api_client.v2.model.entity_context_revision import EntityContextRevision from datadog_api_client.v2.model.entity_context_revision_attributes import EntityContextRevisionAttributes from datadog_api_client.v2.model.entity_data import EntityData +from datadog_api_client.v2.model.entity_integration_config_attributes import EntityIntegrationConfigAttributes +from datadog_api_client.v2.model.entity_integration_config_data import EntityIntegrationConfigData +from datadog_api_client.v2.model.entity_integration_config_payload import EntityIntegrationConfigPayload +from datadog_api_client.v2.model.entity_integration_config_request import EntityIntegrationConfigRequest +from datadog_api_client.v2.model.entity_integration_config_request_attributes import ( + EntityIntegrationConfigRequestAttributes, +) +from datadog_api_client.v2.model.entity_integration_config_request_data import EntityIntegrationConfigRequestData +from datadog_api_client.v2.model.entity_integration_config_request_type import EntityIntegrationConfigRequestType +from datadog_api_client.v2.model.entity_integration_config_response import EntityIntegrationConfigResponse +from datadog_api_client.v2.model.entity_integration_config_type import EntityIntegrationConfigType from datadog_api_client.v2.model.entity_meta import EntityMeta from datadog_api_client.v2.model.entity_relationships import EntityRelationships from datadog_api_client.v2.model.entity_response_array import EntityResponseArray @@ -9745,6 +9756,15 @@ "EntityContextRevision", "EntityContextRevisionAttributes", "EntityData", + "EntityIntegrationConfigAttributes", + "EntityIntegrationConfigData", + "EntityIntegrationConfigPayload", + "EntityIntegrationConfigRequest", + "EntityIntegrationConfigRequestAttributes", + "EntityIntegrationConfigRequestData", + "EntityIntegrationConfigRequestType", + "EntityIntegrationConfigResponse", + "EntityIntegrationConfigType", "EntityMeta", "EntityRelationships", "EntityResponseArray", diff --git a/tests/v2/features/entity_integration_configs.feature b/tests/v2/features/entity_integration_configs.feature new file mode 100644 index 0000000000..3a672f8e40 --- /dev/null +++ b/tests/v2/features/entity_integration_configs.feature @@ -0,0 +1,77 @@ +@endpoint(entity-integration-configs) @endpoint(entity-integration-configs-v2) +Feature: Entity Integration Configs + Manage per-integration configurations for the Internal Developer Portal + (IDP). These configurations control which external resources (for example, + GitHub repositories, Jira projects, or PagerDuty services) are synced as + entities into the Software Catalog. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "EntityIntegrationConfigs" API + + @generated @skip @team:DataDog/idp + Scenario: Create or update entity integration configuration returns "Bad Request" response + Given operation "UpdateEntityIntegrationConfig" enabled + And new "UpdateEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"config": {"enabled_repos": [{"github_org_name": "myorg", "hostname": "github.com", "repo_name": "myrepo"}]}}, "type": "entity_integration_config_requests"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/idp + Scenario: Create or update entity integration configuration returns "OK" response + Given operation "UpdateEntityIntegrationConfig" enabled + And new "UpdateEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"config": {"enabled_repos": [{"github_org_name": "myorg", "hostname": "github.com", "repo_name": "myrepo"}]}}, "type": "entity_integration_config_requests"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/idp + Scenario: Delete an entity integration configuration returns "Bad Request" response + Given operation "DeleteEntityIntegrationConfig" enabled + And new "DeleteEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/idp + Scenario: Delete an entity integration configuration returns "No Content" response + Given operation "DeleteEntityIntegrationConfig" enabled + And new "DeleteEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/idp + Scenario: Delete an entity integration configuration returns "Not Found" response + Given operation "DeleteEntityIntegrationConfig" enabled + And new "DeleteEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/idp + Scenario: Get an entity integration configuration returns "Bad Request" response + Given operation "GetEntityIntegrationConfig" enabled + And new "GetEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/idp + Scenario: Get an entity integration configuration returns "Not Found" response + Given operation "GetEntityIntegrationConfig" enabled + And new "GetEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/idp + Scenario: Get an entity integration configuration returns "OK" response + Given operation "GetEntityIntegrationConfig" enabled + And new "GetEntityIntegrationConfig" request + And request contains "integration_id" parameter from "REPLACE.ME" + 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 7a8309d2ce..239b1a7a03 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2550,6 +2550,24 @@ "type": "unsafe" } }, + "DeleteEntityIntegrationConfig": { + "tag": "Entity Integration Configs", + "undo": { + "type": "idempotent" + } + }, + "GetEntityIntegrationConfig": { + "tag": "Entity Integration Configs", + "undo": { + "type": "safe" + } + }, + "UpdateEntityIntegrationConfig": { + "tag": "Entity Integration Configs", + "undo": { + "type": "idempotent" + } + }, "ListIncidents": { "tag": "Incidents", "undo": {