Sha256: af43fa59c419299d4eab72812d668db962805bc8592bf500f4406e59c9351e92

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

# Create or update service definition returns "CREATED" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ServiceDefinitionAPI.new

body = DatadogAPIClient::V2::ServiceDefinitionV2Dot1.new({
  application: "my-app",
  contacts: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot1Email.new({
      contact: "contact@datadoghq.com",
      name: "Team Email",
      type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1EmailType::EMAIL,
    }),
  ],
  dd_service: "my-service",
  description: "My service description",
  extensions: {
    "myorg/extension": "extensionValue",
  },
  integrations: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Integrations.new({
    opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Opsgenie.new({
      region: DatadogAPIClient::V2::ServiceDefinitionV2Dot1OpsgenieRegion::US,
      service_url: "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000",
    }),
    pagerduty: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Pagerduty.new({
      service_url: "https://my-org.pagerduty.com/service-directory/PMyService",
    }),
  }),
  lifecycle: "sandbox",
  links: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({
      name: "Runbook",
      provider: "Github",
      type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::RUNBOOK,
      url: "https://my-runbook",
    }),
  ],
  schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Version::V2_1,
  tags: [
    "my:tag",
    "service:tag",
  ],
  team: "my-team",
  tier: "High",
})
p api_instance.create_or_update_service_definitions(body)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datadog_api_client-2.15.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.14.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.13.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.12.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.11.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.10.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb