Sha256: cd4cdd1e6b5f42fd27f344923e9dd4afbf3b7a59088fe8620ed2dabcabd95853

Contents?: true

Size: 1.65 KB

Versions: 5

Compression:

Stored size: 1.65 KB

Contents

# Create or update service definition returns "CREATED" response

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

body = DatadogAPIClient::V2::ServiceDefinitionV2Dot2.new({
  application: "my-app",
  contacts: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot2Contact.new({
      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: DatadogAPIClient::V2::ServiceDefinitionV2Dot2Integrations.new({
    opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Dot2Opsgenie.new({
      region: DatadogAPIClient::V2::ServiceDefinitionV2Dot2OpsgenieRegion::US,
      service_url: "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000",
    }),
    pagerduty: DatadogAPIClient::V2::ServiceDefinitionV2Dot2Pagerduty.new({
      service_url: "https://my-org.pagerduty.com/service-directory/PMyService",
    }),
  }),
  languages: [
    "dotnet",
    "go",
    "java",
    "js",
    "php",
    "python",
    "ruby",
    "c++",
  ],
  lifecycle: "sandbox",
  links: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot2Link.new({
      name: "Runbook",
      provider: "Github",
      type: "runbook",
      url: "https://my-runbook",
    }),
  ],
  schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Dot2Version::V2_2,
  tags: [
    "my:tag",
    "service:tag",
  ],
  team: "my-team",
  tier: "High",
  type: DatadogAPIClient::V2::ServiceDefinitionV2Dot2Type::WEB,
})
p api_instance.create_or_update_service_definitions(body)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
datadog_api_client-2.21.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.20.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.19.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.18.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb
datadog_api_client-2.17.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb