From fc16d1d234b0c3234a147eb48ffb3faa58eaf52d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 28 Mar 2023 17:54:26 +0000 Subject: [PATCH] Regenerate client from commit f7578408 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 205 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 84 +++++++ .../CreateOrUpdateServiceDefinitions.py | 67 +++--- ...teOrUpdateServiceDefinitions_1808735248.py | 71 ++++++ ...teOrUpdateServiceDefinitions_2621774959.py | 69 ++++++ .../v2/api/service_definition_api.py | 3 +- .../service_definition_data_attributes.py | 5 +- .../v2/model/service_definition_schema.py | 14 ++ .../v2/model/service_definition_v2_dot1.py | 163 ++++++++++++++ .../service_definition_v2_dot1_contact.py | 46 ++++ .../model/service_definition_v2_dot1_email.py | 57 +++++ .../service_definition_v2_dot1_email_type.py | 35 +++ ...service_definition_v2_dot1_integrations.py | 56 +++++ .../model/service_definition_v2_dot1_link.py | 68 ++++++ .../service_definition_v2_dot1_link_type.py | 47 ++++ .../service_definition_v2_dot1_opsgenie.py | 55 +++++ ...vice_definition_v2_dot1_opsgenie_region.py | 38 ++++ .../service_definition_v2_dot1_pagerduty.py | 36 +++ .../model/service_definition_v2_dot1_slack.py | 57 +++++ .../service_definition_v2_dot1_slack_type.py | 35 +++ .../service_definition_v2_dot1_version.py | 35 +++ .../service_definitions_create_request.py | 42 ++-- src/datadog_api_client/v2/models/__init__.py | 13 ++ ...definition_returns_created_response.frozen | 2 +- ...e_definition_returns_created_response.yaml | 6 +- ...chema_v2_1_returns_created_response.frozen | 1 + ..._schema_v2_1_returns_created_response.yaml | 45 ++++ ..._schema_v2_returns_created_response.frozen | 1 + ...ng_schema_v2_returns_created_response.yaml | 45 ++++ tests/v2/features/given.json | 2 +- tests/v2/features/service_definition.feature | 48 ++-- 32 files changed, 1380 insertions(+), 79 deletions(-) create mode 100644 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_1808735248.py create mode 100644 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621774959.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_contact.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_email.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_email_type.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_integrations.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_link.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_link_type.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie_region.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_pagerduty.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_slack.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_slack_type.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot1_version.py create mode 100644 tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.yaml diff --git a/.apigentools-info b/.apigentools-info index a53bde1bd2..5d8b403184 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-27 19:48:12.660986", - "spec_repo_commit": "b6741167" + "regenerated": "2023-03-28 17:53:23.802638", + "spec_repo_commit": "f7578408" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-27 19:48:12.674049", - "spec_repo_commit": "b6741167" + "regenerated": "2023-03-28 17:53:23.814357", + "spec_repo_commit": "f7578408" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9350501525..3536abd92a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12092,6 +12092,7 @@ components: oneOf: - $ref: '#/components/schemas/ServiceDefinitionV1' - $ref: '#/components/schemas/ServiceDefinitionV2' + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1' type: object ServiceDefinitionV1: deprecated: true @@ -12322,6 +12323,209 @@ components: - name - url type: object + ServiceDefinitionV2Dot1: + description: Service definition v2.1 for providing service metadata and integrations. + properties: + application: + description: Identifier for a group of related services serving a product + feature, which the service is a part of. + example: my-app + type: string + contacts: + description: A list of contacts related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Contact' + type: array + dd-service: + description: Unique identifier of the service. Must be unique across all + services and is used to match with a service in Datadog. + example: my-service + type: string + description: + description: A short description of the service. + example: My service description + type: string + extensions: + additionalProperties: {} + description: Extensions to v2.1 schema. + example: + myorg/extension: extensionValue + type: object + integrations: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Integrations' + lifecycle: + description: The current life cycle phase of the service. + example: sandbox + type: string + links: + description: A list of links related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Link' + type: array + schema-version: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Version' + tags: + description: A set of custom tags. + example: + - my:tag + - service:tag + items: + type: string + type: array + team: + description: Team that owns the service. It is used to locate a team defined + in Datadog Teams if it exists. + example: my-team + type: string + tier: + description: Importance of the service. + example: High + type: string + required: + - schema-version + - dd-service + type: object + ServiceDefinitionV2Dot1Contact: + description: Service owner's contacts information. + oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1Email' + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1Slack' + ServiceDefinitionV2Dot1Email: + description: Service owner's email. + properties: + contact: + description: Contact value. + example: contact@datadoghq.com + format: email + type: string + name: + description: Contact email. + example: Team Email + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1EmailType' + required: + - type + - contact + type: object + ServiceDefinitionV2Dot1EmailType: + description: Contact type. + enum: + - email + example: email + type: string + x-enum-varnames: + - EMAIL + ServiceDefinitionV2Dot1Integrations: + description: Third party integrations that Datadog supports. + properties: + opsgenie: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Opsgenie' + pagerduty: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Pagerduty' + type: object + ServiceDefinitionV2Dot1Link: + description: Service's external links. + properties: + name: + description: Link name. + example: Runbook + type: string + provider: + description: Link provider. + example: Github + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1LinkType' + url: + description: Link URL. + example: https://my-runbook + type: string + required: + - name + - type + - url + type: object + ServiceDefinitionV2Dot1LinkType: + description: Link type. + enum: + - doc + - repo + - runbook + - dashboard + - other + example: runbook + type: string + x-enum-varnames: + - DOC + - REPO + - RUNBOOK + - DASHBOARD + - OTHER + ServiceDefinitionV2Dot1Opsgenie: + description: Opsgenie integration for the service. + properties: + region: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1OpsgenieRegion' + service-url: + description: Opsgenie service url. + example: https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000 + type: string + required: + - service-url + type: object + ServiceDefinitionV2Dot1OpsgenieRegion: + description: Opsgenie instance region. + enum: + - US + - EU + example: US + type: string + x-enum-varnames: + - US + - EU + ServiceDefinitionV2Dot1Pagerduty: + description: PagerDuty integration for the service. + properties: + service-url: + description: PagerDuty service url. + example: https://my-org.pagerduty.com/service-directory/PMyService + type: string + type: object + ServiceDefinitionV2Dot1Slack: + description: Service owner's Slack channel. + properties: + contact: + description: Slack Channel. + example: https://yourcompany.slack.com/archives/channel123 + type: string + name: + description: Contact Slack. + example: Team Slack + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1SlackType' + required: + - type + - contact + type: object + ServiceDefinitionV2Dot1SlackType: + description: Contact type. + enum: + - slack + example: slack + type: string + x-enum-varnames: + - SLACK + ServiceDefinitionV2Dot1Version: + default: v2.1 + description: Schema version being used. + enum: + - v2.1 + example: v2.1 + type: string + x-enum-varnames: + - V2_1 ServiceDefinitionV2Email: description: Service owner's email. properties: @@ -12480,6 +12684,7 @@ components: ServiceDefinitionsCreateRequest: description: Create service definitions request. oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1' - $ref: '#/components/schemas/ServiceDefinitionV2' - $ref: '#/components/schemas/ServiceDefinitionRaw' ServiceDefinitionsListResponse: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 86672e2142..2826f4756e 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -5664,6 +5664,90 @@ service\_definition\_v2\_doc :members: :show-inheritance: +service\_definition\_v2\_dot1 +----------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1 + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_contact +-------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_contact + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_email +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_email + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_email\_type +------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_email_type + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_integrations +------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_integrations + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_link +----------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_link + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_link\_type +----------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_link_type + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_opsgenie +--------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_opsgenie\_region +----------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie_region + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_pagerduty +---------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_pagerduty + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_slack +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_slack + :members: + :show-inheritance: + +service\_definition\_v2\_dot1\_slack\_type +------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot1_slack_type + :members: + :show-inheritance: + service\_definition\_v2\_email ------------------------------ diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py index 991ed84e31..6d2314ee88 100644 --- a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py @@ -4,63 +4,54 @@ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi -from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2 -from datadog_api_client.v2.model.service_definition_v2_doc import ServiceDefinitionV2Doc -from datadog_api_client.v2.model.service_definition_v2_email import ServiceDefinitionV2Email -from datadog_api_client.v2.model.service_definition_v2_email_type import ServiceDefinitionV2EmailType -from datadog_api_client.v2.model.service_definition_v2_integrations import ServiceDefinitionV2Integrations -from datadog_api_client.v2.model.service_definition_v2_link import ServiceDefinitionV2Link -from datadog_api_client.v2.model.service_definition_v2_link_type import ServiceDefinitionV2LinkType -from datadog_api_client.v2.model.service_definition_v2_opsgenie import ServiceDefinitionV2Opsgenie -from datadog_api_client.v2.model.service_definition_v2_opsgenie_region import ServiceDefinitionV2OpsgenieRegion -from datadog_api_client.v2.model.service_definition_v2_repo import ServiceDefinitionV2Repo -from datadog_api_client.v2.model.service_definition_v2_version import ServiceDefinitionV2Version +from datadog_api_client.v2.model.service_definition_v2_dot1 import ServiceDefinitionV2Dot1 +from datadog_api_client.v2.model.service_definition_v2_dot1_email import ServiceDefinitionV2Dot1Email +from datadog_api_client.v2.model.service_definition_v2_dot1_email_type import ServiceDefinitionV2Dot1EmailType +from datadog_api_client.v2.model.service_definition_v2_dot1_integrations import ServiceDefinitionV2Dot1Integrations +from datadog_api_client.v2.model.service_definition_v2_dot1_link import ServiceDefinitionV2Dot1Link +from datadog_api_client.v2.model.service_definition_v2_dot1_link_type import ServiceDefinitionV2Dot1LinkType +from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie import ServiceDefinitionV2Dot1Opsgenie +from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie_region import ServiceDefinitionV2Dot1OpsgenieRegion +from datadog_api_client.v2.model.service_definition_v2_dot1_pagerduty import ServiceDefinitionV2Dot1Pagerduty +from datadog_api_client.v2.model.service_definition_v2_dot1_version import ServiceDefinitionV2Dot1Version -body = ServiceDefinitionV2( +body = ServiceDefinitionV2Dot1( + application="my-app", contacts=[ - ServiceDefinitionV2Email( + ServiceDefinitionV2Dot1Email( contact="contact@datadoghq.com", name="Team Email", - type=ServiceDefinitionV2EmailType.EMAIL, + type=ServiceDefinitionV2Dot1EmailType.EMAIL, ), ], - dd_service="service-Example-Create_or_update_service_definition_returns_CREATED_response", - dd_team="my-team", - docs=[ - ServiceDefinitionV2Doc( - name="Architecture", - provider="google drive", - url="https://gdrive/mydoc", - ), - ], - extensions=dict([("myorgextension", "extensionvalue")]), - integrations=ServiceDefinitionV2Integrations( - opsgenie=ServiceDefinitionV2Opsgenie( - region=ServiceDefinitionV2OpsgenieRegion.US, + dd_service="my-service", + description="My service description", + extensions=dict([("myorg/extension", "extensionValue")]), + integrations=ServiceDefinitionV2Dot1Integrations( + opsgenie=ServiceDefinitionV2Dot1Opsgenie( + region=ServiceDefinitionV2Dot1OpsgenieRegion.US, service_url="https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", ), - pagerduty="https://my-org.pagerduty.com/service-directory/PMyService", + pagerduty=ServiceDefinitionV2Dot1Pagerduty( + service_url="https://my-org.pagerduty.com/service-directory/PMyService", + ), ), + lifecycle="sandbox", links=[ - ServiceDefinitionV2Link( + ServiceDefinitionV2Dot1Link( name="Runbook", - type=ServiceDefinitionV2LinkType.RUNBOOK, + provider="Github", + type=ServiceDefinitionV2Dot1LinkType.RUNBOOK, url="https://my-runbook", ), ], - repos=[ - ServiceDefinitionV2Repo( - name="Source Code", - provider="GitHub", - url="https://github.com/DataDog/schema", - ), - ], - schema_version=ServiceDefinitionV2Version.V2, + schema_version=ServiceDefinitionV2Dot1Version.V2_1, tags=[ "my:tag", "service:tag", ], team="my-team", + tier="High", ) configuration = Configuration() diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_1808735248.py b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_1808735248.py new file mode 100644 index 0000000000..7ca7ea5206 --- /dev/null +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_1808735248.py @@ -0,0 +1,71 @@ +""" +Create or update service definition using schema v2 returns "CREATED" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi +from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2 +from datadog_api_client.v2.model.service_definition_v2_doc import ServiceDefinitionV2Doc +from datadog_api_client.v2.model.service_definition_v2_email import ServiceDefinitionV2Email +from datadog_api_client.v2.model.service_definition_v2_email_type import ServiceDefinitionV2EmailType +from datadog_api_client.v2.model.service_definition_v2_integrations import ServiceDefinitionV2Integrations +from datadog_api_client.v2.model.service_definition_v2_link import ServiceDefinitionV2Link +from datadog_api_client.v2.model.service_definition_v2_link_type import ServiceDefinitionV2LinkType +from datadog_api_client.v2.model.service_definition_v2_opsgenie import ServiceDefinitionV2Opsgenie +from datadog_api_client.v2.model.service_definition_v2_opsgenie_region import ServiceDefinitionV2OpsgenieRegion +from datadog_api_client.v2.model.service_definition_v2_repo import ServiceDefinitionV2Repo +from datadog_api_client.v2.model.service_definition_v2_version import ServiceDefinitionV2Version + +body = ServiceDefinitionV2( + contacts=[ + ServiceDefinitionV2Email( + contact="contact@datadoghq.com", + name="Team Email", + type=ServiceDefinitionV2EmailType.EMAIL, + ), + ], + dd_service="service-examplecreateorupdateservicedefinitionusingschemav2returnscreatedresponse", + dd_team="my-team", + docs=[ + ServiceDefinitionV2Doc( + name="Architecture", + provider="google drive", + url="https://gdrive/mydoc", + ), + ], + extensions=dict([("myorgextension", "extensionvalue")]), + integrations=ServiceDefinitionV2Integrations( + opsgenie=ServiceDefinitionV2Opsgenie( + region=ServiceDefinitionV2OpsgenieRegion.US, + service_url="https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", + ), + pagerduty="https://my-org.pagerduty.com/service-directory/PMyService", + ), + links=[ + ServiceDefinitionV2Link( + name="Runbook", + type=ServiceDefinitionV2LinkType.RUNBOOK, + url="https://my-runbook", + ), + ], + repos=[ + ServiceDefinitionV2Repo( + name="Source Code", + provider="GitHub", + url="https://github.com/DataDog/schema", + ), + ], + schema_version=ServiceDefinitionV2Version.V2, + tags=[ + "my:tag", + "service:tag", + ], + team="my-team", +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceDefinitionApi(api_client) + response = api_instance.create_or_update_service_definitions(body=body) + + print(response) diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621774959.py b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621774959.py new file mode 100644 index 0000000000..b42e41cf8e --- /dev/null +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621774959.py @@ -0,0 +1,69 @@ +""" +Create or update service definition using schema v2.1 returns "CREATED" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi +from datadog_api_client.v2.model.service_definition_v2_dot1 import ServiceDefinitionV2Dot1 +from datadog_api_client.v2.model.service_definition_v2_dot1_email import ServiceDefinitionV2Dot1Email +from datadog_api_client.v2.model.service_definition_v2_dot1_email_type import ServiceDefinitionV2Dot1EmailType +from datadog_api_client.v2.model.service_definition_v2_dot1_integrations import ServiceDefinitionV2Dot1Integrations +from datadog_api_client.v2.model.service_definition_v2_dot1_link import ServiceDefinitionV2Dot1Link +from datadog_api_client.v2.model.service_definition_v2_dot1_link_type import ServiceDefinitionV2Dot1LinkType +from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie import ServiceDefinitionV2Dot1Opsgenie +from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie_region import ServiceDefinitionV2Dot1OpsgenieRegion +from datadog_api_client.v2.model.service_definition_v2_dot1_pagerduty import ServiceDefinitionV2Dot1Pagerduty +from datadog_api_client.v2.model.service_definition_v2_dot1_version import ServiceDefinitionV2Dot1Version + +body = ServiceDefinitionV2Dot1( + contacts=[ + ServiceDefinitionV2Dot1Email( + contact="contact@datadoghq.com", + name="Team Email", + type=ServiceDefinitionV2Dot1EmailType.EMAIL, + ), + ], + dd_service="service-Example-Create_or_update_service_definition_using_schema_v2_1_returns_CREATED_response", + extensions=dict([("myorgextension", "extensionvalue")]), + integrations=ServiceDefinitionV2Dot1Integrations( + opsgenie=ServiceDefinitionV2Dot1Opsgenie( + region=ServiceDefinitionV2Dot1OpsgenieRegion.US, + service_url="https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", + ), + pagerduty=ServiceDefinitionV2Dot1Pagerduty( + service_url="https://my-org.pagerduty.com/service-directory/PMyService", + ), + ), + links=[ + ServiceDefinitionV2Dot1Link( + name="Runbook", + type=ServiceDefinitionV2Dot1LinkType.RUNBOOK, + url="https://my-runbook", + ), + ServiceDefinitionV2Dot1Link( + name="Source Code", + type=ServiceDefinitionV2Dot1LinkType.REPO, + provider="GitHub", + url="https://github.com/DataDog/schema", + ), + ServiceDefinitionV2Dot1Link( + name="Architecture", + type=ServiceDefinitionV2Dot1LinkType.DOC, + provider="Gigoogle drivetHub", + url="https://my-runbook", + ), + ], + schema_version=ServiceDefinitionV2Dot1Version.V2_1, + tags=[ + "my:tag", + "service:tag", + ], + team="my-team", +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceDefinitionApi(api_client) + response = api_instance.create_or_update_service_definitions(body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/service_definition_api.py b/src/datadog_api_client/v2/api/service_definition_api.py index 62ad893311..e26c129917 100644 --- a/src/datadog_api_client/v2/api/service_definition_api.py +++ b/src/datadog_api_client/v2/api/service_definition_api.py @@ -10,6 +10,7 @@ from datadog_api_client.v2.model.service_definitions_list_response import ServiceDefinitionsListResponse from datadog_api_client.v2.model.service_definition_create_response import ServiceDefinitionCreateResponse from datadog_api_client.v2.model.service_definitions_create_request import ServiceDefinitionsCreateRequest +from datadog_api_client.v2.model.service_definition_v2_dot1 import ServiceDefinitionV2Dot1 from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2 from datadog_api_client.v2.model.service_definition_get_response import ServiceDefinitionGetResponse @@ -115,7 +116,7 @@ def __init__(self, api_client=None): def create_or_update_service_definitions( self, - body: Union[ServiceDefinitionsCreateRequest, ServiceDefinitionV2, str], + body: Union[ServiceDefinitionsCreateRequest, ServiceDefinitionV2Dot1, ServiceDefinitionV2, str], ) -> ServiceDefinitionCreateResponse: """Create or update service definition. diff --git a/src/datadog_api_client/v2/model/service_definition_data_attributes.py b/src/datadog_api_client/v2/model/service_definition_data_attributes.py index fbafcf5912..b1f47180e5 100644 --- a/src/datadog_api_client/v2/model/service_definition_data_attributes.py +++ b/src/datadog_api_client/v2/model/service_definition_data_attributes.py @@ -18,6 +18,7 @@ from datadog_api_client.v2.model.service_definition_schema import ServiceDefinitionSchema from datadog_api_client.v2.model.service_definition_v1 import ServiceDefinitionV1 from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2 + from datadog_api_client.v2.model.service_definition_v2_dot1 import ServiceDefinitionV2Dot1 class ServiceDefinitionDataAttributes(ModelNormal): @@ -39,7 +40,9 @@ def openapi_types(_): def __init__( self_, meta: Union[ServiceDefinitionMeta, UnsetType] = unset, - schema: Union[ServiceDefinitionSchema, ServiceDefinitionV1, ServiceDefinitionV2, UnsetType] = unset, + schema: Union[ + ServiceDefinitionSchema, ServiceDefinitionV1, ServiceDefinitionV2, ServiceDefinitionV2Dot1, UnsetType + ] = unset, **kwargs, ): """ diff --git a/src/datadog_api_client/v2/model/service_definition_schema.py b/src/datadog_api_client/v2/model/service_definition_schema.py index 4c0ebf2581..1d22f69c66 100644 --- a/src/datadog_api_client/v2/model/service_definition_schema.py +++ b/src/datadog_api_client/v2/model/service_definition_schema.py @@ -59,6 +59,18 @@ def __init__(self, **kwargs): :param team: Team that owns the service. :type team: str, optional + + :param application: Identifier for a group of related services serving a product feature, which the service is a part of. + :type application: str, optional + + :param description: A short description of the service. + :type description: str, optional + + :param lifecycle: The current life cycle phase of the service. + :type lifecycle: str, optional + + :param tier: Importance of the service. + :type tier: str, optional """ super().__init__(kwargs) @@ -73,10 +85,12 @@ def _composed_schemas(_): # loading from datadog_api_client.v2.model.service_definition_v1 import ServiceDefinitionV1 from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2 + from datadog_api_client.v2.model.service_definition_v2_dot1 import ServiceDefinitionV2Dot1 return { "oneOf": [ ServiceDefinitionV1, ServiceDefinitionV2, + ServiceDefinitionV2Dot1, ], } diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1.py new file mode 100644 index 0000000000..1481db526b --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1.py @@ -0,0 +1,163 @@ +# 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, List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.service_definition_v2_dot1_contact import ServiceDefinitionV2Dot1Contact + from datadog_api_client.v2.model.service_definition_v2_dot1_integrations import ServiceDefinitionV2Dot1Integrations + from datadog_api_client.v2.model.service_definition_v2_dot1_link import ServiceDefinitionV2Dot1Link + from datadog_api_client.v2.model.service_definition_v2_dot1_version import ServiceDefinitionV2Dot1Version + from datadog_api_client.v2.model.service_definition_v2_dot1_email import ServiceDefinitionV2Dot1Email + from datadog_api_client.v2.model.service_definition_v2_dot1_slack import ServiceDefinitionV2Dot1Slack + + +class ServiceDefinitionV2Dot1(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot1_contact import ServiceDefinitionV2Dot1Contact + from datadog_api_client.v2.model.service_definition_v2_dot1_integrations import ( + ServiceDefinitionV2Dot1Integrations, + ) + from datadog_api_client.v2.model.service_definition_v2_dot1_link import ServiceDefinitionV2Dot1Link + from datadog_api_client.v2.model.service_definition_v2_dot1_version import ServiceDefinitionV2Dot1Version + + return { + "application": (str,), + "contacts": ([ServiceDefinitionV2Dot1Contact],), + "dd_service": (str,), + "description": (str,), + "extensions": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) + }, + ), + "integrations": (ServiceDefinitionV2Dot1Integrations,), + "lifecycle": (str,), + "links": ([ServiceDefinitionV2Dot1Link],), + "schema_version": (ServiceDefinitionV2Dot1Version,), + "tags": ([str],), + "team": (str,), + "tier": (str,), + } + + attribute_map = { + "application": "application", + "contacts": "contacts", + "dd_service": "dd-service", + "description": "description", + "extensions": "extensions", + "integrations": "integrations", + "lifecycle": "lifecycle", + "links": "links", + "schema_version": "schema-version", + "tags": "tags", + "team": "team", + "tier": "tier", + } + + def __init__( + self_, + dd_service: str, + schema_version: ServiceDefinitionV2Dot1Version, + application: Union[str, UnsetType] = unset, + contacts: Union[ + List[Union[ServiceDefinitionV2Dot1Contact, ServiceDefinitionV2Dot1Email, ServiceDefinitionV2Dot1Slack]], + UnsetType, + ] = unset, + description: Union[str, UnsetType] = unset, + extensions: Union[Dict[str, Any], UnsetType] = unset, + integrations: Union[ServiceDefinitionV2Dot1Integrations, UnsetType] = unset, + lifecycle: Union[str, UnsetType] = unset, + links: Union[List[ServiceDefinitionV2Dot1Link], UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + team: Union[str, UnsetType] = unset, + tier: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Service definition v2.1 for providing service metadata and integrations. + + :param application: Identifier for a group of related services serving a product feature, which the service is a part of. + :type application: str, optional + + :param contacts: A list of contacts related to the services. + :type contacts: [ServiceDefinitionV2Dot1Contact], optional + + :param dd_service: Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog. + :type dd_service: str + + :param description: A short description of the service. + :type description: str, optional + + :param extensions: Extensions to v2.1 schema. + :type extensions: {str: (bool, date, datetime, dict, float, int, list, str, none_type,)}, optional + + :param integrations: Third party integrations that Datadog supports. + :type integrations: ServiceDefinitionV2Dot1Integrations, optional + + :param lifecycle: The current life cycle phase of the service. + :type lifecycle: str, optional + + :param links: A list of links related to the services. + :type links: [ServiceDefinitionV2Dot1Link], optional + + :param schema_version: Schema version being used. + :type schema_version: ServiceDefinitionV2Dot1Version + + :param tags: A set of custom tags. + :type tags: [str], optional + + :param team: Team that owns the service. It is used to locate a team defined in Datadog Teams if it exists. + :type team: str, optional + + :param tier: Importance of the service. + :type tier: str, optional + """ + if application is not unset: + kwargs["application"] = application + if contacts is not unset: + kwargs["contacts"] = contacts + if description is not unset: + kwargs["description"] = description + if extensions is not unset: + kwargs["extensions"] = extensions + if integrations is not unset: + kwargs["integrations"] = integrations + if lifecycle is not unset: + kwargs["lifecycle"] = lifecycle + if links is not unset: + kwargs["links"] = links + if tags is not unset: + kwargs["tags"] = tags + if team is not unset: + kwargs["team"] = team + if tier is not unset: + kwargs["tier"] = tier + super().__init__(kwargs) + + self_.dd_service = dd_service + self_.schema_version = schema_version diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_contact.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_contact.py new file mode 100644 index 0000000000..19f275d07c --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_contact.py @@ -0,0 +1,46 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class ServiceDefinitionV2Dot1Contact(ModelComposed): + def __init__(self, **kwargs): + """ + Service owner's contacts information. + + :param contact: Contact value. + :type contact: str + + :param name: Contact email. + :type name: str, optional + + :param type: Contact type. + :type type: ServiceDefinitionV2Dot1EmailType + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.service_definition_v2_dot1_email import ServiceDefinitionV2Dot1Email + from datadog_api_client.v2.model.service_definition_v2_dot1_slack import ServiceDefinitionV2Dot1Slack + + return { + "oneOf": [ + ServiceDefinitionV2Dot1Email, + ServiceDefinitionV2Dot1Slack, + ], + } diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_email.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_email.py new file mode 100644 index 0000000000..5b2b1c1bd8 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_email.py @@ -0,0 +1,57 @@ +# 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.service_definition_v2_dot1_email_type import ServiceDefinitionV2Dot1EmailType + + +class ServiceDefinitionV2Dot1Email(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot1_email_type import ServiceDefinitionV2Dot1EmailType + + return { + "contact": (str,), + "name": (str,), + "type": (ServiceDefinitionV2Dot1EmailType,), + } + + attribute_map = { + "contact": "contact", + "name": "name", + "type": "type", + } + + def __init__( + self_, contact: str, type: ServiceDefinitionV2Dot1EmailType, name: Union[str, UnsetType] = unset, **kwargs + ): + """ + Service owner's email. + + :param contact: Contact value. + :type contact: str + + :param name: Contact email. + :type name: str, optional + + :param type: Contact type. + :type type: ServiceDefinitionV2Dot1EmailType + """ + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) + + self_.contact = contact + self_.type = type diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_email_type.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_email_type.py new file mode 100644 index 0000000000..f9ec6b1f77 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_email_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 ServiceDefinitionV2Dot1EmailType(ModelSimple): + """ + Contact type. + + :param value: If omitted defaults to "email". Must be one of ["email"]. + :type value: str + """ + + allowed_values = { + "email", + } + EMAIL: ClassVar["ServiceDefinitionV2Dot1EmailType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceDefinitionV2Dot1EmailType.EMAIL = ServiceDefinitionV2Dot1EmailType("email") diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_integrations.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_integrations.py new file mode 100644 index 0000000000..f9d47571b6 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_integrations.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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie import ServiceDefinitionV2Dot1Opsgenie + from datadog_api_client.v2.model.service_definition_v2_dot1_pagerduty import ServiceDefinitionV2Dot1Pagerduty + + +class ServiceDefinitionV2Dot1Integrations(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie import ServiceDefinitionV2Dot1Opsgenie + from datadog_api_client.v2.model.service_definition_v2_dot1_pagerduty import ServiceDefinitionV2Dot1Pagerduty + + return { + "opsgenie": (ServiceDefinitionV2Dot1Opsgenie,), + "pagerduty": (ServiceDefinitionV2Dot1Pagerduty,), + } + + attribute_map = { + "opsgenie": "opsgenie", + "pagerduty": "pagerduty", + } + + def __init__( + self_, + opsgenie: Union[ServiceDefinitionV2Dot1Opsgenie, UnsetType] = unset, + pagerduty: Union[ServiceDefinitionV2Dot1Pagerduty, UnsetType] = unset, + **kwargs, + ): + """ + Third party integrations that Datadog supports. + + :param opsgenie: Opsgenie integration for the service. + :type opsgenie: ServiceDefinitionV2Dot1Opsgenie, optional + + :param pagerduty: PagerDuty integration for the service. + :type pagerduty: ServiceDefinitionV2Dot1Pagerduty, optional + """ + if opsgenie is not unset: + kwargs["opsgenie"] = opsgenie + if pagerduty is not unset: + kwargs["pagerduty"] = pagerduty + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_link.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_link.py new file mode 100644 index 0000000000..cea55df7c8 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_link.py @@ -0,0 +1,68 @@ +# 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.service_definition_v2_dot1_link_type import ServiceDefinitionV2Dot1LinkType + + +class ServiceDefinitionV2Dot1Link(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot1_link_type import ServiceDefinitionV2Dot1LinkType + + return { + "name": (str,), + "provider": (str,), + "type": (ServiceDefinitionV2Dot1LinkType,), + "url": (str,), + } + + attribute_map = { + "name": "name", + "provider": "provider", + "type": "type", + "url": "url", + } + + def __init__( + self_, + name: str, + type: ServiceDefinitionV2Dot1LinkType, + url: str, + provider: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Service's external links. + + :param name: Link name. + :type name: str + + :param provider: Link provider. + :type provider: str, optional + + :param type: Link type. + :type type: ServiceDefinitionV2Dot1LinkType + + :param url: Link URL. + :type url: str + """ + if provider is not unset: + kwargs["provider"] = provider + super().__init__(kwargs) + + self_.name = name + self_.type = type + self_.url = url diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_link_type.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_link_type.py new file mode 100644 index 0000000000..a613a4525e --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_link_type.py @@ -0,0 +1,47 @@ +# 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 ServiceDefinitionV2Dot1LinkType(ModelSimple): + """ + Link type. + + :param value: Must be one of ["doc", "repo", "runbook", "dashboard", "other"]. + :type value: str + """ + + allowed_values = { + "doc", + "repo", + "runbook", + "dashboard", + "other", + } + DOC: ClassVar["ServiceDefinitionV2Dot1LinkType"] + REPO: ClassVar["ServiceDefinitionV2Dot1LinkType"] + RUNBOOK: ClassVar["ServiceDefinitionV2Dot1LinkType"] + DASHBOARD: ClassVar["ServiceDefinitionV2Dot1LinkType"] + OTHER: ClassVar["ServiceDefinitionV2Dot1LinkType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceDefinitionV2Dot1LinkType.DOC = ServiceDefinitionV2Dot1LinkType("doc") +ServiceDefinitionV2Dot1LinkType.REPO = ServiceDefinitionV2Dot1LinkType("repo") +ServiceDefinitionV2Dot1LinkType.RUNBOOK = ServiceDefinitionV2Dot1LinkType("runbook") +ServiceDefinitionV2Dot1LinkType.DASHBOARD = ServiceDefinitionV2Dot1LinkType("dashboard") +ServiceDefinitionV2Dot1LinkType.OTHER = ServiceDefinitionV2Dot1LinkType("other") diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie.py new file mode 100644 index 0000000000..1fcfdfa8ea --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie.py @@ -0,0 +1,55 @@ +# 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.service_definition_v2_dot1_opsgenie_region import ( + ServiceDefinitionV2Dot1OpsgenieRegion, + ) + + +class ServiceDefinitionV2Dot1Opsgenie(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie_region import ( + ServiceDefinitionV2Dot1OpsgenieRegion, + ) + + return { + "region": (ServiceDefinitionV2Dot1OpsgenieRegion,), + "service_url": (str,), + } + + attribute_map = { + "region": "region", + "service_url": "service-url", + } + + def __init__( + self_, service_url: str, region: Union[ServiceDefinitionV2Dot1OpsgenieRegion, UnsetType] = unset, **kwargs + ): + """ + Opsgenie integration for the service. + + :param region: Opsgenie instance region. + :type region: ServiceDefinitionV2Dot1OpsgenieRegion, optional + + :param service_url: Opsgenie service url. + :type service_url: str + """ + if region is not unset: + kwargs["region"] = region + super().__init__(kwargs) + + self_.service_url = service_url diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie_region.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie_region.py new file mode 100644 index 0000000000..32c329ddce --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_opsgenie_region.py @@ -0,0 +1,38 @@ +# 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 ServiceDefinitionV2Dot1OpsgenieRegion(ModelSimple): + """ + Opsgenie instance region. + + :param value: Must be one of ["US", "EU"]. + :type value: str + """ + + allowed_values = { + "US", + "EU", + } + US: ClassVar["ServiceDefinitionV2Dot1OpsgenieRegion"] + EU: ClassVar["ServiceDefinitionV2Dot1OpsgenieRegion"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceDefinitionV2Dot1OpsgenieRegion.US = ServiceDefinitionV2Dot1OpsgenieRegion("US") +ServiceDefinitionV2Dot1OpsgenieRegion.EU = ServiceDefinitionV2Dot1OpsgenieRegion("EU") diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_pagerduty.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_pagerduty.py new file mode 100644 index 0000000000..100fb30d61 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_pagerduty.py @@ -0,0 +1,36 @@ +# 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 ServiceDefinitionV2Dot1Pagerduty(ModelNormal): + @cached_property + def openapi_types(_): + return { + "service_url": (str,), + } + + attribute_map = { + "service_url": "service-url", + } + + def __init__(self_, service_url: Union[str, UnsetType] = unset, **kwargs): + """ + PagerDuty integration for the service. + + :param service_url: PagerDuty service url. + :type service_url: str, optional + """ + if service_url is not unset: + kwargs["service_url"] = service_url + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_slack.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_slack.py new file mode 100644 index 0000000000..f9b66218dd --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_slack.py @@ -0,0 +1,57 @@ +# 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.service_definition_v2_dot1_slack_type import ServiceDefinitionV2Dot1SlackType + + +class ServiceDefinitionV2Dot1Slack(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot1_slack_type import ServiceDefinitionV2Dot1SlackType + + return { + "contact": (str,), + "name": (str,), + "type": (ServiceDefinitionV2Dot1SlackType,), + } + + attribute_map = { + "contact": "contact", + "name": "name", + "type": "type", + } + + def __init__( + self_, contact: str, type: ServiceDefinitionV2Dot1SlackType, name: Union[str, UnsetType] = unset, **kwargs + ): + """ + Service owner's Slack channel. + + :param contact: Slack Channel. + :type contact: str + + :param name: Contact Slack. + :type name: str, optional + + :param type: Contact type. + :type type: ServiceDefinitionV2Dot1SlackType + """ + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) + + self_.contact = contact + self_.type = type diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_slack_type.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_slack_type.py new file mode 100644 index 0000000000..64fc574da9 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_slack_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 ServiceDefinitionV2Dot1SlackType(ModelSimple): + """ + Contact type. + + :param value: If omitted defaults to "slack". Must be one of ["slack"]. + :type value: str + """ + + allowed_values = { + "slack", + } + SLACK: ClassVar["ServiceDefinitionV2Dot1SlackType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceDefinitionV2Dot1SlackType.SLACK = ServiceDefinitionV2Dot1SlackType("slack") diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot1_version.py b/src/datadog_api_client/v2/model/service_definition_v2_dot1_version.py new file mode 100644 index 0000000000..6bf9ddb88c --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot1_version.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 ServiceDefinitionV2Dot1Version(ModelSimple): + """ + Schema version being used. + + :param value: If omitted defaults to "v2.1". Must be one of ["v2.1"]. + :type value: str + """ + + allowed_values = { + "v2.1", + } + V2_1: ClassVar["ServiceDefinitionV2Dot1Version"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceDefinitionV2Dot1Version.V2_1 = ServiceDefinitionV2Dot1Version("v2.1") diff --git a/src/datadog_api_client/v2/model/service_definitions_create_request.py b/src/datadog_api_client/v2/model/service_definitions_create_request.py index 068037d7f8..a137a16b87 100644 --- a/src/datadog_api_client/v2/model/service_definitions_create_request.py +++ b/src/datadog_api_client/v2/model/service_definitions_create_request.py @@ -15,38 +15,50 @@ def __init__(self, **kwargs): """ Create service definitions request. + :param application: Identifier for a group of related services serving a product feature, which the service is a part of. + :type application: str, optional + :param contacts: A list of contacts related to the services. - :type contacts: [ServiceDefinitionV2Contact], optional + :type contacts: [ServiceDefinitionV2Dot1Contact], optional :param dd_service: Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog. :type dd_service: str - :param dd_team: Experimental feature. A Team handle that matches a Team in the Datadog Teams product. - :type dd_team: str, optional - - :param docs: A list of documentation related to the services. - :type docs: [ServiceDefinitionV2Doc], optional + :param description: A short description of the service. + :type description: str, optional - :param extensions: Extensions to V2 schema. + :param extensions: Extensions to v2.1 schema. :type extensions: {str: (bool, date, datetime, dict, float, int, list, str, none_type,)}, optional :param integrations: Third party integrations that Datadog supports. - :type integrations: ServiceDefinitionV2Integrations, optional + :type integrations: ServiceDefinitionV2Dot1Integrations, optional - :param links: A list of links related to the services. - :type links: [ServiceDefinitionV2Link], optional + :param lifecycle: The current life cycle phase of the service. + :type lifecycle: str, optional - :param repos: A list of code repositories related to the services. - :type repos: [ServiceDefinitionV2Repo], optional + :param links: A list of links related to the services. + :type links: [ServiceDefinitionV2Dot1Link], optional :param schema_version: Schema version being used. - :type schema_version: ServiceDefinitionV2Version + :type schema_version: ServiceDefinitionV2Dot1Version :param tags: A set of custom tags. :type tags: [str], optional - :param team: Team that owns the service. + :param team: Team that owns the service. It is used to locate a team defined in Datadog Teams if it exists. :type team: str, optional + + :param tier: Importance of the service. + :type tier: str, optional + + :param dd_team: Experimental feature. A Team handle that matches a Team in the Datadog Teams product. + :type dd_team: str, optional + + :param docs: A list of documentation related to the services. + :type docs: [ServiceDefinitionV2Doc], optional + + :param repos: A list of code repositories related to the services. + :type repos: [ServiceDefinitionV2Repo], optional """ super().__init__(kwargs) @@ -59,10 +71,12 @@ def _composed_schemas(_): # code would be run when this module is imported, and these composed # classes don't exist yet because their module has not finished # loading + from datadog_api_client.v2.model.service_definition_v2_dot1 import ServiceDefinitionV2Dot1 from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2 return { "oneOf": [ + ServiceDefinitionV2Dot1, ServiceDefinitionV2, str, ], diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 8434504c4b..9225caef3c 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1012,6 +1012,19 @@ from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2 from datadog_api_client.v2.model.service_definition_v2_contact import ServiceDefinitionV2Contact from datadog_api_client.v2.model.service_definition_v2_doc import ServiceDefinitionV2Doc +from datadog_api_client.v2.model.service_definition_v2_dot1 import ServiceDefinitionV2Dot1 +from datadog_api_client.v2.model.service_definition_v2_dot1_contact import ServiceDefinitionV2Dot1Contact +from datadog_api_client.v2.model.service_definition_v2_dot1_email import ServiceDefinitionV2Dot1Email +from datadog_api_client.v2.model.service_definition_v2_dot1_email_type import ServiceDefinitionV2Dot1EmailType +from datadog_api_client.v2.model.service_definition_v2_dot1_integrations import ServiceDefinitionV2Dot1Integrations +from datadog_api_client.v2.model.service_definition_v2_dot1_link import ServiceDefinitionV2Dot1Link +from datadog_api_client.v2.model.service_definition_v2_dot1_link_type import ServiceDefinitionV2Dot1LinkType +from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie import ServiceDefinitionV2Dot1Opsgenie +from datadog_api_client.v2.model.service_definition_v2_dot1_opsgenie_region import ServiceDefinitionV2Dot1OpsgenieRegion +from datadog_api_client.v2.model.service_definition_v2_dot1_pagerduty import ServiceDefinitionV2Dot1Pagerduty +from datadog_api_client.v2.model.service_definition_v2_dot1_slack import ServiceDefinitionV2Dot1Slack +from datadog_api_client.v2.model.service_definition_v2_dot1_slack_type import ServiceDefinitionV2Dot1SlackType +from datadog_api_client.v2.model.service_definition_v2_dot1_version import ServiceDefinitionV2Dot1Version from datadog_api_client.v2.model.service_definition_v2_email import ServiceDefinitionV2Email from datadog_api_client.v2.model.service_definition_v2_email_type import ServiceDefinitionV2EmailType from datadog_api_client.v2.model.service_definition_v2_integrations import ServiceDefinitionV2Integrations diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.frozen index be705da1fc..7135c3fee4 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.frozen @@ -1 +1 @@ -2022-11-10T21:14:44.544Z \ No newline at end of file +2023-03-24T18:06:23.874Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.yaml index 9c1d3674e9..8fa7140687 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_returns_created_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-Test-Create_or_update_service_definition_returns_CREATED_response-1668114884","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google + body: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-testcreateorupdateservicedefinitionreturnscreatedresponse1679681183","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google drive","url":"https://gdrive/mydoc"}],"extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"schema-version":"v2","tags":["my:tag","service:tag"],"team":"my-team"}' headers: @@ -12,7 +12,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/services/definitions response: body: - string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2022-11-10T21:14:45.52228008Z","github-html-url":"","ingestion-source":"api","warnings":[],"ingested-schema-version":"v2"},"schema":{"schema-version":"v2","dd-service":"service-test-create_or_update_service_definition_returns_created_response-1668114884","dd-team":"my-team","team":"my-team","contacts":[{"name":"Team + string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2023-03-24T18:06:24.041193351Z","github-html-url":"","ingestion-source":"api","origin":"unknown","origin-detail":"","warnings":[],"ingested-schema-version":"v2"},"schema":{"schema-version":"v2","dd-service":"service-testcreateorupdateservicedefinitionreturnscreatedresponse1679681183","dd-team":"my-team","team":"my-team","contacts":[{"name":"Team Email","type":"email","contact":"contact@datadoghq.com"}],"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"docs":[{"name":"Architecture","provider":"google drive","url":"https://gdrive/mydoc"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService","opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"}}}}]} @@ -30,7 +30,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/services/definitions/service-test-create_or_update_service_definition_returns_created_response-1668114884 + uri: https://api.datadoghq.com/api/v2/services/definitions/service-testcreateorupdateservicedefinitionreturnscreatedresponse1679681183 response: body: string: '{"errors":["Not Found"],"error_details":[{}]} diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.frozen new file mode 100644 index 0000000000..bb26b176b5 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.frozen @@ -0,0 +1 @@ +2023-03-24T19:21:52.794Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.yaml new file mode 100644 index 0000000000..bfda7cbab2 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_1_returns_created_response.yaml @@ -0,0 +1,45 @@ +interactions: +- request: + body: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-Test-Create_or_update_service_definition_using_schema_v2_1_returns_CREATED_response-1679685712","extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"}},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source + Code","provider":"GitHub","type":"repo","url":"https://github.com/DataDog/schema"},{"name":"Architecture","provider":"Gigoogle + drivetHub","type":"doc","url":"https://my-runbook"}],"schema-version":"v2.1","tags":["my:tag","service:tag"],"team":"my-team"}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/services/definitions + response: + body: + string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2023-03-24T19:21:52.88531429Z","github-html-url":"","ingestion-source":"api","origin":"unknown","origin-detail":"","warnings":[],"ingested-schema-version":"v2.1"},"schema":{"schema-version":"v2.1","dd-service":"service-test-create_or_update_service_definition_using_schema_v2_1_returns_created_response-1679685712","team":"my-team","contacts":[{"name":"Team + Email","type":"email","contact":"contact@datadoghq.com"}],"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source + Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"},{"name":"Architecture","type":"doc","provider":"Gigoogle + drivetHub","url":"https://my-runbook"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"},"opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"}}}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/services/definitions/service-test-create_or_update_service_definition_using_schema_v2_1_returns_created_response-1679685712 + response: + body: + string: '{"errors":["Not Found"],"error_details":[{}]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.frozen new file mode 100644 index 0000000000..99e4222114 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.frozen @@ -0,0 +1 @@ +2023-03-24T19:21:51.782Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.yaml new file mode 100644 index 0000000000..f594d1c90f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v2_returns_created_response.yaml @@ -0,0 +1,45 @@ +interactions: +- request: + body: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-testcreateorupdateservicedefinitionusingschemav2returnscreatedresponse1679685711","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google + drive","url":"https://gdrive/mydoc"}],"extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source + Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"schema-version":"v2","tags":["my:tag","service:tag"],"team":"my-team"}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/services/definitions + response: + body: + string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2023-03-24T19:21:52.44477064Z","github-html-url":"","ingestion-source":"api","origin":"unknown","origin-detail":"","warnings":[],"ingested-schema-version":"v2"},"schema":{"schema-version":"v2","dd-service":"service-testcreateorupdateservicedefinitionusingschemav2returnscreatedresponse1679685711","dd-team":"my-team","team":"my-team","contacts":[{"name":"Team + Email","type":"email","contact":"contact@datadoghq.com"}],"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source + Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"docs":[{"name":"Architecture","provider":"google + drive","url":"https://gdrive/mydoc"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService","opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"}}}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/services/definitions/service-testcreateorupdateservicedefinitionusingschemav2returnscreatedresponse1679685711 + response: + body: + string: '{"errors":["Not Found"],"error_details":[{}]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 4d11081660..868c8c12e3 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -448,7 +448,7 @@ "parameters": [ { "name": "body", - "value": "{\n \"dd-service\": \"service-{{ unique}}\",\n \"dd-team\": \"my-team\",\n \"docs\": [{\"name\": \"Architecture\",\n \"provider\": \"google drive\",\n \"url\": \"https://gdrive/mygivedoc\"}],\n \"extensions\": {\"frogextension\": \"extensionfrogvalue\"},\n \"integrations\": {\"opsgenie\": {\"region\": \"US\",\n \"service-url\": \"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000\"},\n \"pagerduty\": \"https://my-org.pagerduty.com/service-directory/PMyService\"},\n \"links\": [{\"name\": \"Runbook\", \"type\": \"runbook\", \"url\": \"https://my-runbook\"}],\n \"repos\": [{\"name\": \"Source Code\",\n \"provider\": \"GitHub\",\n \"url\": \"https://github.com/DataDog/given\"}],\n \"schema-version\": \"v2\",\n \"tags\": [\"this:tag\", \"service:tag\"],\n \"team\": \"super-team\"\n}" + "value": "{\n \"dd-service\": \"service-{{ unique_lower_alnum }}\",\n \"dd-team\": \"my-team\",\n \"docs\": [{\"name\": \"Architecture\",\n \"provider\": \"google drive\",\n \"url\": \"https://gdrive/mygivedoc\"}],\n \"extensions\": {\"frogextension\": \"extensionfrogvalue\"},\n \"integrations\": {\"opsgenie\": {\"region\": \"US\",\n \"service-url\": \"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000\"},\n \"pagerduty\": \"https://my-org.pagerduty.com/service-directory/PMyService\"},\n \"links\": [{\"name\": \"Runbook\", \"type\": \"runbook\", \"url\": \"https://my-runbook\"}],\n \"repos\": [{\"name\": \"Source Code\",\n \"provider\": \"GitHub\",\n \"url\": \"https://github.com/DataDog/given\"}],\n \"schema-version\": \"v2\",\n \"tags\": [\"this:tag\", \"service:tag\"],\n \"team\": \"super-team\"\n}" } ], "step": "there is a valid \"service_definition\" in the system", diff --git a/tests/v2/features/service_definition.feature b/tests/v2/features/service_definition.feature index be57dce43b..d995181839 100644 --- a/tests/v2/features/service_definition.feature +++ b/tests/v2/features/service_definition.feature @@ -7,37 +7,53 @@ Feature: Service Definition And a valid "appKeyAuth" key in the system And an instance of "ServiceDefinition" API - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "Bad Request" response Given new "CreateOrUpdateServiceDefinitions" request - And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + And body with value {"application": "my-app", "contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.1", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 400 Bad Request - @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "CREATED" response Given new "CreateOrUpdateServiceDefinitions" request - And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "service-{{ unique }}", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorgextension": "extensionvalue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + And body with value {"application": "my-app", "contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.1", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 200 CREATED - And the response "data[0].attributes.meta.ingested-schema-version" is equal to "v2" - And the response "data[0].attributes.schema.dd-service" is equal to "service-{{ unique_lower }}" - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "Conflict" response Given new "CreateOrUpdateServiceDefinitions" request - And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + And body with value {"application": "my-app", "contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.1", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 409 Conflict - @generated @skip @team:DataDog/apm-insights + @team:DataDog/service-catalog + Scenario: Create or update service definition using schema v2 returns "CREATED" response + Given new "CreateOrUpdateServiceDefinitions" request + And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "service-{{ unique_lower_alnum }}", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorgextension": "extensionvalue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + When the request is sent + Then the response status is 200 CREATED + And the response "data[0].attributes.meta.ingested-schema-version" is equal to "v2" + And the response "data[0].attributes.schema.dd-service" is equal to "service-{{ unique_lower_alnum }}" + + @team:DataDog/service-catalog + Scenario: Create or update service definition using schema v2.1 returns "CREATED" response + Given new "CreateOrUpdateServiceDefinitions" request + And body with value {"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-{{ unique }}","extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"}},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"},{"name":"Architecture","type":"doc","provider":"Gigoogle drivetHub","url":"https://my-runbook"}],"schema-version":"v2.1","tags":["my:tag","service:tag"],"team":"my-team"} + When the request is sent + Then the response status is 200 CREATED + And the response "data[0].attributes.meta.ingested-schema-version" is equal to "v2.1" + And the response "data[0].attributes.schema.dd-service" is equal to "service-{{ unique_lower }}" + + @generated @skip @team:DataDog/service-catalog Scenario: Delete a single service definition returns "Bad Request" response Given new "DeleteServiceDefinition" request And request contains "service_name" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Delete a single service definition returns "Not Found" response Given new "DeleteServiceDefinition" request And request contains "service_name" parameter with value "not-a-service" @@ -45,28 +61,28 @@ Feature: Service Definition Then the response status is 404 Not Found And the response "errors[0]" is equal to "Not Found" - @replay-only @team:DataDog/apm-insights + @replay-only @team:DataDog/service-catalog Scenario: Delete a single service definition returns "OK" response Given new "DeleteServiceDefinition" request And request contains "service_name" parameter with value "service-definition-test" When the request is sent Then the response status is 204 OK - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Get a single service definition returns "Bad Request" response Given new "GetServiceDefinition" request And request contains "service_name" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Get a single service definition returns "Conflict" response Given new "GetServiceDefinition" request And request contains "service_name" parameter from "REPLACE.ME" When the request is sent Then the response status is 409 Conflict - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Get a single service definition returns "Not Found" response Given new "GetServiceDefinition" request And request contains "service_name" parameter with value "not-a-service" @@ -74,7 +90,7 @@ Feature: Service Definition Then the response status is 404 Not Found And the response "errors[0]" is equal to "Not Found" - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Get a single service definition returns "OK" response Given new "GetServiceDefinition" request And request contains "service_name" parameter with value "service-definition-test" @@ -83,7 +99,7 @@ Feature: Service Definition And the response "data.attributes.meta.ingested-schema-version" is equal to "v2" And the response "data.attributes.schema.dd-service" is equal to "service-definition-test" - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Get all service definitions returns "OK" response Given new "ListServiceDefinitions" request When the request is sent