Skip to content

Commit 4ef77d4

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit afb48804 of spec repo
1 parent b6c1105 commit 4ef77d4

18 files changed

+2115
-41
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-10 07:51:59.438918",
8-
"spec_repo_commit": "6482b048"
7+
"regenerated": "2023-10-10 13:47:40.326078",
8+
"spec_repo_commit": "afb48804"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-10 07:51:59.459329",
13-
"spec_repo_commit": "6482b048"
12+
"regenerated": "2023-10-10 13:47:40.346011",
13+
"spec_repo_commit": "afb48804"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14994,18 +14994,21 @@ components:
1499414994
- $ref: '#/components/schemas/ServiceDefinitionV1'
1499514995
- $ref: '#/components/schemas/ServiceDefinitionV2'
1499614996
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1'
14997+
- $ref: '#/components/schemas/ServiceDefinitionV2Dot2'
1499714998
type: object
1499814999
ServiceDefinitionSchemaVersions:
1499915000
description: Schema versions
1500015001
enum:
1500115002
- v1
1500215003
- v2
1500315004
- v2.1
15005+
- v2.2
1500415006
type: string
1500515007
x-enum-varnames:
1500615008
- V1
1500715009
- V2
1500815010
- V2_1
15011+
- V2_2
1500915012
ServiceDefinitionV1:
1501015013
deprecated: true
1501115014
description: Deprecated - Service definition V1 for providing additional service
@@ -15466,6 +15469,181 @@ components:
1546615469
type: string
1546715470
x-enum-varnames:
1546815471
- V2_1
15472+
ServiceDefinitionV2Dot2:
15473+
description: Service definition v2.2 for providing service metadata and integrations.
15474+
properties:
15475+
application:
15476+
description: Identifier for a group of related services serving a product
15477+
feature, which the service is a part of.
15478+
example: my-app
15479+
type: string
15480+
contacts:
15481+
description: A list of contacts related to the services.
15482+
items:
15483+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Contact'
15484+
type: array
15485+
dd-service:
15486+
description: Unique identifier of the service. Must be unique across all
15487+
services and is used to match with a service in Datadog.
15488+
example: my-service
15489+
type: string
15490+
description:
15491+
description: A short description of the service.
15492+
example: My service description
15493+
type: string
15494+
extensions:
15495+
additionalProperties: {}
15496+
description: Extensions to v2.2 schema.
15497+
example:
15498+
myorg/extension: extensionValue
15499+
type: object
15500+
integrations:
15501+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Integrations'
15502+
langauges:
15503+
description: 'The service''s programming language. Datadog recognizes the
15504+
following languages: `dotnet`, `go`, `java`, `js`, `php`, `python`, `ruby`,
15505+
and `c++`.'
15506+
example:
15507+
- dotnet
15508+
- go
15509+
- java
15510+
- js
15511+
- php
15512+
- python
15513+
- ruby
15514+
- c++
15515+
items:
15516+
type: string
15517+
type: array
15518+
lifecycle:
15519+
description: The current life cycle phase of the service.
15520+
example: sandbox
15521+
type: string
15522+
links:
15523+
description: A list of links related to the services.
15524+
items:
15525+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Link'
15526+
type: array
15527+
schema-version:
15528+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Version'
15529+
service-type:
15530+
description: 'The type of service. Datadog recognizes the following service
15531+
types: `database`, `cache`, `function`, `web`, `browser`, and `mobile`.'
15532+
example: web
15533+
type: string
15534+
tags:
15535+
description: A set of custom tags.
15536+
example:
15537+
- my:tag
15538+
- service:tag
15539+
items:
15540+
type: string
15541+
type: array
15542+
team:
15543+
description: Team that owns the service. It is used to locate a team defined
15544+
in Datadog Teams if it exists.
15545+
example: my-team
15546+
type: string
15547+
tier:
15548+
description: Importance of the service.
15549+
example: High
15550+
type: string
15551+
required:
15552+
- schema-version
15553+
- dd-service
15554+
type: object
15555+
ServiceDefinitionV2Dot2Contact:
15556+
description: Service owner's contacts information.
15557+
properties:
15558+
contact:
15559+
description: Contact value.
15560+
example: https://teams.microsoft.com/myteam
15561+
type: string
15562+
name:
15563+
description: Contact Name.
15564+
example: My team channel
15565+
type: string
15566+
type:
15567+
description: 'Contact type. Datadog recognizes the following types: `email`,
15568+
`slack`, and `microsoft-teams`.'
15569+
example: slack
15570+
type: string
15571+
required:
15572+
- type
15573+
- contact
15574+
type: object
15575+
ServiceDefinitionV2Dot2Integrations:
15576+
description: Third party integrations that Datadog supports.
15577+
properties:
15578+
opsgenie:
15579+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Opsgenie'
15580+
pagerduty:
15581+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2Pagerduty'
15582+
type: object
15583+
ServiceDefinitionV2Dot2Link:
15584+
description: Service's external links.
15585+
properties:
15586+
name:
15587+
description: Link name.
15588+
example: Runbook
15589+
type: string
15590+
provider:
15591+
description: Link provider.
15592+
example: Github
15593+
type: string
15594+
type:
15595+
description: 'Link type. Datadog recognizes the following types: `runbook`,
15596+
`doc`, `repo`, `dashboard`, and `other`.'
15597+
example: runbook
15598+
type: string
15599+
url:
15600+
description: Link URL.
15601+
example: https://my-runbook
15602+
type: string
15603+
required:
15604+
- name
15605+
- type
15606+
- url
15607+
type: object
15608+
ServiceDefinitionV2Dot2Opsgenie:
15609+
description: Opsgenie integration for the service.
15610+
properties:
15611+
region:
15612+
$ref: '#/components/schemas/ServiceDefinitionV2Dot2OpsgenieRegion'
15613+
service-url:
15614+
description: Opsgenie service url.
15615+
example: https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000
15616+
type: string
15617+
required:
15618+
- service-url
15619+
type: object
15620+
ServiceDefinitionV2Dot2OpsgenieRegion:
15621+
description: Opsgenie instance region.
15622+
enum:
15623+
- US
15624+
- EU
15625+
example: US
15626+
type: string
15627+
x-enum-varnames:
15628+
- US
15629+
- EU
15630+
ServiceDefinitionV2Dot2Pagerduty:
15631+
description: PagerDuty integration for the service.
15632+
properties:
15633+
service-url:
15634+
description: PagerDuty service url.
15635+
example: https://my-org.pagerduty.com/service-directory/PMyService
15636+
type: string
15637+
type: object
15638+
ServiceDefinitionV2Dot2Version:
15639+
default: v2.2
15640+
description: Schema version being used.
15641+
enum:
15642+
- v2.2
15643+
example: v2.2
15644+
type: string
15645+
x-enum-varnames:
15646+
- V2_2
1546915647
ServiceDefinitionV2Email:
1547015648
description: Service owner's email.
1547115649
properties:
@@ -15649,6 +15827,7 @@ components:
1564915827
ServiceDefinitionsCreateRequest:
1565015828
description: Create service definitions request.
1565115829
oneOf:
15830+
- $ref: '#/components/schemas/ServiceDefinitionV2Dot2'
1565215831
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1'
1565315832
- $ref: '#/components/schemas/ServiceDefinitionV2'
1565415833
- $ref: '#/components/schemas/ServiceDefinitionRaw'

