Skip to content

Commit 9c96f5e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Rename service-type to type and change it to an enum field (#1721)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent c405f0f commit 9c96f5e

File tree

10 files changed

+108
-26
lines changed

10 files changed

+108
-26
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-10-12 18:33:22.507320",
8-
"spec_repo_commit": "1ddbcdce"
7+
"regenerated": "2023-10-12 21:14:48.669425",
8+
"spec_repo_commit": "d4c17bf0"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-12 18:33:22.526135",
13-
"spec_repo_commit": "1ddbcdce"
12+
"regenerated": "2023-10-12 21:14:48.718184",
13+
"spec_repo_commit": "d4c17bf0"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15836,11 +15836,6 @@ components:
1583615836
type: array
1583715837
schema-version:
1583815838
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Version'
15839-
service-type:
15840-
description: 'The type of service. Datadog recognizes the following service
15841-
types: `database`, `cache`, `function`, `web`, `browser`, and `mobile`.'
15842-
example: web
15843-
type: string
1584415839
tags:
1584515840
description: A set of custom tags.
1584615841
example:
@@ -15858,6 +15853,8 @@ components:
1585815853
description: Importance of the service.
1585915854
example: High
1586015855
type: string
15856+
type:
15857+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Type'
1586115858
required:
1586215859
- schema-version
1586315860
- dd-service
@@ -15945,6 +15942,26 @@ components:
1594515942
example: https://my-org.pagerduty.com/service-directory/PMyService
1594615943
type: string
1594715944
type: object
15945+
ServiceDefinitionV2Dot2Type:
15946+
description: The type of service.
15947+
enum:
15948+
- web
15949+
- db
15950+
- cache
15951+
- function
15952+
- browser
15953+
- mobile
15954+
- custom
15955+
example: web
15956+
type: string
15957+
x-enum-varnames:
15958+
- WEB
15959+
- DB
15960+
- CACHE
15961+
- FUNCTION
15962+
- BROSWER
15963+
- MOBILE
15964+
- CUSTOM
1594815965
ServiceDefinitionV2Dot2Version:
1594915966
default: v2.2
1595015967
description: Schema version being used.

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7043,6 +7043,13 @@ service\_definition\_v2\_dot2\_pagerduty
70437043
:members:
70447044
:show-inheritance:
70457045

7046+
service\_definition\_v2\_dot2\_type
7047+
-----------------------------------
7048+
7049+
.. automodule:: datadog_api_client.v2.model.service_definition_v2_dot2_type
7050+
:members:
7051+
:show-inheritance:
7052+
70467053
service\_definition\_v2\_email
70477054
------------------------------
70487055

examples/v2/service-definition/CreateOrUpdateServiceDefinitions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie import ServiceDefinitionV2Dot2Opsgenie
1212
from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie_region import ServiceDefinitionV2Dot2OpsgenieRegion
1313
from datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty import ServiceDefinitionV2Dot2Pagerduty
14+
from datadog_api_client.v2.model.service_definition_v2_dot2_type import ServiceDefinitionV2Dot2Type
1415
from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version
1516

1617
body = ServiceDefinitionV2Dot2(
@@ -54,13 +55,13 @@
5455
),
5556
],
5657
schema_version=ServiceDefinitionV2Dot2Version.V2_2,
57-
service_type="web",
5858
tags=[
5959
"my:tag",
6060
"service:tag",
6161
],
6262
team="my-team",
6363
tier="High",
64+
type=ServiceDefinitionV2Dot2Type.WEB,
6465
)
6566

6667
configuration = Configuration()

