Sha256: 1e4fb4e1c908872bd4937d191384793014f0004563c5b25abfff57e556bdece3

Contents?: true

Size: 1.73 KB

Versions: 14

Compression:

Stored size: 1.73 KB

Contents

# Create or update service definition using schema v2-2 returns "CREATED" response

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

body = DatadogAPIClient::V2::ServiceDefinitionV2Dot2.new({
  contacts: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot2Contact.new({
      contact: "contact@datadoghq.com",
      name: "Team Email",
      type: "email",
    }),
  ],
  dd_service: "service-exampleservicedefinition",
  extensions: {
    "myorgextension": "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",
    }),
  }),
  links: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot2Link.new({
      name: "Runbook",
      type: "runbook",
      url: "https://my-runbook",
    }),
    DatadogAPIClient::V2::ServiceDefinitionV2Dot2Link.new({
      name: "Source Code",
      type: "repo",
      provider: "GitHub",
      url: "https://github.com/DataDog/schema",
    }),
    DatadogAPIClient::V2::ServiceDefinitionV2Dot2Link.new({
      name: "Architecture",
      type: "doc",
      provider: "Gigoogle drivetHub",
      url: "https://my-runbook",
    }),
  ],
  schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Dot2Version::V2_2,
  tags: [
    "my:tag",
    "service:tag",
  ],
  team: "my-team",
})
p api_instance.create_or_update_service_definitions(body)

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
datadog_api_client-2.29.1 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.28.1 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.27.1 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.26.1 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.26.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.25.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.24.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.22.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.21.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.20.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.19.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.18.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.17.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb
datadog_api_client-2.16.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2621709423.rb