Sha256: c89dcbe5a080bc0a972d731bfffd9ec3cd3448ff870d70a5e267976ea4ee864a

Contents?: true

Size: 1.8 KB

Versions: 8

Compression:

Stored size: 1.8 KB

Contents

# Create an API test returns "OK - Returns the created test details." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsAPITest.new({
  config: DatadogAPIClient::V1::SyntheticsAPITestConfig.new({
    assertions: [
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::LESS_THAN,
        target: 1000,
        type: DatadogAPIClient::V1::SyntheticsAssertionType::RESPONSE_TIME,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      method: DatadogAPIClient::V1::HTTPMethod::GET,
      url: "https://example.com",
    }),
  }),
  locations: [
    "aws:eu-west-3",
  ],
  message: "Notification message",
  name: "Example test name",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    ci: DatadogAPIClient::V1::SyntheticsTestCiOptions.new({
      execution_rule: DatadogAPIClient::V1::SyntheticsTestExecutionRule::BLOCKING,
    }),
    device_ids: [
      DatadogAPIClient::V1::SyntheticsDeviceID::LAPTOP_LARGE,
    ],
    monitor_options: DatadogAPIClient::V1::SyntheticsTestOptionsMonitorOptions.new({}),
    restricted_roles: [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    ],
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({}),
    rum_settings: DatadogAPIClient::V1::SyntheticsBrowserTestRumSettings.new({
      application_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      client_token_id: 12345,
      is_enabled: true,
    }),
  }),
  status: DatadogAPIClient::V1::SyntheticsTestPauseStatus::LIVE,
  subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::HTTP,
  tags: [
    "env:production",
  ],
  type: DatadogAPIClient::V1::SyntheticsAPITestType::API,
})
p api_instance.create_synthetics_api_test(body)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
datadog_api_client-2.4.0 examples/v1/synthetics/CreateSyntheticsAPITest.rb
datadog_api_client-2.3.0 examples/v1/synthetics/CreateSyntheticsAPITest.rb
datadog_api_client-2.2.0 examples/v1/synthetics/CreateSyntheticsAPITest.rb
datadog_api_client-2.1.0 examples/v1/synthetics/CreateSyntheticsAPITest.rb
datadog_api_client-2.0.2 examples/v1/synthetics/CreateSyntheticsAPITest.rb
datadog_api_client-2.0.1 examples/v1/synthetics/CreateSyntheticsAPITest.rb
datadog_api_client-2.0.0 examples/v1/synthetics/CreateSyntheticsAPITest.rb
datadog_api_client-1.11.0 examples/v1/synthetics/CreateSyntheticsAPITest.rb