examples/v2/service-definition/CreateOrUpdateServiceDefinitions.java

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.v2.api.ServiceDefinitionApi;
66
import com.datadog.api.client.v2.model.ServiceDefinitionCreateResponse;
7-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1;
8-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Contact;
9-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Email;
10-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1EmailType;
11-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Integrations;
12-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Link;
13-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1LinkType;
14-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Opsgenie;
15-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1OpsgenieRegion;
16-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Pagerduty;
17-
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Version;
7+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2;
8+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Contact;
9+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Integrations;
10+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Link;
11+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Opsgenie;
12+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2OpsgenieRegion;
13+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Pagerduty;
14+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Version;
1815
import com.datadog.api.client.v2.model.ServiceDefinitionsCreateRequest;
1916
import java.util.Arrays;
2017
import java.util.Collections;
@@ -27,38 +24,40 @@ public static void main(String[] args) {
2724

2825
ServiceDefinitionsCreateRequest body =
2926
new ServiceDefinitionsCreateRequest(
30-
new ServiceDefinitionV2Dot1()
27+
new ServiceDefinitionV2Dot2()
3128
.application("my-app")
3229
.contacts(
3330
Collections.singletonList(
34-
new ServiceDefinitionV2Dot1Contact(
35-
new ServiceDefinitionV2Dot1Email()
36-
.contact("contact@datadoghq.com")
37-
.name("Team Email")
38-
.type(ServiceDefinitionV2Dot1EmailType.EMAIL))))
31+
new ServiceDefinitionV2Dot2Contact()
32+
.contact("https://teams.microsoft.com/myteam")
33+
.name("My team channel")
34+
.type("slack")))
3935
.ddService("my-service")
4036
.description("My service description")
4137
.extensions(Map.ofEntries(Map.entry("myorg/extension", "extensionValue")))
4238
.integrations(
43-
new ServiceDefinitionV2Dot1Integrations()
39+
new ServiceDefinitionV2Dot2Integrations()
4440
.opsgenie(
45-
new ServiceDefinitionV2Dot1Opsgenie()
46-
.region(ServiceDefinitionV2Dot1OpsgenieRegion.US)
41+
new ServiceDefinitionV2Dot2Opsgenie()
42+
.region(ServiceDefinitionV2Dot2OpsgenieRegion.US)
4743
.serviceUrl(
4844
"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"))
4945
.pagerduty(
50-
new ServiceDefinitionV2Dot1Pagerduty()
46+
new ServiceDefinitionV2Dot2Pagerduty()
5147
.serviceUrl(
5248
"https://my-org.pagerduty.com/service-directory/PMyService")))
49+
.langauges(
50+
Arrays.asList("dotnet", "go", "java", "js", "php", "python", "ruby", "c++"))
5351
.lifecycle("sandbox")
5452
.links(
5553
Collections.singletonList(
56-
new ServiceDefinitionV2Dot1Link()
54+
new ServiceDefinitionV2Dot2Link()
5755
.name("Runbook")
5856
.provider("Github")
59-
.type(ServiceDefinitionV2Dot1LinkType.RUNBOOK)
57+
.type("runbook")
6058
.url("https://my-runbook")))
61-
.schemaVersion(ServiceDefinitionV2Dot1Version.V2_1)
59+
.schemaVersion(ServiceDefinitionV2Dot2Version.V2_2)
60+
.serviceType("web")
6261
.tags(Arrays.asList("my:tag", "service:tag"))
6362
.team("my-team")
6463
.tier("High"));
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Create or update service definition using schema v2-2 returns "CREATED" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.ServiceDefinitionApi;
6+
import com.datadog.api.client.v2.model.ServiceDefinitionCreateResponse;
7+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2;
8+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Contact;
9+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Integrations;
10+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Link;
11+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Opsgenie;
12+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2OpsgenieRegion;
13+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Pagerduty;
14+
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Version;
15+
import com.datadog.api.client.v2.model.ServiceDefinitionsCreateRequest;
16+
import java.util.Arrays;
17+
import java.util.Collections;
18+
import java.util.Map;
19+
20+
public class Example {
21+
public static void main(String[] args) {
22+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
23+
ServiceDefinitionApi apiInstance = new ServiceDefinitionApi(defaultClient);
24+
25+
ServiceDefinitionsCreateRequest body =
26+
new ServiceDefinitionsCreateRequest(
27+
new ServiceDefinitionV2Dot2()
28+
.contacts(
29+
Collections.singletonList(
30+
new ServiceDefinitionV2Dot2Contact()
31+
.contact("contact@datadoghq.com")
32+
.name("Team Email")
33+
.type("email")))
34+
.ddService("service-exampleservicedefinition")
35+
.extensions(Map.ofEntries(Map.entry("myorgextension", "extensionvalue")))
36+
.integrations(
37+
new ServiceDefinitionV2Dot2Integrations()
38+
.opsgenie(
39+
new ServiceDefinitionV2Dot2Opsgenie()
40+
.region(ServiceDefinitionV2Dot2OpsgenieRegion.US)
41+
.serviceUrl(
42+
"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"))
43+
.pagerduty(
44+
new ServiceDefinitionV2Dot2Pagerduty()
45+
.serviceUrl(
46+
"https://my-org.pagerduty.com/service-directory/PMyService")))
47+
.links(
48+
Arrays.asList(
49+
new ServiceDefinitionV2Dot2Link()
50+
.name("Runbook")
51+
.type("runbook")
52+
.url("https://my-runbook"),
53+
new ServiceDefinitionV2Dot2Link()
54+
.name("Source Code")
55+
.type("repo")
56+
.provider("GitHub")
57+
.url("https://github.com/DataDog/schema"),
58+
new ServiceDefinitionV2Dot2Link()
59+
.name("Architecture")
60+
.type("doc")
61+
.provider("Gigoogle drivetHub")
62+
.url("https://my-runbook")))
63+
.schemaVersion(ServiceDefinitionV2Dot2Version.V2_2)
64+
.tags(Arrays.asList("my:tag", "service:tag"))
65+
.team("my-team"));
66+
67+
try {
68+
ServiceDefinitionCreateResponse result = apiInstance.createOrUpdateServiceDefinitions(body);
69+
System.out.println(result);
70+
} catch (ApiException e) {
71+
System.err.println(
72+
"Exception when calling ServiceDefinitionApi#createOrUpdateServiceDefinitions");
73+
System.err.println("Status code: " + e.getCode());
74+
System.err.println("Reason: " + e.getResponseBody());
75+
System.err.println("Response headers: " + e.getResponseHeaders());
76+
e.printStackTrace();
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)