Sha256: 2beeef3dcb2b4696332ead5366fed82d66139da65eab013a49d28de5c065e5eb

Contents?: true

Size: 1.71 KB

Versions: 20

Compression:

Stored size: 1.71 KB

Contents

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

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

body = DatadogAPIClient::V2::ServiceDefinitionV2.new({
  contacts: [
    DatadogAPIClient::V2::ServiceDefinitionV2Email.new({
      contact: "contact@datadoghq.com",
      name: "Team Email",
      type: DatadogAPIClient::V2::ServiceDefinitionV2EmailType::EMAIL,
    }),
  ],
  dd_service: "service-exampleservicedefinition",
  dd_team: "my-team",
  docs: [
    DatadogAPIClient::V2::ServiceDefinitionV2Doc.new({
      name: "Architecture",
      provider: "google drive",
      url: "https://gdrive/mydoc",
    }),
  ],
  extensions: {
    "myorgextension": "extensionvalue",
  },
  integrations: DatadogAPIClient::V2::ServiceDefinitionV2Integrations.new({
    opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Opsgenie.new({
      region: DatadogAPIClient::V2::ServiceDefinitionV2OpsgenieRegion::US,
      service_url: "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000",
    }),
    pagerduty: "https://my-org.pagerduty.com/service-directory/PMyService",
  }),
  links: [
    DatadogAPIClient::V2::ServiceDefinitionV2Link.new({
      name: "Runbook",
      type: DatadogAPIClient::V2::ServiceDefinitionV2LinkType::RUNBOOK,
      url: "https://my-runbook",
    }),
  ],
  repos: [
    DatadogAPIClient::V2::ServiceDefinitionV2Repo.new({
      name: "Source Code",
      provider: "GitHub",
      url: "https://github.com/DataDog/schema",
    }),
  ],
  schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Version::V2,
  tags: [
    "my:tag",
    "service:tag",
  ],
  team: "my-team",
})
p api_instance.create_or_update_service_definitions(body)

Version data entries

20 entries across 20 versions & 1 rubygems

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