Sha256: 31802474990f9ba1558da46cb9f59a0d95e238cfbe04a16c990ad1eb06655bcf

Contents?: true

Size: 1.8 KB

Versions: 2

Compression:

Stored size: 1.8 KB

Contents

# Create a browser test returns "OK - Returns the created test details." response

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

body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
  config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
    assertions: [],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        example: "content-type",
        name: "PROPERTY",
        pattern: "content-type",
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      method: DatadogAPIClient::V1::HTTPMethod::GET,
      url: "https://datadoghq.com",
    }),
    set_cookie: "name:test",
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "Test message",
  name: "Example-Create_a_browser_test_returns_OK_Returns_the_created_test_details_response",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    accept_self_signed: false,
    allow_insecure: true,
    device_ids: [
      DatadogAPIClient::V1::SyntheticsDeviceID::TABLET,
    ],
    disable_cors: true,
    follow_redirects: true,
    min_failure_duration: 10,
    min_location_failed: 1,
    no_screenshot: true,
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
      count: 3,
      interval: 10,
    }),
    tick_every: 300,
  }),
  tags: [
    "testing:browser",
  ],
  type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
  steps: [
    DatadogAPIClient::V1::SyntheticsStep.new({
      allow_failure: false,
      is_critical: true,
      name: "Refresh page",
      params: DatadogAPIClient::V1::SyntheticsStepParams.new({}),
      type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
    }),
  ],
})
p api_instance.create_synthetics_browser_test(body)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datadog_api_client-1.8.0 examples/v1/synthetics/CreateSyntheticsBrowserTest.rb
datadog_api_client-1.7.0 examples/v1/synthetics/CreateSyntheticsBrowserTest.rb