Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-10 07:51:59.438918",
"spec_repo_commit": "6482b048"
"regenerated": "2023-10-10 13:47:40.326078",
"spec_repo_commit": "afb48804"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-10 07:51:59.459329",
"spec_repo_commit": "6482b048"
"regenerated": "2023-10-10 13:47:40.346011",
"spec_repo_commit": "afb48804"
}
}
}
179 changes: 179 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14994,18 +14994,21 @@ components:
- $ref: '#/components/schemas/ServiceDefinitionV1'
- $ref: '#/components/schemas/ServiceDefinitionV2'
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1'
- $ref: '#/components/schemas/ServiceDefinitionV2Dot2'
type: object
ServiceDefinitionSchemaVersions:
description: Schema versions
enum:
- 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
Expand Down Expand Up @@ -15466,6 +15469,181 @@ 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. Datadog recognizes the
following languages: `dotnet`, `go`, `java`, `js`, `php`, `python`, `ruby`,
and `c++`.'
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. Datadog recognizes the following service
types: `database`, `cache`, `function`, `web`, `browser`, and `mobile`.'
example: web
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. Datadog recognizes the following types: `email`,
`slack`, and `microsoft-teams`.'
example: slack
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. Datadog recognizes the following types: `runbook`,
`doc`, `repo`, `dashboard`, and `other`.'
example: runbook
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:
Expand Down Expand Up @@ -15649,6 +15827,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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ServiceDefinitionApi;
import com.datadog.api.client.v2.model.ServiceDefinitionCreateResponse;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Contact;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Email;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1EmailType;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Integrations;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Link;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1LinkType;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Opsgenie;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1OpsgenieRegion;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Pagerduty;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot1Version;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Contact;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Integrations;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Link;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Opsgenie;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2OpsgenieRegion;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Pagerduty;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Version;
import com.datadog.api.client.v2.model.ServiceDefinitionsCreateRequest;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -27,38 +24,40 @@ public static void main(String[] args) {

ServiceDefinitionsCreateRequest body =
new ServiceDefinitionsCreateRequest(
new ServiceDefinitionV2Dot1()
new ServiceDefinitionV2Dot2()
.application("my-app")
.contacts(
Collections.singletonList(
new ServiceDefinitionV2Dot1Contact(
new ServiceDefinitionV2Dot1Email()
.contact("contact@datadoghq.com")
.name("Team Email")
.type(ServiceDefinitionV2Dot1EmailType.EMAIL))))
new ServiceDefinitionV2Dot2Contact()
.contact("https://teams.microsoft.com/myteam")
.name("My team channel")
.type("slack")))
.ddService("my-service")
.description("My service description")
.extensions(Map.ofEntries(Map.entry("myorg/extension", "extensionValue")))
.integrations(
new ServiceDefinitionV2Dot1Integrations()
new ServiceDefinitionV2Dot2Integrations()
.opsgenie(
new ServiceDefinitionV2Dot1Opsgenie()
.region(ServiceDefinitionV2Dot1OpsgenieRegion.US)
new ServiceDefinitionV2Dot2Opsgenie()
.region(ServiceDefinitionV2Dot2OpsgenieRegion.US)
.serviceUrl(
"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"))
.pagerduty(
new ServiceDefinitionV2Dot1Pagerduty()
new ServiceDefinitionV2Dot2Pagerduty()
.serviceUrl(
"https://my-org.pagerduty.com/service-directory/PMyService")))
.langauges(
Arrays.asList("dotnet", "go", "java", "js", "php", "python", "ruby", "c++"))
.lifecycle("sandbox")
.links(
Collections.singletonList(
new ServiceDefinitionV2Dot1Link()
new ServiceDefinitionV2Dot2Link()
.name("Runbook")
.provider("Github")
.type(ServiceDefinitionV2Dot1LinkType.RUNBOOK)
.type("runbook")
.url("https://my-runbook")))
.schemaVersion(ServiceDefinitionV2Dot1Version.V2_1)
.schemaVersion(ServiceDefinitionV2Dot2Version.V2_2)
.serviceType("web")
.tags(Arrays.asList("my:tag", "service:tag"))
.team("my-team")
.tier("High"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Create or update service definition using schema v2-2 returns "CREATED" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ServiceDefinitionApi;
import com.datadog.api.client.v2.model.ServiceDefinitionCreateResponse;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Contact;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Integrations;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Link;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Opsgenie;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2OpsgenieRegion;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Pagerduty;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Dot2Version;
import com.datadog.api.client.v2.model.ServiceDefinitionsCreateRequest;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
ServiceDefinitionApi apiInstance = new ServiceDefinitionApi(defaultClient);

ServiceDefinitionsCreateRequest body =
new ServiceDefinitionsCreateRequest(
new ServiceDefinitionV2Dot2()
.contacts(
Collections.singletonList(
new ServiceDefinitionV2Dot2Contact()
.contact("contact@datadoghq.com")
.name("Team Email")
.type("email")))
.ddService("service-exampleservicedefinition")
.extensions(Map.ofEntries(Map.entry("myorgextension", "extensionvalue")))
.integrations(
new ServiceDefinitionV2Dot2Integrations()
.opsgenie(
new ServiceDefinitionV2Dot2Opsgenie()
.region(ServiceDefinitionV2Dot2OpsgenieRegion.US)
.serviceUrl(
"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"))
.pagerduty(
new ServiceDefinitionV2Dot2Pagerduty()
.serviceUrl(
"https://my-org.pagerduty.com/service-directory/PMyService")))
.links(
Arrays.asList(
new ServiceDefinitionV2Dot2Link()
.name("Runbook")
.type("runbook")
.url("https://my-runbook"),
new ServiceDefinitionV2Dot2Link()
.name("Source Code")
.type("repo")
.provider("GitHub")
.url("https://github.com/DataDog/schema"),
new ServiceDefinitionV2Dot2Link()
.name("Architecture")
.type("doc")
.provider("Gigoogle drivetHub")
.url("https://my-runbook")))
.schemaVersion(ServiceDefinitionV2Dot2Version.V2_2)
.tags(Arrays.asList("my:tag", "service:tag"))
.team("my-team"));

try {
ServiceDefinitionCreateResponse result = apiInstance.createOrUpdateServiceDefinitions(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling ServiceDefinitionApi#createOrUpdateServiceDefinitions");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Loading