Skip to content
Start here

Create Device DEX test

client.ZeroTrust.Devices.DEXTests.New(ctx, params) (*DeviceDEXTestNewResponse, error)
POST/accounts/{account_id}/dex/devices/dex_tests

Create a DEX test.

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Cloudflare DEX Write
ParametersExpand Collapse
params DeviceDEXTestNewParams
AccountID param.Field[string]

Path param: Unique identifier linked to an account.

maxLength32
Data param.Field[DeviceDEXTestNewParamsData]

Body param: The configuration object which contains the details for the WARP client to conduct the test.

Host string

The desired endpoint to test.

Kind DeviceDEXTestNewParamsDataKind

The type of test.

One of the following:
const DeviceDEXTestNewParamsDataKindHTTP DeviceDEXTestNewParamsDataKind = "http"
const DeviceDEXTestNewParamsDataKindTraceroute DeviceDEXTestNewParamsDataKind = "traceroute"
Method DeviceDEXTestNewParamsDataMethodOptional

The HTTP request method type.

Enabled param.Field[bool]

Body param: Determines whether or not the test is active.

Interval param.Field[string]

Body param: How often the test will run.

Name param.Field[string]

Body param: The name of the DEX test. Must be unique.

Description param.Field[string]Optional

Body param: Additional details about the test.

TargetPolicies param.Field[[]DeviceDEXTestNewParamsTargetPolicy]Optional

Body param: DEX rules targeted by this test

ID string

The id of the DEX rule.

maxLength36
Default boolOptional

Whether the DEX rule is the account default.

Name stringOptional

The name of the DEX rule.

Targeted param.Field[bool]Optional

Body param

ReturnsExpand Collapse
type DeviceDEXTestNewResponse struct{…}
Data DeviceDEXTestNewResponseData

The configuration object which contains the details for the WARP client to conduct the test.

Host string

The desired endpoint to test.

Kind DeviceDEXTestNewResponseDataKind

The type of test.

One of the following:
const DeviceDEXTestNewResponseDataKindHTTP DeviceDEXTestNewResponseDataKind = "http"
const DeviceDEXTestNewResponseDataKindTraceroute DeviceDEXTestNewResponseDataKind = "traceroute"
Method DeviceDEXTestNewResponseDataMethodOptional

The HTTP request method type.

Enabled bool

Determines whether or not the test is active.

Interval string

How often the test will run.

Name string

The name of the DEX test. Must be unique.

Description stringOptional

Additional details about the test.

TargetPolicies []DeviceDEXTestNewResponseTargetPolicyOptional

DEX rules targeted by this test

ID string

The id of the DEX rule.

maxLength36
Default boolOptional

Whether the DEX rule is the account default.

Name stringOptional

The name of the DEX rule.

Targeted boolOptional
TestID stringOptional

The unique identifier for the test.

maxLength32

Create Device DEX test

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/option"
  "github.com/stainless-sdks/cloudflare-go/zero_trust"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  dexTest, err := client.ZeroTrust.Devices.DEXTests.New(context.TODO(), zero_trust.DeviceDEXTestNewParams{
    AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
    Data: cloudflare.F(zero_trust.DeviceDEXTestNewParamsData{
      Host: cloudflare.F("https://dash.cloudflare.com"),
      Kind: cloudflare.F(zero_trust.DeviceDEXTestNewParamsDataKindHTTP),
    }),
    Enabled: cloudflare.F(true),
    Interval: cloudflare.F("30m"),
    Name: cloudflare.F("HTTP dash health check"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", dexTest.TestID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "data": {
      "host": "https://dash.cloudflare.com",
      "kind": "http",
      "method": "GET"
    },
    "enabled": true,
    "interval": "30m",
    "name": "HTTP dash health check",
    "description": "Checks the dash endpoint every 30 minutes",
    "target_policies": [
      {
        "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
        "default": true,
        "name": "name"
      }
    ],
    "targeted": true,
    "test_id": "372e67954025e0ba6aaa6d586b9e0b59"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "data": {
      "host": "https://dash.cloudflare.com",
      "kind": "http",
      "method": "GET"
    },
    "enabled": true,
    "interval": "30m",
    "name": "HTTP dash health check",
    "description": "Checks the dash endpoint every 30 minutes",
    "target_policies": [
      {
        "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
        "default": true,
        "name": "name"
      }
    ],
    "targeted": true,
    "test_id": "372e67954025e0ba6aaa6d586b9e0b59"
  }
}