src/datadog_api_client/v2/model/service_definition_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def __init__(self, **kwargs):
7575
:param langauges: The service's programming language. Datadog recognizes the following languages: `dotnet`, `go`, `java`, `js`, `php`, `python`, `ruby`, and `c++`.
7676
:type langauges: [str], optional
7777
78-
:param service_type: The type of service. Datadog recognizes the following service types: `database`, `cache`, `function`, `web`, `browser`, and `mobile`.
79-
:type service_type: str, optional
78+
:param type: The type of service.
79+
:type type: ServiceDefinitionV2Dot2Type, optional
8080
"""
8181
super().__init__(kwargs)
8282

src/datadog_api_client/v2/model/service_definition_v2_dot2.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from datadog_api_client.v2.model.service_definition_v2_dot2_integrations import ServiceDefinitionV2Dot2Integrations
2222
from datadog_api_client.v2.model.service_definition_v2_dot2_link import ServiceDefinitionV2Dot2Link
2323
from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version
24+
from datadog_api_client.v2.model.service_definition_v2_dot2_type import ServiceDefinitionV2Dot2Type
2425

2526

2627
class ServiceDefinitionV2Dot2(ModelNormal):
@@ -32,6 +33,7 @@ def openapi_types(_):
3233
)
3334
from datadog_api_client.v2.model.service_definition_v2_dot2_link import ServiceDefinitionV2Dot2Link
3435
from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version
36+
from datadog_api_client.v2.model.service_definition_v2_dot2_type import ServiceDefinitionV2Dot2Type
3537

3638
return {
3739
"application": (str,),
@@ -58,10 +60,10 @@ def openapi_types(_):
5860
"lifecycle": (str,),
5961
"links": ([ServiceDefinitionV2Dot2Link],),
6062
"schema_version": (ServiceDefinitionV2Dot2Version,),
61-
"service_type": (str,),
6263
"tags": ([str],),
6364
"team": (str,),
6465
"tier": (str,),
66+
"type": (ServiceDefinitionV2Dot2Type,),
6567
}
6668

6769
attribute_map = {
@@ -75,10 +77,10 @@ def openapi_types(_):
7577
"lifecycle": "lifecycle",
7678
"links": "links",
7779
"schema_version": "schema-version",
78-
"service_type": "service-type",
7980
"tags": "tags",
8081
"team": "team",
8182
"tier": "tier",
83+
"type": "type",
8284
}
8385

8486
def __init__(
@@ -93,10 +95,10 @@ def __init__(
9395
langauges: Union[List[str], UnsetType] = unset,
9496
lifecycle: Union[str, UnsetType] = unset,
9597
links: Union[List[ServiceDefinitionV2Dot2Link], UnsetType] = unset,
96-
service_type: Union[str, UnsetType] = unset,
9798
tags: Union[List[str], UnsetType] = unset,
9899
team: Union[str, UnsetType] = unset,
99100
tier: Union[str, UnsetType] = unset,
101+
type: Union[ServiceDefinitionV2Dot2Type, UnsetType] = unset,
100102
**kwargs,
101103
):
102104
"""
@@ -132,9 +134,6 @@ def __init__(
132134
:param schema_version: Schema version being used.
133135
:type schema_version: ServiceDefinitionV2Dot2Version
134136
135-
:param service_type: The type of service. Datadog recognizes the following service types: ``database`` , ``cache`` , ``function`` , ``web`` , ``browser`` , and ``mobile``.
136-
:type service_type: str, optional
137-
138137
:param tags: A set of custom tags.
139138
:type tags: [str], optional
140139
@@ -143,6 +142,9 @@ def __init__(
143142
144143
:param tier: Importance of the service.
145144
:type tier: str, optional
145+
146+
:param type: The type of service.
147+
:type type: ServiceDefinitionV2Dot2Type, optional
146148
"""
147149
if application is not unset:
148150
kwargs["application"] = application
@@ -160,14 +162,14 @@ def __init__(
160162
kwargs["lifecycle"] = lifecycle
161163
if links is not unset:
162164
kwargs["links"] = links
163-
if service_type is not unset:
164-
kwargs["service_type"] = service_type
165165
if tags is not unset:
166166
kwargs["tags"] = tags
167167
if team is not unset:
168168
kwargs["team"] = team
169169
if tier is not unset:
170170
kwargs["tier"] = tier
171+
if type is not unset:
172+
kwargs["type"] = type
171173
super().__init__(kwargs)
172174

173175
self_.dd_service = dd_service
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class ServiceDefinitionV2Dot2Type(ModelSimple):
16+
"""
17+
The type of service.
18+
19+
:param value: Must be one of ["web", "db", "cache", "function", "browser", "mobile", "custom"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"web",
25+
"db",
26+
"cache",
27+
"function",
28+
"browser",
29+
"mobile",
30+
"custom",
31+
}
32+
WEB: ClassVar["ServiceDefinitionV2Dot2Type"]
33+
DB: ClassVar["ServiceDefinitionV2Dot2Type"]
34+
CACHE: ClassVar["ServiceDefinitionV2Dot2Type"]
35+
FUNCTION: ClassVar["ServiceDefinitionV2Dot2Type"]
36+
BROSWER: ClassVar["ServiceDefinitionV2Dot2Type"]
37+
MOBILE: ClassVar["ServiceDefinitionV2Dot2Type"]
38+
CUSTOM: ClassVar["ServiceDefinitionV2Dot2Type"]
39+
40+
@cached_property
41+
def openapi_types(_):
42+
return {
43+
"value": (str,),
44+
}
45+
46+
47+
ServiceDefinitionV2Dot2Type.WEB = ServiceDefinitionV2Dot2Type("web")
48+
ServiceDefinitionV2Dot2Type.DB = ServiceDefinitionV2Dot2Type("db")
49+
ServiceDefinitionV2Dot2Type.CACHE = ServiceDefinitionV2Dot2Type("cache")
50+
ServiceDefinitionV2Dot2Type.FUNCTION = ServiceDefinitionV2Dot2Type("function")
51+
ServiceDefinitionV2Dot2Type.BROSWER = ServiceDefinitionV2Dot2Type("browser")
52+
ServiceDefinitionV2Dot2Type.MOBILE = ServiceDefinitionV2Dot2Type("mobile")
53+
ServiceDefinitionV2Dot2Type.CUSTOM = ServiceDefinitionV2Dot2Type("custom")

src/datadog_api_client/v2/model/service_definitions_create_request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ def __init__(self, **kwargs):
4545
:param schema_version: Schema version being used.
4646
:type schema_version: ServiceDefinitionV2Dot2Version
4747
48-
:param service_type: The type of service. Datadog recognizes the following service types: `database`, `cache`, `function`, `web`, `browser`, and `mobile`.
49-
:type service_type: str, optional
50-
5148
:param tags: A set of custom tags.
5249
:type tags: [str], optional
5350
@@ -57,6 +54,9 @@ def __init__(self, **kwargs):
5754
:param tier: Importance of the service.
5855
:type tier: str, optional
5956
57+
:param type: The type of service.
58+
:type type: ServiceDefinitionV2Dot2Type, optional
59+
6060
:param dd_team: Experimental feature. A Team handle that matches a Team in the Datadog Teams product.
6161
:type dd_team: str, optional
6262

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,7 @@
12301230
from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie import ServiceDefinitionV2Dot2Opsgenie
12311231
from datadog_api_client.v2.model.service_definition_v2_dot2_opsgenie_region import ServiceDefinitionV2Dot2OpsgenieRegion
12321232
from datadog_api_client.v2.model.service_definition_v2_dot2_pagerduty import ServiceDefinitionV2Dot2Pagerduty
1233+
from datadog_api_client.v2.model.service_definition_v2_dot2_type import ServiceDefinitionV2Dot2Type
12331234
from datadog_api_client.v2.model.service_definition_v2_dot2_version import ServiceDefinitionV2Dot2Version
12341235
from datadog_api_client.v2.model.service_definition_v2_email import ServiceDefinitionV2Email
12351236
from datadog_api_client.v2.model.service_definition_v2_email_type import ServiceDefinitionV2EmailType
@@ -2419,6 +2420,7 @@
24192420
"ServiceDefinitionV2Dot2Opsgenie",
24202421
"ServiceDefinitionV2Dot2OpsgenieRegion",
24212422
"ServiceDefinitionV2Dot2Pagerduty",
2423+
"ServiceDefinitionV2Dot2Type",
24222424
"ServiceDefinitionV2Dot2Version",
24232425
"ServiceDefinitionV2Email",
24242426
"ServiceDefinitionV2EmailType",

tests/v2/features/service_definition.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ Feature: Service Definition
1010
@generated @skip @team:DataDog/service-catalog
1111
Scenario: Create or update service definition returns "Bad Request" response
1212
Given new "CreateOrUpdateServiceDefinitions" request
13-
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "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", "url": "https://my-runbook"}], "schema-version": "v2.2", "service-type": "web", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"}
13+
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "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", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
1414
When the request is sent
1515
Then the response status is 400 Bad Request
1616

1717
@generated @skip @team:DataDog/service-catalog
1818
Scenario: Create or update service definition returns "CREATED" response
1919
Given new "CreateOrUpdateServiceDefinitions" request
20-
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "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", "url": "https://my-runbook"}], "schema-version": "v2.2", "service-type": "web", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"}
20+
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "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", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
2121
When the request is sent
2222
Then the response status is 200 CREATED
2323

2424
@generated @skip @team:DataDog/service-catalog
2525
Scenario: Create or update service definition returns "Conflict" response
2626
Given new "CreateOrUpdateServiceDefinitions" request
27-
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "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", "url": "https://my-runbook"}], "schema-version": "v2.2", "service-type": "web", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"}
27+
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "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", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
2828
When the request is sent
2929
Then the response status is 409 Conflict
3030

0 commit comments

Comments
 (0)