From 9ebc6ebe82e9a01e74468b33cb6a7e451c421dbf Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 6 Oct 2023 18:52:28 +0000 Subject: [PATCH] Regenerate client from commit 52d61f02 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 176 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 49 +++++ .../CreateOrUpdateServiceDefinitions.py | 53 +++--- ...teOrUpdateServiceDefinitions_2621709423.py | 67 +++++++ .../v2/api/service_definition_api.py | 5 +- .../service_definition_data_attributes.py | 8 +- .../v2/model/service_definition_schema.py | 8 + .../service_definition_schema_versions.py | 5 +- .../v2/model/service_definition_v2_dot2.py | 174 +++++++++++++++++ .../service_definition_v2_dot2_contact.py | 49 +++++ ...service_definition_v2_dot2_integrations.py | 56 ++++++ .../model/service_definition_v2_dot2_link.py | 55 ++++++ .../service_definition_v2_dot2_opsgenie.py | 55 ++++++ ...vice_definition_v2_dot2_opsgenie_region.py | 38 ++++ .../service_definition_v2_dot2_pagerduty.py | 36 ++++ .../service_definition_v2_dot2_version.py | 35 ++++ .../service_definitions_create_request.py | 18 +- src/datadog_api_client/v2/models/__init__.py | 16 ++ ...schema_v22_returns_created_response.frozen | 1 + ...g_schema_v22_returns_created_response.yaml | 45 +++++ tests/v2/features/service_definition.feature | 15 +- 22 files changed, 935 insertions(+), 37 deletions(-) create mode 100644 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2_contact.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2_integrations.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2_link.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2_opsgenie.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2_opsgenie_region.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2_pagerduty.py create mode 100644 src/datadog_api_client/v2/model/service_definition_v2_dot2_version.py create mode 100644 tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.yaml diff --git a/.apigentools-info b/.apigentools-info index a683815216..80c8f4ddfa 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-10-05 20:05:40.670859", - "spec_repo_commit": "f7a95272" + "regenerated": "2023-10-06 18:50:52.443018", + "spec_repo_commit": "52d61f02" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-10-05 20:05:40.684801", - "spec_repo_commit": "f7a95272" + "regenerated": "2023-10-06 18:50:52.463981", + "spec_repo_commit": "52d61f02" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0eca5ce93f..3e0cd4b36a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -14994,6 +14994,7 @@ components: - $ref: '#/components/schemas/ServiceDefinitionV1' - $ref: '#/components/schemas/ServiceDefinitionV2' - $ref: '#/components/schemas/ServiceDefinitionV2Dot1' + - $ref: '#/components/schemas/ServiceDefinitionV2Dot2' type: object ServiceDefinitionSchemaVersions: description: Schema versions @@ -15001,11 +15002,13 @@ components: - v1 - v2 - v2.1 + - v2.2 type: string x-enum-varnames: - V1 - V2 - V2_1 + - V2_2 ServiceDefinitionV1: deprecated: true description: Deprecated - Service definition V1 for providing additional service @@ -15466,6 +15469,178 @@ components: type: string x-enum-varnames: - V2_1 + ServiceDefinitionV2Dot2: + description: Service definition v2.2 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/ServiceDefinitionV2Dot2Contact' + 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.2 schema. + example: + myorg/extension: extensionValue + type: object + integrations: + $ref: '#/components/schemas/ServiceDefinitionV2Dot2Integrations' + langauges: + description: The service's programming language. See example for a list + of recognizable languages. + example: + - dotnet + - go + - java + - js + - php + - python + - ruby + - c++ + items: + type: string + type: array + 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/ServiceDefinitionV2Dot2Link' + type: array + schema-version: + $ref: '#/components/schemas/ServiceDefinitionV2Dot2Version' + service-type: + description: The type of service. See example for a list of recognizable + service types. + example: '''database'', ''cache'', ''function'', ''web'', ''browser'', ''mobile''' + type: string + 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 + ServiceDefinitionV2Dot2Contact: + description: Service owner's contacts information. + properties: + contact: + description: Contact value. + example: https://teams.microsoft.com/myteam + type: string + name: + description: Contact Name. + example: My team channel + type: string + type: + description: Contact type. See example for a list of recognizable types. + example: '''email'', ''slack'', ''microsoft-teams''' + type: string + required: + - type + - contact + type: object + ServiceDefinitionV2Dot2Integrations: + description: Third party integrations that Datadog supports. + properties: + opsgenie: + $ref: '#/components/schemas/ServiceDefinitionV2Dot2Opsgenie' + pagerduty: + $ref: '#/components/schemas/ServiceDefinitionV2Dot2Pagerduty' + type: object + ServiceDefinitionV2Dot2Link: + description: Service's external links. + properties: + name: + description: Link name. + example: Runbook + type: string + provider: + description: Link provider. + example: Github + type: string + type: + description: Link type. See example for a list of recognizable types. + example: '''runbook'', ''doc'', ''repo'', ''dashboard'', ''other''' + type: string + url: + description: Link URL. + example: https://my-runbook + type: string + required: + - name + - type + - url + type: object + ServiceDefinitionV2Dot2Opsgenie: + description: Opsgenie integration for the service. + properties: + region: + $ref: '#/components/schemas/ServiceDefinitionV2Dot2OpsgenieRegion' + 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 + ServiceDefinitionV2Dot2OpsgenieRegion: + description: Opsgenie instance region. + enum: + - US + - EU + example: US + type: string + x-enum-varnames: + - US + - EU + ServiceDefinitionV2Dot2Pagerduty: + 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 + ServiceDefinitionV2Dot2Version: + default: v2.2 + description: Schema version being used. + enum: + - v2.2 + example: v2.2 + type: string + x-enum-varnames: + - V2_2 ServiceDefinitionV2Email: description: Service owner's email. properties: @@ -15649,6 +15824,7 @@ components: ServiceDefinitionsCreateRequest: description: Create service definitions request. oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV2Dot2' - $ref: '#/components/schemas/ServiceDefinitionV2Dot1' - $ref: '#/components/schemas/ServiceDefinitionV2' - $ref: '#/components/schemas/ServiceDefinitionRaw' diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 79e2a6eb22..9bb4a6b33f 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -6875,6 +6875,55 @@ service\_definition\_v2\_dot1\_slack\_type :members: :show-inheritance: +service\_definition\_v2\_dot2 +----------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2 + :members: + :show-inheritance: + +service\_definition\_v2\_dot2\_contact +-------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2_contact + :members: + :show-inheritance: + +service\_definition\_v2\_dot2\_integrations +------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2_integrations + :members: + :show-inheritance: + +service\_definition\_v2\_dot2\_link +----------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2_link + :members: + :show-inheritance: + +service\_definition\_v2\_dot2\_opsgenie +--------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie + :members: + :show-inheritance: + +service\_definition\_v2\_dot2\_opsgenie\_region +----------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie_region + :members: + :show-inheritance: + +service\_definition\_v2\_dot2\_pagerduty +---------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty + :members: + :show-inheritance: + service\_definition\_v2\_email ------------------------------ diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py index 6d2314ee88..d741bed047 100644 --- a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py @@ -4,48 +4,57 @@ 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 +from datadog_api_client.v2.model.service_definition_v2_dot2 import ServiceDefinitionV2Dot2 +from datadog_api_client.v2.model.service_definition_v2_dot2_contact import ServiceDefinitionV2Dot2Contact +from datadog_api_client.v2.model.service_definition_v2_dot2_integrations import ServiceDefinitionV2Dot2Integrations +from datadog_api_client.v2.model.service_definition_v2_dot2_link import ServiceDefinitionV2Dot2Link +from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie import ServiceDefinitionV2Dot2Opsgenie +from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie_region import ServiceDefinitionV2Dot2OpsgenieRegion +from datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty import ServiceDefinitionV2Dot2Pagerduty +from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version -body = ServiceDefinitionV2Dot1( +body = ServiceDefinitionV2Dot2( application="my-app", contacts=[ - ServiceDefinitionV2Dot1Email( - contact="contact@datadoghq.com", - name="Team Email", - type=ServiceDefinitionV2Dot1EmailType.EMAIL, + ServiceDefinitionV2Dot2Contact( + contact="https://teams.microsoft.com/myteam", + name="My team channel", + type="'email', 'slack', 'microsoft-teams'", ), ], dd_service="my-service", description="My service description", extensions=dict([("myorg/extension", "extensionValue")]), - integrations=ServiceDefinitionV2Dot1Integrations( - opsgenie=ServiceDefinitionV2Dot1Opsgenie( - region=ServiceDefinitionV2Dot1OpsgenieRegion.US, + integrations=ServiceDefinitionV2Dot2Integrations( + opsgenie=ServiceDefinitionV2Dot2Opsgenie( + region=ServiceDefinitionV2Dot2OpsgenieRegion.US, service_url="https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", ), - pagerduty=ServiceDefinitionV2Dot1Pagerduty( + pagerduty=ServiceDefinitionV2Dot2Pagerduty( service_url="https://my-org.pagerduty.com/service-directory/PMyService", ), ), + langauges=[ + "dotnet", + "go", + "java", + "js", + "php", + "python", + "ruby", + "c++", + ], lifecycle="sandbox", links=[ - ServiceDefinitionV2Dot1Link( + ServiceDefinitionV2Dot2Link( name="Runbook", provider="Github", - type=ServiceDefinitionV2Dot1LinkType.RUNBOOK, + type="'runbook', 'doc', 'repo', 'dashboard', 'other'", url="https://my-runbook", ), ], - schema_version=ServiceDefinitionV2Dot1Version.V2_1, + schema_version=ServiceDefinitionV2Dot2Version.V2_2, + service_type="'database', 'cache', 'function', 'web', 'browser', 'mobile'", tags=[ "my:tag", "service:tag", diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.py b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.py new file mode 100644 index 0000000000..4f565c4800 --- /dev/null +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.py @@ -0,0 +1,67 @@ +""" +Create or update service definition using schema v2-2 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_dot2 import ServiceDefinitionV2Dot2 +from datadog_api_client.v2.model.service_definition_v2_dot2_contact import ServiceDefinitionV2Dot2Contact +from datadog_api_client.v2.model.service_definition_v2_dot2_integrations import ServiceDefinitionV2Dot2Integrations +from datadog_api_client.v2.model.service_definition_v2_dot2_link import ServiceDefinitionV2Dot2Link +from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie import ServiceDefinitionV2Dot2Opsgenie +from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie_region import ServiceDefinitionV2Dot2OpsgenieRegion +from datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty import ServiceDefinitionV2Dot2Pagerduty +from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version + +body = ServiceDefinitionV2Dot2( + contacts=[ + ServiceDefinitionV2Dot2Contact( + contact="contact@datadoghq.com", + name="Team Email", + type="email", + ), + ], + dd_service="service-exampleservicedefinition", + extensions=dict([("myorgextension", "extensionvalue")]), + integrations=ServiceDefinitionV2Dot2Integrations( + opsgenie=ServiceDefinitionV2Dot2Opsgenie( + region=ServiceDefinitionV2Dot2OpsgenieRegion.US, + service_url="https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", + ), + pagerduty=ServiceDefinitionV2Dot2Pagerduty( + service_url="https://my-org.pagerduty.com/service-directory/PMyService", + ), + ), + links=[ + ServiceDefinitionV2Dot2Link( + name="Runbook", + type="runbook", + url="https://my-runbook", + ), + ServiceDefinitionV2Dot2Link( + name="Source Code", + type="repo", + provider="GitHub", + url="https://github.com/DataDog/schema", + ), + ServiceDefinitionV2Dot2Link( + name="Architecture", + type="doc", + provider="Gigoogle drivetHub", + url="https://my-runbook", + ), + ], + schema_version=ServiceDefinitionV2Dot2Version.V2_2, + 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 3bb66d4700..d52aa9102f 100644 --- a/src/datadog_api_client/v2/api/service_definition_api.py +++ b/src/datadog_api_client/v2/api/service_definition_api.py @@ -19,6 +19,7 @@ from datadog_api_client.v2.model.service_definition_data import ServiceDefinitionData 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_dot2 import ServiceDefinitionV2Dot2 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 @@ -139,7 +140,9 @@ def __init__(self, api_client=None): def create_or_update_service_definitions( self, - body: Union[ServiceDefinitionsCreateRequest, ServiceDefinitionV2Dot1, ServiceDefinitionV2, str], + body: Union[ + ServiceDefinitionsCreateRequest, ServiceDefinitionV2Dot2, 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 b1f47180e5..8a1603a13d 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 @@ -19,6 +19,7 @@ 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 + from datadog_api_client.v2.model.service_definition_v2_dot2 import ServiceDefinitionV2Dot2 class ServiceDefinitionDataAttributes(ModelNormal): @@ -41,7 +42,12 @@ def __init__( self_, meta: Union[ServiceDefinitionMeta, UnsetType] = unset, schema: Union[ - ServiceDefinitionSchema, ServiceDefinitionV1, ServiceDefinitionV2, ServiceDefinitionV2Dot1, UnsetType + ServiceDefinitionSchema, + ServiceDefinitionV1, + ServiceDefinitionV2, + ServiceDefinitionV2Dot1, + ServiceDefinitionV2Dot2, + 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 1d22f69c66..d0f61e35cc 100644 --- a/src/datadog_api_client/v2/model/service_definition_schema.py +++ b/src/datadog_api_client/v2/model/service_definition_schema.py @@ -71,6 +71,12 @@ def __init__(self, **kwargs): :param tier: Importance of the service. :type tier: str, optional + + :param langauges: The service's programming language. See example for a list of recognizable languages. + :type langauges: [str], optional + + :param service_type: The type of service. See example for a list of recognizable service types. + :type service_type: str, optional """ super().__init__(kwargs) @@ -86,11 +92,13 @@ def _composed_schemas(_): 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 + from datadog_api_client.v2.model.service_definition_v2_dot2 import ServiceDefinitionV2Dot2 return { "oneOf": [ ServiceDefinitionV1, ServiceDefinitionV2, ServiceDefinitionV2Dot1, + ServiceDefinitionV2Dot2, ], } diff --git a/src/datadog_api_client/v2/model/service_definition_schema_versions.py b/src/datadog_api_client/v2/model/service_definition_schema_versions.py index 4012170fb2..5f71c34565 100644 --- a/src/datadog_api_client/v2/model/service_definition_schema_versions.py +++ b/src/datadog_api_client/v2/model/service_definition_schema_versions.py @@ -16,7 +16,7 @@ class ServiceDefinitionSchemaVersions(ModelSimple): """ Schema versions - :param value: Must be one of ["v1", "v2", "v2.1"]. + :param value: Must be one of ["v1", "v2", "v2.1", "v2.2"]. :type value: str """ @@ -24,10 +24,12 @@ class ServiceDefinitionSchemaVersions(ModelSimple): "v1", "v2", "v2.1", + "v2.2", } V1: ClassVar["ServiceDefinitionSchemaVersions"] V2: ClassVar["ServiceDefinitionSchemaVersions"] V2_1: ClassVar["ServiceDefinitionSchemaVersions"] + V2_2: ClassVar["ServiceDefinitionSchemaVersions"] @cached_property def openapi_types(_): @@ -39,3 +41,4 @@ def openapi_types(_): ServiceDefinitionSchemaVersions.V1 = ServiceDefinitionSchemaVersions("v1") ServiceDefinitionSchemaVersions.V2 = ServiceDefinitionSchemaVersions("v2") ServiceDefinitionSchemaVersions.V2_1 = ServiceDefinitionSchemaVersions("v2.1") +ServiceDefinitionSchemaVersions.V2_2 = ServiceDefinitionSchemaVersions("v2.2") diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot2.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2.py new file mode 100644 index 0000000000..3a98ac14e7 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2.py @@ -0,0 +1,174 @@ +# 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_dot2_contact import ServiceDefinitionV2Dot2Contact + from datadog_api_client.v2.model.service_definition_v2_dot2_integrations import ServiceDefinitionV2Dot2Integrations + from datadog_api_client.v2.model.service_definition_v2_dot2_link import ServiceDefinitionV2Dot2Link + from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version + + +class ServiceDefinitionV2Dot2(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot2_contact import ServiceDefinitionV2Dot2Contact + from datadog_api_client.v2.model.service_definition_v2_dot2_integrations import ( + ServiceDefinitionV2Dot2Integrations, + ) + from datadog_api_client.v2.model.service_definition_v2_dot2_link import ServiceDefinitionV2Dot2Link + from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version + + return { + "application": (str,), + "contacts": ([ServiceDefinitionV2Dot2Contact],), + "dd_service": (str,), + "description": (str,), + "extensions": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) + }, + ), + "integrations": (ServiceDefinitionV2Dot2Integrations,), + "langauges": ([str],), + "lifecycle": (str,), + "links": ([ServiceDefinitionV2Dot2Link],), + "schema_version": (ServiceDefinitionV2Dot2Version,), + "service_type": (str,), + "tags": ([str],), + "team": (str,), + "tier": (str,), + } + + attribute_map = { + "application": "application", + "contacts": "contacts", + "dd_service": "dd-service", + "description": "description", + "extensions": "extensions", + "integrations": "integrations", + "langauges": "langauges", + "lifecycle": "lifecycle", + "links": "links", + "schema_version": "schema-version", + "service_type": "service-type", + "tags": "tags", + "team": "team", + "tier": "tier", + } + + def __init__( + self_, + dd_service: str, + schema_version: ServiceDefinitionV2Dot2Version, + application: Union[str, UnsetType] = unset, + contacts: Union[List[ServiceDefinitionV2Dot2Contact], UnsetType] = unset, + description: Union[str, UnsetType] = unset, + extensions: Union[Dict[str, Any], UnsetType] = unset, + integrations: Union[ServiceDefinitionV2Dot2Integrations, UnsetType] = unset, + langauges: Union[List[str], UnsetType] = unset, + lifecycle: Union[str, UnsetType] = unset, + links: Union[List[ServiceDefinitionV2Dot2Link], UnsetType] = unset, + service_type: Union[str, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + team: Union[str, UnsetType] = unset, + tier: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Service definition v2.2 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: [ServiceDefinitionV2Dot2Contact], 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.2 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: ServiceDefinitionV2Dot2Integrations, optional + + :param langauges: The service's programming language. See example for a list of recognizable languages. + :type langauges: [str], 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: [ServiceDefinitionV2Dot2Link], optional + + :param schema_version: Schema version being used. + :type schema_version: ServiceDefinitionV2Dot2Version + + :param service_type: The type of service. See example for a list of recognizable service types. + :type service_type: str, optional + + :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 langauges is not unset: + kwargs["langauges"] = langauges + if lifecycle is not unset: + kwargs["lifecycle"] = lifecycle + if links is not unset: + kwargs["links"] = links + if service_type is not unset: + kwargs["service_type"] = service_type + 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_dot2_contact.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2_contact.py new file mode 100644 index 0000000000..2cfa7ba69c --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2_contact.py @@ -0,0 +1,49 @@ +# 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 ServiceDefinitionV2Dot2Contact(ModelNormal): + @cached_property + def openapi_types(_): + return { + "contact": (str,), + "name": (str,), + "type": (str,), + } + + attribute_map = { + "contact": "contact", + "name": "name", + "type": "type", + } + + def __init__(self_, contact: str, type: str, name: Union[str, UnsetType] = unset, **kwargs): + """ + Service owner's contacts information. + + :param contact: Contact value. + :type contact: str + + :param name: Contact Name. + :type name: str, optional + + :param type: Contact type. See example for a list of recognizable types. + :type type: str + """ + 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_dot2_integrations.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2_integrations.py new file mode 100644 index 0000000000..279962d017 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2_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_dot2_opsgenie import ServiceDefinitionV2Dot2Opsgenie + from datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty import ServiceDefinitionV2Dot2Pagerduty + + +class ServiceDefinitionV2Dot2Integrations(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie import ServiceDefinitionV2Dot2Opsgenie + from datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty import ServiceDefinitionV2Dot2Pagerduty + + return { + "opsgenie": (ServiceDefinitionV2Dot2Opsgenie,), + "pagerduty": (ServiceDefinitionV2Dot2Pagerduty,), + } + + attribute_map = { + "opsgenie": "opsgenie", + "pagerduty": "pagerduty", + } + + def __init__( + self_, + opsgenie: Union[ServiceDefinitionV2Dot2Opsgenie, UnsetType] = unset, + pagerduty: Union[ServiceDefinitionV2Dot2Pagerduty, UnsetType] = unset, + **kwargs, + ): + """ + Third party integrations that Datadog supports. + + :param opsgenie: Opsgenie integration for the service. + :type opsgenie: ServiceDefinitionV2Dot2Opsgenie, optional + + :param pagerduty: PagerDuty integration for the service. + :type pagerduty: ServiceDefinitionV2Dot2Pagerduty, 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_dot2_link.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2_link.py new file mode 100644 index 0000000000..36b3db50c7 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2_link.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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class ServiceDefinitionV2Dot2Link(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "provider": (str,), + "type": (str,), + "url": (str,), + } + + attribute_map = { + "name": "name", + "provider": "provider", + "type": "type", + "url": "url", + } + + def __init__(self_, name: str, type: str, 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. See example for a list of recognizable types. + :type type: str + + :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_dot2_opsgenie.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2_opsgenie.py new file mode 100644 index 0000000000..e1803e65a5 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2_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_dot2_opsgenie_region import ( + ServiceDefinitionV2Dot2OpsgenieRegion, + ) + + +class ServiceDefinitionV2Dot2Opsgenie(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie_region import ( + ServiceDefinitionV2Dot2OpsgenieRegion, + ) + + return { + "region": (ServiceDefinitionV2Dot2OpsgenieRegion,), + "service_url": (str,), + } + + attribute_map = { + "region": "region", + "service_url": "service-url", + } + + def __init__( + self_, service_url: str, region: Union[ServiceDefinitionV2Dot2OpsgenieRegion, UnsetType] = unset, **kwargs + ): + """ + Opsgenie integration for the service. + + :param region: Opsgenie instance region. + :type region: ServiceDefinitionV2Dot2OpsgenieRegion, 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_dot2_opsgenie_region.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2_opsgenie_region.py new file mode 100644 index 0000000000..13184233f4 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2_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 ServiceDefinitionV2Dot2OpsgenieRegion(ModelSimple): + """ + Opsgenie instance region. + + :param value: Must be one of ["US", "EU"]. + :type value: str + """ + + allowed_values = { + "US", + "EU", + } + US: ClassVar["ServiceDefinitionV2Dot2OpsgenieRegion"] + EU: ClassVar["ServiceDefinitionV2Dot2OpsgenieRegion"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceDefinitionV2Dot2OpsgenieRegion.US = ServiceDefinitionV2Dot2OpsgenieRegion("US") +ServiceDefinitionV2Dot2OpsgenieRegion.EU = ServiceDefinitionV2Dot2OpsgenieRegion("EU") diff --git a/src/datadog_api_client/v2/model/service_definition_v2_dot2_pagerduty.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2_pagerduty.py new file mode 100644 index 0000000000..5c17058bb5 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2_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 ServiceDefinitionV2Dot2Pagerduty(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_dot2_version.py b/src/datadog_api_client/v2/model/service_definition_v2_dot2_version.py new file mode 100644 index 0000000000..bac603250f --- /dev/null +++ b/src/datadog_api_client/v2/model/service_definition_v2_dot2_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 ServiceDefinitionV2Dot2Version(ModelSimple): + """ + Schema version being used. + + :param value: If omitted defaults to "v2.2". Must be one of ["v2.2"]. + :type value: str + """ + + allowed_values = { + "v2.2", + } + V2_2: ClassVar["ServiceDefinitionV2Dot2Version"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceDefinitionV2Dot2Version.V2_2 = ServiceDefinitionV2Dot2Version("v2.2") 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 a137a16b87..5b1f1a4798 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 @@ -19,7 +19,7 @@ def __init__(self, **kwargs): :type application: str, optional :param contacts: A list of contacts related to the services. - :type contacts: [ServiceDefinitionV2Dot1Contact], optional + :type contacts: [ServiceDefinitionV2Dot2Contact], 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 @@ -27,20 +27,26 @@ def __init__(self, **kwargs): :param description: A short description of the service. :type description: str, optional - :param extensions: Extensions to v2.1 schema. + :param extensions: Extensions to v2.2 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 + :type integrations: ServiceDefinitionV2Dot2Integrations, optional + + :param langauges: The service's programming language. See example for a list of recognizable languages. + :type langauges: [str], 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 + :type links: [ServiceDefinitionV2Dot2Link], optional :param schema_version: Schema version being used. - :type schema_version: ServiceDefinitionV2Dot1Version + :type schema_version: ServiceDefinitionV2Dot2Version + + :param service_type: The type of service. See example for a list of recognizable service types. + :type service_type: str, optional :param tags: A set of custom tags. :type tags: [str], optional @@ -71,11 +77,13 @@ 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_dot2 import ServiceDefinitionV2Dot2 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": [ + ServiceDefinitionV2Dot2, ServiceDefinitionV2Dot1, ServiceDefinitionV2, str, diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 1d1231d36d..c65da5fb1e 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1204,6 +1204,14 @@ 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_dot2 import ServiceDefinitionV2Dot2 +from datadog_api_client.v2.model.service_definition_v2_dot2_contact import ServiceDefinitionV2Dot2Contact +from datadog_api_client.v2.model.service_definition_v2_dot2_integrations import ServiceDefinitionV2Dot2Integrations +from datadog_api_client.v2.model.service_definition_v2_dot2_link import ServiceDefinitionV2Dot2Link +from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie import ServiceDefinitionV2Dot2Opsgenie +from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie_region import ServiceDefinitionV2Dot2OpsgenieRegion +from datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty import ServiceDefinitionV2Dot2Pagerduty +from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version 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 @@ -2368,6 +2376,14 @@ "ServiceDefinitionV2Dot1Slack", "ServiceDefinitionV2Dot1SlackType", "ServiceDefinitionV2Dot1Version", + "ServiceDefinitionV2Dot2", + "ServiceDefinitionV2Dot2Contact", + "ServiceDefinitionV2Dot2Integrations", + "ServiceDefinitionV2Dot2Link", + "ServiceDefinitionV2Dot2Opsgenie", + "ServiceDefinitionV2Dot2OpsgenieRegion", + "ServiceDefinitionV2Dot2Pagerduty", + "ServiceDefinitionV2Dot2Version", "ServiceDefinitionV2Email", "ServiceDefinitionV2EmailType", "ServiceDefinitionV2Integrations", diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.frozen new file mode 100644 index 0000000000..9c222dc6f5 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.frozen @@ -0,0 +1 @@ +2023-10-06T18:44:31.430Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.yaml new file mode 100644 index 0000000000..ba7e221700 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_or_update_service_definition_using_schema_v22_returns_created_response.yaml @@ -0,0 +1,45 @@ +interactions: +- request: + body: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-testcreateorupdateservicedefinitionusingschemav22returnscreatedresponse1696617871","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.2","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-10-06T18:44:32.076834625Z","github-html-url":"","ingestion-source":"api","origin":"unknown","origin-detail":"","warnings":[],"ingested-schema-version":"v2.2"},"schema":{"schema-version":"v2.2","dd-service":"service-testcreateorupdateservicedefinitionusingschemav22returnscreatedresponse1696617871","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-testcreateorupdateservicedefinitionusingschemav22returnscreatedresponse1696617871 + 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/service_definition.feature b/tests/v2/features/service_definition.feature index 68c5560653..639771980a 100644 --- a/tests/v2/features/service_definition.feature +++ b/tests/v2/features/service_definition.feature @@ -10,21 +10,21 @@ Feature: Service Definition @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "Bad Request" response Given new "CreateOrUpdateServiceDefinitions" request - 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"} + And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "'email', 'slack', 'microsoft-teams'"}], "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"}}, "langauges": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "'runbook', 'doc', 'repo', 'dashboard', 'other'", "url": "https://my-runbook"}], "schema-version": "v2.2", "service-type": "'database', 'cache', 'function', 'web', 'browser', 'mobile'", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "CREATED" response Given new "CreateOrUpdateServiceDefinitions" request - 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"} + And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "'email', 'slack', 'microsoft-teams'"}], "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"}}, "langauges": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "'runbook', 'doc', 'repo', 'dashboard', 'other'", "url": "https://my-runbook"}], "schema-version": "v2.2", "service-type": "'database', 'cache', 'function', 'web', 'browser', 'mobile'", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 200 CREATED @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "Conflict" response Given new "CreateOrUpdateServiceDefinitions" request - 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"} + And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "'email', 'slack', 'microsoft-teams'"}], "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"}}, "langauges": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "'runbook', 'doc', 'repo', 'dashboard', 'other'", "url": "https://my-runbook"}], "schema-version": "v2.2", "service-type": "'database', 'cache', 'function', 'web', 'browser', 'mobile'", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 409 Conflict @@ -46,6 +46,15 @@ Feature: Service Definition 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_alnum }}" + @team:DataDog/service-catalog + Scenario: Create or update service definition using schema v2-2 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 }}","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.2","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.2" + And the response "data[0].attributes.schema.dd-service" is equal to "service-{{ unique_lower_alnum }}" + @generated @skip @team:DataDog/service-catalog Scenario: Delete a single service definition returns "Bad Request" response Given new "DeleteServiceDefinition" request