Sha256: 8db4c51bc33ae7330b2e8d8acf79022a6e6386b63d7965acb0d5adafe9270cbf

Contents?: true

Size: 1.94 KB

Versions: 19

Compression:

Stored size: 1.94 KB

Contents

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

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

body = DatadogAPIClient::V2::ServiceDefinitionV2Dot1.new({
  contacts: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot1Email.new({
      contact: "contact@datadoghq.com",
      name: "Team Email",
      type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1EmailType::EMAIL,
    }),
  ],
  dd_service: "service-exampleservicedefinition",
  extensions: {
    "myorgextension": "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",
    }),
  }),
  links: [
    DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({
      name: "Runbook",
      type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::RUNBOOK,
      url: "https://my-runbook",
    }),
    DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({
      name: "Source Code",
      type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::REPO,
      provider: "GitHub",
      url: "https://github.com/DataDog/schema",
    }),
    DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({
      name: "Architecture",
      type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::DOC,
      provider: "Gigoogle drivetHub",
      url: "https://my-runbook",
    }),
  ],
  schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Version::V2_1,
  tags: [
    "my:tag",
    "service:tag",
  ],
  team: "my-team",
})
p api_instance.create_or_update_service_definitions(body)

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
datadog_api_client-2.28.1 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.27.1 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.26.1 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.26.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.25.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.24.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.22.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.21.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.20.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.19.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.18.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.17.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.16.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.15.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.14.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.13.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.12.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.11.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb
datadog_api_client-2.10.0 examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb