# DEX ## Domain Types ### Digital Experience Monitor - `type DigitalExperienceMonitor struct{…}` - `ID string` API Resource UUID tag. - `Default bool` Whether the policy is the default for the account. - `Name string` ### Network Path - `type NetworkPath struct{…}` - `Slots []NetworkPathSlot` - `ID string` API Resource UUID tag. - `ClientToAppRTTMs int64` Round trip time in ms of the client to app mile - `ClientToCfEgressRTTMs int64` Round trip time in ms of the client to Cloudflare egress mile - `ClientToCfIngressRTTMs int64` Round trip time in ms of the client to Cloudflare ingress mile - `Timestamp string` - `ClientToISPRTTMs int64` Round trip time in ms of the client to ISP mile - `Sampling NetworkPathSampling` Specifies the sampling applied, if any, to the slots response. When sampled, results shown represent the first test run to the start of each sampling interval. - `Unit NetworkPathSamplingUnit` - `const NetworkPathSamplingUnitHours NetworkPathSamplingUnit = "hours"` - `Value int64` ### Network Path Response - `type NetworkPathResponse struct{…}` - `ID string` API Resource UUID tag. - `DeviceName string` Name of the device that ran the test. - `Interval string` The interval at which the Traceroute synthetic application test is set to run. - `Kind NetworkPathResponseKind` - `const NetworkPathResponseKindTraceroute NetworkPathResponseKind = "traceroute"` - `Name string` - `NetworkPath NetworkPath` - `Slots []NetworkPathSlot` - `ID string` API Resource UUID tag. - `ClientToAppRTTMs int64` Round trip time in ms of the client to app mile - `ClientToCfEgressRTTMs int64` Round trip time in ms of the client to Cloudflare egress mile - `ClientToCfIngressRTTMs int64` Round trip time in ms of the client to Cloudflare ingress mile - `Timestamp string` - `ClientToISPRTTMs int64` Round trip time in ms of the client to ISP mile - `Sampling NetworkPathSampling` Specifies the sampling applied, if any, to the slots response. When sampled, results shown represent the first test run to the start of each sampling interval. - `Unit NetworkPathSamplingUnit` - `const NetworkPathSamplingUnitHours NetworkPathSamplingUnit = "hours"` - `Value int64` - `URL string` The host of the Traceroute synthetic application test. ### Percentiles - `type Percentiles struct{…}` - `P50 float64` p50 observed in the time period. - `P90 float64` p90 observed in the time period. - `P95 float64` p95 observed in the time period. - `P99 float64` p99 observed in the time period. # WARP Change Events ## List WARP change events. `client.ZeroTrust.DEX.WARPChangeEvents.Get(ctx, params) (*[]DexwarpChangeEventGetResponse, error)` **get** `/accounts/{account_id}/dex/warp-change-events` List WARP configuration and enablement toggle change events by device. ### Parameters - `params DEXWARPChangeEventGetParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start time for the query in ISO (RFC3339 - ISO 8601) format. - `Page param.Field[float64]` Query param: Page number of paginated results. - `PerPage param.Field[float64]` Query param: Number of results per page. - `To param.Field[string]` Query param: End time for the query in ISO (RFC3339 - ISO 8601) format. - `AccountName param.Field[string]` Query param: Filter events by account name. - `ConfigName param.Field[string]` Query param: Filter events by WARP configuration name changed from or to. Applicable to type='config' events only. - `SortOrder param.Field[DexwarpChangeEventGetParamsSortOrder]` Query param: Sort response by event timestamp. - `const DexwarpChangeEventGetParamsSortOrderAsc DexwarpChangeEventGetParamsSortOrder = "ASC"` - `const DexwarpChangeEventGetParamsSortOrderDesc DexwarpChangeEventGetParamsSortOrder = "DESC"` - `Toggle param.Field[DexwarpChangeEventGetParamsToggle]` Query param: Filter events by type toggle value. Applicable to type='toggle' events only. - `const DexwarpChangeEventGetParamsToggleOn DexwarpChangeEventGetParamsToggle = "on"` - `const DexwarpChangeEventGetParamsToggleOff DexwarpChangeEventGetParamsToggle = "off"` - `Type param.Field[DexwarpChangeEventGetParamsType]` Query param: Filter events by type 'config' or 'toggle'. - `const DexwarpChangeEventGetParamsTypeConfig DexwarpChangeEventGetParamsType = "config"` - `const DexwarpChangeEventGetParamsTypeToggle DexwarpChangeEventGetParamsType = "toggle"` ### Returns - `type DexwarpChangeEventGetResponseEnvelopeResult []DexwarpChangeEventGetResponse` - `type DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPToggleChangeEvent struct{…}` - `AccountName string` The account name. - `AccountTag string` The public account identifier. - `DeviceID string` The device ID. - `DeviceRegistration string` Deprecated: use registration_id. The device registration ID. - `Hostname string` The hostname of the machine the event is from. - `RegistrationID string` The device registration ID. - `SerialNumber string` The serial number of the machine the event is from. - `Timestamp Time` The event time. - `Toggle DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPToggleChangeEventToggle` The state of the WARP toggle. - `const DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPToggleChangeEventToggleOn DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPToggleChangeEventToggle = "on"` - `const DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPToggleChangeEventToggleOff DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPToggleChangeEventToggle = "off"` - `UserEmail string` Email tied to the device. - `type DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPConfigChangeEvent struct{…}` - `DeviceID string` The device ID. - `DeviceRegistration string` Deprecated: use registration_id. The device registration ID. - `From DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPConfigChangeEventFrom` The details for the WARP configuration that was switched from. - `AccountName string` The account name. - `AccountTag string` The public account identifier. - `ConfigName string` The name of the WARP configuration. - `Hostname string` The hostname of the machine the event is from. - `RegistrationID string` The device registration ID. - `SerialNumber string` The serial number of the machine the event is from. - `Timestamp Time` The event time. - `To DexwarpChangeEventGetResponseDigitalExperienceMonitoringWARPConfigChangeEventTo` The details for the WARP configuration that was switched to. - `AccountName string` The account name. - `AccountTag string` The public account identifier. - `ConfigName string` The name of the WARP configuration. - `UserEmail string` Email tied to the device. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) warpChangeEvents, err := client.ZeroTrust.DEX.WARPChangeEvents.Get(context.TODO(), zero_trust.DEXWARPChangeEventGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("2023-09-20T17:00:00Z"), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(10.000000), To: cloudflare.F("2023-09-20T17:00:00Z"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", warpChangeEvents) } ``` #### Response ```json { "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": [ { "account_name": "account_name", "account_tag": "account_tag", "device_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "device_registration": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "hostname": "hostname", "registration_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "serial_number": "serial_number", "timestamp": "2023-10-11T00:00:00Z", "toggle": "on", "user_email": "user_email" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` # Commands ## List account commands `client.ZeroTrust.DEX.Commands.List(ctx, params) (*V4PagePagination[DEXCommandListResponse], error)` **get** `/accounts/{account_id}/dex/commands` Retrieves a paginated list of commands issued to devices under the specified account, optionally filtered by time range, device, or other parameters ### Parameters - `params DEXCommandListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `Page param.Field[float64]` Query param: Page number of paginated results. - `PerPage param.Field[float64]` Query param: Number of results per page. - `CommandType param.Field[DEXCommandListParamsCommandType]` Query param: Optionally filter executed commands by command type. - `const DEXCommandListParamsCommandTypePCAP DEXCommandListParamsCommandType = "pcap"` - `const DEXCommandListParamsCommandTypeSpeedTest DEXCommandListParamsCommandType = "speed-test"` - `const DEXCommandListParamsCommandTypeWARPDiag DEXCommandListParamsCommandType = "warp-diag"` - `DeviceID param.Field[string]` Query param: Unique identifier for a device. - `From param.Field[Time]` Query param: Start time for the query in ISO (RFC3339 - ISO 8601) format. - `Status param.Field[DEXCommandListParamsStatus]` Query param: Optionally filter executed commands by status. - `const DEXCommandListParamsStatusPendingExec DEXCommandListParamsStatus = "PENDING_EXEC"` - `const DEXCommandListParamsStatusPendingUpload DEXCommandListParamsStatus = "PENDING_UPLOAD"` - `const DEXCommandListParamsStatusSuccess DEXCommandListParamsStatus = "SUCCESS"` - `const DEXCommandListParamsStatusFailed DEXCommandListParamsStatus = "FAILED"` - `To param.Field[Time]` Query param: End time for the query in ISO (RFC3339 - ISO 8601) format. - `UserEmail param.Field[string]` Query param: Email tied to the device. ### Returns - `type DEXCommandListResponse struct{…}` - `Commands []DEXCommandListResponseCommand` - `ID string` - `CompletedDate Time` - `CreatedDate Time` - `DeviceID string` - `Filename string` - `RegistrationID string` Unique identifier for the device registration - `Status string` - `Type string` - `UserEmail string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.DEX.Commands.List(context.TODO(), zero_trust.DEXCommandListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(10.000000), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": { "commands": [ { "id": "id", "completed_date": "2019-12-27T18:11:19.117Z", "created_date": "2019-12-27T18:11:19.117Z", "device_id": "device_id", "filename": "filename", "registration_id": "registration_id", "status": "status", "type": "type", "user_email": "user_email" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Create account commands `client.ZeroTrust.DEX.Commands.New(ctx, params) (*DEXCommandNewResponse, error)` **post** `/accounts/{account_id}/dex/commands` Initiate commands for up to 10 devices per account. ### Parameters - `params DEXCommandNewParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `Commands param.Field[[]DEXCommandNewParamsCommand]` Body param: List of device-level commands to execute - `DeviceID string` Unique identifier for the physical device - `Type DEXCommandNewParamsCommandsType` Type of command to execute on the device - `const DEXCommandNewParamsCommandsTypePCAP DEXCommandNewParamsCommandsType = "pcap"` - `const DEXCommandNewParamsCommandsTypeSpeedTest DEXCommandNewParamsCommandsType = "speed-test"` - `const DEXCommandNewParamsCommandsTypeWARPDiag DEXCommandNewParamsCommandsType = "warp-diag"` - `UserEmail string` Email tied to the device - `Args DEXCommandNewParamsCommandsArgs` Command arguments. Allowed fields depend on `type`. - `type DEXCommandNewParamsCommandsArgsWARPDiagArgs struct{…}` - `TestAllRoutes bool` Test an IP address from all included or excluded ranges. Essentially the same as running 'route get ' and collecting the results. This option may increase the time taken to collect the warp-diag. - `type DEXCommandNewParamsCommandsArgsPCAPArgs struct{…}` - `MaxFileSizeMB float64` Maximum file size (in MB) for the capture file. If the capture artifact exceeds the specified max file size, it will NOT be uploaded. - `PacketSizeBytes float64` Maximum number of bytes to save for each packet - `TimeLimitMin float64` Limit on capture duration (in minutes) - `type DEXCommandNewParamsCommandsArgsSpeedTestArgs struct{…}` - `Interfaces []DEXCommandNewParamsCommandsArgsSpeedTestArgsInterface` List of interfaces to run the speed test on - `const DEXCommandNewParamsCommandsArgsSpeedTestArgsInterfaceDefault DEXCommandNewParamsCommandsArgsSpeedTestArgsInterface = "default"` - `const DEXCommandNewParamsCommandsArgsSpeedTestArgsInterfaceTunnel DEXCommandNewParamsCommandsArgsSpeedTestArgsInterface = "tunnel"` - `RegistrationID string` Unique identifier for the device registration. Required for multi-user devices to target the correct user session. ### Returns - `type DEXCommandNewResponse struct{…}` - `Commands []DEXCommandNewResponseCommand` List of created commands - `ID string` Unique identifier for the command - `Args map[string, string]` Command arguments - `DeviceID string` Identifier for the device associated with the command - `RegistrationID string` Unique identifier for the device registration - `Status DEXCommandNewResponseCommandsStatus` Current status of the command - `const DEXCommandNewResponseCommandsStatusPendingExec DEXCommandNewResponseCommandsStatus = "PENDING_EXEC"` - `const DEXCommandNewResponseCommandsStatusPendingUpload DEXCommandNewResponseCommandsStatus = "PENDING_UPLOAD"` - `const DEXCommandNewResponseCommandsStatusSuccess DEXCommandNewResponseCommandsStatus = "SUCCESS"` - `const DEXCommandNewResponseCommandsStatusFailed DEXCommandNewResponseCommandsStatus = "FAILED"` - `Type string` Type of the command (e.g., "pcap", "speed-test", or "warp-diag") ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) command, err := client.ZeroTrust.DEX.Commands.New(context.TODO(), zero_trust.DEXCommandNewParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), Commands: cloudflare.F([]zero_trust.DEXCommandNewParamsCommand{zero_trust.DEXCommandNewParamsCommand{ DeviceID: cloudflare.F("device_id"), Type: cloudflare.F(zero_trust.DEXCommandNewParamsCommandsTypePCAP), UserEmail: cloudflare.F("user_email"), }}), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", command.Commands) } ``` #### Response ```json { "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": { "commands": [ { "id": "id", "args": { "foo": "string" }, "device_id": "device_id", "registration_id": "registration_id", "status": "PENDING_EXEC", "type": "type" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` # Devices ## List devices eligible for remote captures `client.ZeroTrust.DEX.Commands.Devices.List(ctx, params) (*V4PagePagination[DEXCommandDeviceListResponse], error)` **get** `/accounts/{account_id}/dex/commands/devices` List devices with WARP client support for remote captures which have been connected in the last 1 hour. ### Parameters - `params DEXCommandDeviceListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `Page param.Field[float64]` Query param: Page number of paginated results. - `PerPage param.Field[float64]` Query param: Number of results per page. - `Search param.Field[string]` Query param: Filter devices by name or email. ### Returns - `type DEXCommandDeviceListResponse struct{…}` - `Devices []DEXCommandDeviceListResponseDevice` List of eligible devices - `DeviceID string` Device identifier (UUID v4) - `DeviceName string` Device identifier (human readable) - `Eligible bool` Whether the device is eligible for remote captures - `IneligibleReason string` If the device is not eligible, the reason why. - `PersonEmail string` User contact email address - `Platform string` Operating system. - `RegistrationID string` Device registration identifier (UUID v4). On multi-user devices, this uniquely identifies a user's registration on the device. - `Status string` Network status. - `Timestamp string` - `Version string` WARP client version. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.DEX.Commands.Devices.List(context.TODO(), zero_trust.DEXCommandDeviceListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(10.000000), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": { "devices": [ { "deviceId": "deviceId", "deviceName": "deviceName", "eligible": true, "ineligibleReason": "ineligibleReason", "personEmail": "personEmail", "platform": "windows", "registrationId": "registrationId", "status": "connected", "timestamp": "2023-10-11 00:00:00+00", "version": "1.0.0" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` # Downloads ## Download command output file `client.ZeroTrust.DEX.Commands.Downloads.Get(ctx, commandID, filename, query) (*Response, error)` **get** `/accounts/{account_id}/dex/commands/{command_id}/downloads/{filename}` Downloads artifacts for an executed command. Bulk downloads are not supported ### Parameters - `commandID string` Unique identifier for a command - `filename string` - `query DEXCommandDownloadGetParams` - `AccountID param.Field[string]` Unique identifier linked to an account. ### Returns - `type DEXCommandDownloadGetResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) download, err := client.ZeroTrust.DEX.Commands.Downloads.Get( context.TODO(), "5758fefe-ae7e-4538-a39b-1fef6abcb909", "filename", zero_trust.DEXCommandDownloadGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", download) } ``` # Quota ## Returns account commands usage, quota, and reset time `client.ZeroTrust.DEX.Commands.Quota.Get(ctx, query) (*DEXCommandQuotaGetResponse, error)` **get** `/accounts/{account_id}/dex/commands/quota` Retrieves the current quota usage and limits for device commands within a specific account, including the time when the quota will reset ### Parameters - `query DEXCommandQuotaGetParams` - `AccountID param.Field[string]` Unique identifier linked to an account. ### Returns - `type DEXCommandQuotaGetResponse struct{…}` - `Quota float64` The total number of commands that can be initiated for an account. - `QuotaUsage float64` The number of commands that have been initiated for an account. - `ResetTime Time` The time when the quota resets. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) quota, err := client.ZeroTrust.DEX.Commands.Quota.Get(context.TODO(), zero_trust.DEXCommandQuotaGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", quota.Quota) } ``` #### Response ```json { "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": { "quota": 0, "quota_usage": 0, "reset_time": "2019-12-27T18:11:19.117Z" }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` # Colos ## List Cloudflare colos `client.ZeroTrust.DEX.Colos.List(ctx, params) (*SinglePage[DEXColoListResponse], error)` **get** `/accounts/{account_id}/dex/colos` List Cloudflare colos that account's devices were connected to during a time period, sorted by usage starting from the most used colo. Colos without traffic are also returned and sorted alphabetically. ### Parameters - `params DEXColoListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start time for connection period in ISO (RFC3339 - ISO 8601) format. - `To param.Field[string]` Query param: End time for connection period in ISO (RFC3339 - ISO 8601) format. - `SortBy param.Field[DEXColoListParamsSortBy]` Query param: Type of usage that colos should be sorted by. If unspecified, returns all Cloudflare colos sorted alphabetically. - `const DEXColoListParamsSortByFleetStatusUsage DEXColoListParamsSortBy = "fleet-status-usage"` - `const DEXColoListParamsSortByApplicationTestsUsage DEXColoListParamsSortBy = "application-tests-usage"` ### Returns - `type DEXColoListResponse struct{…}` - `AirportCode string` Airport code - `City string` City - `CountryCode string` Country code ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.DEX.Colos.List(context.TODO(), zero_trust.DEXColoListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("2023-08-20T20:45:00Z"), To: cloudflare.F("2023-08-24T20:45:00Z"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": [ { "airportCode": "SFO", "city": "San Francisco", "countryCode": "US" } ] } ``` # Fleet Status ## Get live aggregate device details by dimension `client.ZeroTrust.DEX.FleetStatus.Live(ctx, params) (*DEXFleetStatusLiveResponse, error)` **get** `/accounts/{account_id}/dex/fleet-status/live` Get details for live (up to 60 minutes) devices using WARP. ### Parameters - `params DEXFleetStatusLiveParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `SinceMinutes param.Field[float64]` Query param: Number of minutes before current time. ### Returns - `type DEXFleetStatusLiveResponse struct{…}` - `DeviceStats DEXFleetStatusLiveResponseDeviceStats` - `ByColo []LiveStat` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` - `ByMode []LiveStat` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` - `ByPlatform []LiveStat` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` - `ByStatus []LiveStat` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` - `ByVersion []LiveStat` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` - `UniqueDevicesTotal float64` Number of unique devices ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.ZeroTrust.DEX.FleetStatus.Live(context.TODO(), zero_trust.DEXFleetStatusLiveParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), SinceMinutes: cloudflare.F(10.000000), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.DeviceStats) } ``` #### Response ```json { "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": { "deviceStats": { "byColo": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byMode": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byPlatform": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byStatus": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byVersion": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "uniqueDevicesTotal": 0 } } } ``` ## Get over time aggregate details for devices by dimension `client.ZeroTrust.DEX.FleetStatus.OverTime(ctx, params) (*DEXFleetStatusOverTimeResponse, error)` **get** `/accounts/{account_id}/dex/fleet-status/over-time` Get aggregate details for devices using WARP, up to 7 days. ### Parameters - `params DEXFleetStatusOverTimeParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `To param.Field[string]` Query param: End of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `Colo param.Field[string]` Query param: Cloudflare colo airport code. - `DeviceID param.Field[string]` Query param: Device-specific ID, given as UUID. ### Returns - `type DEXFleetStatusOverTimeResponse struct{…}` - `DeviceStats DEXFleetStatusOverTimeResponseDeviceStats` - `ByMode []DEXFleetStatusOverTimeResponseDeviceStatsByMode` - `Timestamp string` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` - `ByStatus []DEXFleetStatusOverTimeResponseDeviceStatsByStatus` - `Timestamp string` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` - `UniqueDevicesTotal float64` Number of unique devices ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.ZeroTrust.DEX.FleetStatus.OverTime(context.TODO(), zero_trust.DEXFleetStatusOverTimeParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("2023-10-11 00:00:00+00"), To: cloudflare.F("2023-10-11 00:00:00+00"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.DeviceStats) } ``` #### Response ```json { "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": { "deviceStats": { "byMode": [ { "timestamp": "2023-10-11 00:00:00+00", "uniqueDevicesTotal": 0, "value": "value" } ], "byStatus": [ { "timestamp": "2023-10-11 00:00:00+00", "uniqueDevicesTotal": 0, "value": "value" } ], "uniqueDevicesTotal": 0 } } } ``` ## Domain Types ### Live Stat - `type LiveStat struct{…}` - `UniqueDevicesTotal float64` Number of unique devices - `Value string` # Devices ## List details of devices using WARP. `client.ZeroTrust.DEX.FleetStatus.Devices.List(ctx, params) (*V4PagePaginationArray[DEXFleetStatusDeviceListResponse], error)` **get** `/accounts/{account_id}/dex/fleet-status/devices` List details of devices using WARP. ### Parameters - `params DEXFleetStatusDeviceListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `Page param.Field[float64]` Query param: Page number of paginated results. - `PerPage param.Field[float64]` Query param: Number of results per page. - `To param.Field[string]` Query param: End of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `Colo param.Field[string]` Query param: Cloudflare colo airport code. - `DeviceID param.Field[string]` Query param: Device-specific ID, given as UUID. - `Mode param.Field[string]` Query param: The mode under which the WARP client is run. - `Platform param.Field[string]` Query param: Operating system. - `SortBy param.Field[DEXFleetStatusDeviceListParamsSortBy]` Query param: Dimension to sort results by. - `const DEXFleetStatusDeviceListParamsSortByColo DEXFleetStatusDeviceListParamsSortBy = "colo"` - `const DEXFleetStatusDeviceListParamsSortByDeviceID DEXFleetStatusDeviceListParamsSortBy = "device_id"` - `const DEXFleetStatusDeviceListParamsSortByMode DEXFleetStatusDeviceListParamsSortBy = "mode"` - `const DEXFleetStatusDeviceListParamsSortByPlatform DEXFleetStatusDeviceListParamsSortBy = "platform"` - `const DEXFleetStatusDeviceListParamsSortByStatus DEXFleetStatusDeviceListParamsSortBy = "status"` - `const DEXFleetStatusDeviceListParamsSortByTimestamp DEXFleetStatusDeviceListParamsSortBy = "timestamp"` - `const DEXFleetStatusDeviceListParamsSortByVersion DEXFleetStatusDeviceListParamsSortBy = "version"` - `Source param.Field[DEXFleetStatusDeviceListParamsSource]` Query param: Source: * `hourly` - device details aggregated hourly, up to 7 days prior * `last_seen` - device details, up to 60 minutes prior. Time windows exceeding 60 minutes will be rejected from June 1st, 2026. Please use 'hourly' or 'raw' instead for longer time ranges. * `raw` - device details, up to 7 days prior - `const DEXFleetStatusDeviceListParamsSourceLastSeen DEXFleetStatusDeviceListParamsSource = "last_seen"` - `const DEXFleetStatusDeviceListParamsSourceHourly DEXFleetStatusDeviceListParamsSource = "hourly"` - `const DEXFleetStatusDeviceListParamsSourceRaw DEXFleetStatusDeviceListParamsSource = "raw"` - `Status param.Field[string]` Query param: Network status. - `Version param.Field[string]` Query param: WARP client version. ### Returns - `type DEXFleetStatusDeviceListResponse struct{…}` - `Colo string` Cloudflare colo airport code. - `DeviceID string` Device identifier (UUID v4) - `Mode string` The mode under which the WARP client is run. - `Platform string` Operating system. - `Status string` Network status. - `Timestamp string` - `Version string` WARP client version. - `AlwaysOn bool` - `BatteryCharging bool` - `BatteryCycles int64` - `BatteryPct float64` - `ConnectionType string` - `CPUPct float64` - `CPUPctByApp []DEXFleetStatusDeviceListResponseCPUPctByApp` - `CPUPct float64` CPU usage percentage, on a scale of 0 to 100. - `Name string` Application name. - `DeviceIPV4 DEXFleetStatusDeviceListResponseDeviceIPV4` - `Address string` - `ASN int64` - `Aso string` - `Location DEXFleetStatusDeviceListResponseDeviceIPV4Location` - `City string` - `CountryISO string` - `StateISO string` - `Zip string` - `Name string` - `Netmask string` - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `DeviceIPV6 DEXFleetStatusDeviceListResponseDeviceIPV6` - `Address string` - `ASN int64` - `Aso string` - `Location DEXFleetStatusDeviceListResponseDeviceIPV6Location` - `City string` - `CountryISO string` - `StateISO string` - `Zip string` - `Name string` - `Netmask string` - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `DeviceName string` Device identifier (human readable). - `DeviceRegistration string` Deprecated: use registrationId. Device registration identifier (UUID). - `DiskReadBps int64` - `DiskUsagePct float64` - `DiskWriteBps int64` - `DOHSubdomain string` - `EstimatedLossPct float64` - `FirewallEnabled bool` - `GatewayIPV4 DEXFleetStatusDeviceListResponseGatewayIPV4` - `Address string` - `ASN int64` - `Aso string` - `Location DEXFleetStatusDeviceListResponseGatewayIPV4Location` - `City string` - `CountryISO string` - `StateISO string` - `Zip string` - `Name string` - `Netmask string` - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `GatewayIPV6 DEXFleetStatusDeviceListResponseGatewayIPV6` - `Address string` - `ASN int64` - `Aso string` - `Location DEXFleetStatusDeviceListResponseGatewayIPV6Location` - `City string` - `CountryISO string` - `StateISO string` - `Zip string` - `Name string` - `Netmask string` - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `HandshakeLatencyMs float64` - `ISPIPV4 DEXFleetStatusDeviceListResponseISPIPV4` - `Address string` - `ASN int64` - `Aso string` - `Location DEXFleetStatusDeviceListResponseISPIPV4Location` - `City string` - `CountryISO string` - `StateISO string` - `Zip string` - `Name string` - `Netmask string` - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `ISPIPV6 DEXFleetStatusDeviceListResponseISPIPV6` - `Address string` - `ASN int64` - `Aso string` - `Location DEXFleetStatusDeviceListResponseISPIPV6Location` - `City string` - `CountryISO string` - `StateISO string` - `Zip string` - `Name string` - `Netmask string` - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `Metal string` - `NetworkRcvdBps int64` - `NetworkSentBps int64` - `NetworkSsid string` - `PersonEmail string` User contact email address - `RamAvailableKB int64` - `RamUsedPct float64` - `RamUsedPctByApp []DEXFleetStatusDeviceListResponseRamUsedPctByApp` - `Name string` Application name. - `RamUsedPct float64` RAM usage percentage, on a scale of 0 to 100. - `RegistrationID string` Device registration identifier (UUID v4). On multi-user devices, this uniquely identifies a user's registration on the device. - `RTT DEXFleetStatusDeviceListResponseRTT` Round-trip time statistics for the WARP tunnel. - `MinRTTUs DEXFleetStatusDeviceListResponseRTTMinRTTUs` Minimum round-trip time in microseconds. - `Downstream int64` - `Upstream int64` - `RTTUs DEXFleetStatusDeviceListResponseRTTRTTUs` Round-trip time in microseconds. - `Downstream int64` - `Upstream int64` - `RTTVarUs DEXFleetStatusDeviceListResponseRTTRTTVarUs` Round-trip time variance in microseconds. - `Downstream int64` - `Upstream int64` - `SwitchLocked bool` - `TunnelStats DEXFleetStatusDeviceListResponseTunnelStats` WARP tunnel packet and byte counters. - `BytesLost DEXFleetStatusDeviceListResponseTunnelStatsBytesLost` Number of bytes lost, split by direction. - `Downstream int64` - `Upstream int64` - `BytesReceived DEXFleetStatusDeviceListResponseTunnelStatsBytesReceived` Number of bytes received, split by direction. - `Downstream int64` - `Upstream int64` - `BytesRetransmitted DEXFleetStatusDeviceListResponseTunnelStatsBytesRetransmitted` Number of bytes retransmitted, split by direction. - `Downstream int64` - `Upstream int64` - `BytesSent DEXFleetStatusDeviceListResponseTunnelStatsBytesSent` Number of bytes sent, split by direction. - `Downstream int64` - `Upstream int64` - `PacketsLost DEXFleetStatusDeviceListResponseTunnelStatsPacketsLost` Number of packets lost, split by direction. - `Downstream int64` - `Upstream int64` - `PacketsReceived DEXFleetStatusDeviceListResponseTunnelStatsPacketsReceived` Number of packets received, split by direction. - `Downstream int64` - `Upstream int64` - `PacketsRetransmitted DEXFleetStatusDeviceListResponseTunnelStatsPacketsRetransmitted` Number of packets retransmitted, split by direction. - `Downstream int64` - `Upstream int64` - `PacketsSent DEXFleetStatusDeviceListResponseTunnelStatsPacketsSent` Number of packets sent, split by direction. - `Downstream int64` - `Upstream int64` - `StatsWindowMs int64` The measurement window duration in milliseconds. - `TunnelType string` - `WifiStrengthDbm int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.DEX.FleetStatus.Devices.List(context.TODO(), zero_trust.DEXFleetStatusDeviceListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("2023-10-11 00:00:00+00"), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(10.000000), To: cloudflare.F("2023-10-11 00:00:00+00"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": [ { "colo": "SJC", "deviceId": "deviceId", "mode": "proxy", "platform": "windows", "status": "connected", "timestamp": "2023-10-11 00:00:00+00", "version": "1.0.0", "alwaysOn": true, "batteryCharging": true, "batteryCycles": 0, "batteryPct": 0, "connectionType": "connectionType", "cpuPct": 0, "cpuPctByApp": [ { "cpu_pct": 0, "name": "name" } ], "deviceIpv4": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "deviceIpv6": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "deviceName": "deviceName", "deviceRegistration": "deviceRegistration", "diskReadBps": 0, "diskUsagePct": 0, "diskWriteBps": 0, "dohSubdomain": "dohSubdomain", "estimatedLossPct": 0, "firewallEnabled": true, "gatewayIpv4": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "gatewayIpv6": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "handshakeLatencyMs": 0, "ispIpv4": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "ispIpv6": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "metal": "metal", "networkRcvdBps": 0, "networkSentBps": 0, "networkSsid": "networkSsid", "personEmail": "personEmail", "ramAvailableKb": 0, "ramUsedPct": 0, "ramUsedPctByApp": [ { "name": "name", "ram_used_pct": 0 } ], "registrationId": "registrationId", "rtt": { "minRttUs": { "downstream": 0, "upstream": 0 }, "rttUs": { "downstream": 0, "upstream": 0 }, "rttVarUs": { "downstream": 0, "upstream": 0 } }, "switchLocked": true, "tunnelStats": { "bytesLost": { "downstream": 0, "upstream": 0 }, "bytesReceived": { "downstream": 0, "upstream": 0 }, "bytesRetransmitted": { "downstream": 0, "upstream": 0 }, "bytesSent": { "downstream": 0, "upstream": 0 }, "packetsLost": { "downstream": 0, "upstream": 0 }, "packetsReceived": { "downstream": 0, "upstream": 0 }, "packetsRetransmitted": { "downstream": 0, "upstream": 0 }, "packetsSent": { "downstream": 0, "upstream": 0 }, "statsWindowMs": 0 }, "tunnelType": "tunnelType", "wifiStrengthDbm": 0 } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` # HTTP Tests ## Get details and aggregate metrics for an http test `client.ZeroTrust.DEX.HTTPTests.Get(ctx, testID, params) (*HTTPDetails, error)` **get** `/accounts/{account_id}/dex/http-tests/{test_id}` Get test details and aggregate performance metrics for an http test for a given time period between 1 hour and 7 days. ### Parameters - `testID string` API Resource UUID tag. - `params DEXHTTPTestGetParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start time for aggregate metrics in ISO ms. - `Interval param.Field[DexhttpTestGetParamsInterval]` Query param: Time interval for aggregate time slots. - `const DexhttpTestGetParamsIntervalMinute DexhttpTestGetParamsInterval = "minute"` - `const DexhttpTestGetParamsIntervalHour DexhttpTestGetParamsInterval = "hour"` - `To param.Field[string]` Query param: End time for aggregate metrics in ISO ms. - `Colo param.Field[string]` Query param: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `DeviceID param.Field[[]string]` Query param: Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `type HTTPDetails struct{…}` - `Host string` The url of the HTTP synthetic application test. - `HTTPStats HTTPDetailsHTTPStats` - `AvailabilityPct HTTPDetailsHTTPStatsAvailabilityPct` - `Slots []HTTPDetailsHTTPStatsAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `DNSResponseTimeMs TestStatOverTime` - `Slots []TestStatOverTimeSlot` - `Timestamp string` - `Value int64` - `Avg int64` average observed in the time period. - `Max int64` highest observed in the time period. - `Min int64` lowest observed in the time period. - `HTTPStatusCode []HTTPDetailsHTTPStatsHTTPStatusCode` - `Status200 int64` - `Status300 int64` - `Status400 int64` - `Status500 int64` - `Timestamp string` - `ResourceFetchTimeMs TestStatOverTime` - `ServerResponseTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. - `HTTPStatsByColo []HTTPDetailsHTTPStatsByColo` - `AvailabilityPct HTTPDetailsHTTPStatsByColoAvailabilityPct` - `Slots []HTTPDetailsHTTPStatsByColoAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `Colo string` - `DNSResponseTimeMs TestStatOverTime` - `HTTPStatusCode []HTTPDetailsHTTPStatsByColoHTTPStatusCode` - `Status200 int64` - `Status300 int64` - `Status400 int64` - `Status500 int64` - `Timestamp string` - `ResourceFetchTimeMs TestStatOverTime` - `ServerResponseTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. - `Interval string` The interval at which the HTTP synthetic application test is set to run. - `Kind HTTPDetailsKind` - `const HTTPDetailsKindHTTP HTTPDetailsKind = "http"` - `Method string` The HTTP method to use when running the test. - `Name string` The name of the HTTP synthetic application test. - `TargetPolicies []DigitalExperienceMonitor` - `ID string` API Resource UUID tag. - `Default bool` Whether the policy is the default for the account. - `Name string` - `Targeted bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) httpDetails, err := client.ZeroTrust.DEX.HTTPTests.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXHTTPTestGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("1689520412000"), Interval: cloudflare.F(zero_trust.DexhttpTestGetParamsIntervalMinute), To: cloudflare.F("1689606812000"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", httpDetails.Host) } ``` #### Response ```json { "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": { "host": "http://example.com", "httpStats": { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "dnsResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "httpStatusCode": [ { "status200": 0, "status300": 0, "status400": 0, "status500": 0, "timestamp": "2023-07-16 15:00:00+00" } ], "resourceFetchTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "serverResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 }, "httpStatsByColo": [ { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "colo": "DFW", "dnsResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "httpStatusCode": [ { "status200": 0, "status300": 0, "status400": 0, "status500": 0, "timestamp": "2023-07-16 15:00:00+00" } ], "resourceFetchTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "serverResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 } ], "interval": "0h5m0s", "kind": "http", "method": "GET", "name": "Atlassian Sign In Page", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true } } ``` ## Domain Types ### HTTP Details - `type HTTPDetails struct{…}` - `Host string` The url of the HTTP synthetic application test. - `HTTPStats HTTPDetailsHTTPStats` - `AvailabilityPct HTTPDetailsHTTPStatsAvailabilityPct` - `Slots []HTTPDetailsHTTPStatsAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `DNSResponseTimeMs TestStatOverTime` - `Slots []TestStatOverTimeSlot` - `Timestamp string` - `Value int64` - `Avg int64` average observed in the time period. - `Max int64` highest observed in the time period. - `Min int64` lowest observed in the time period. - `HTTPStatusCode []HTTPDetailsHTTPStatsHTTPStatusCode` - `Status200 int64` - `Status300 int64` - `Status400 int64` - `Status500 int64` - `Timestamp string` - `ResourceFetchTimeMs TestStatOverTime` - `ServerResponseTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. - `HTTPStatsByColo []HTTPDetailsHTTPStatsByColo` - `AvailabilityPct HTTPDetailsHTTPStatsByColoAvailabilityPct` - `Slots []HTTPDetailsHTTPStatsByColoAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `Colo string` - `DNSResponseTimeMs TestStatOverTime` - `HTTPStatusCode []HTTPDetailsHTTPStatsByColoHTTPStatusCode` - `Status200 int64` - `Status300 int64` - `Status400 int64` - `Status500 int64` - `Timestamp string` - `ResourceFetchTimeMs TestStatOverTime` - `ServerResponseTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. - `Interval string` The interval at which the HTTP synthetic application test is set to run. - `Kind HTTPDetailsKind` - `const HTTPDetailsKindHTTP HTTPDetailsKind = "http"` - `Method string` The HTTP method to use when running the test. - `Name string` The name of the HTTP synthetic application test. - `TargetPolicies []DigitalExperienceMonitor` - `ID string` API Resource UUID tag. - `Default bool` Whether the policy is the default for the account. - `Name string` - `Targeted bool` # Percentiles ## Get percentiles for an http test `client.ZeroTrust.DEX.HTTPTests.Percentiles.Get(ctx, testID, params) (*HTTPDetailsPercentiles, error)` **get** `/accounts/{account_id}/dex/http-tests/{test_id}/percentiles` Get percentiles for an http test for a given time period between 1 hour and 7 days. ### Parameters - `testID string` API Resource UUID tag. - `params DEXHTTPTestPercentileGetParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start time for the query in ISO (RFC3339 - ISO 8601) format. - `To param.Field[string]` Query param: End time for the query in ISO (RFC3339 - ISO 8601) format. - `Colo param.Field[string]` Query param: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `DeviceID param.Field[[]string]` Query param: Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `type HTTPDetailsPercentiles struct{…}` - `DNSResponseTimeMs Percentiles` - `P50 float64` p50 observed in the time period. - `P90 float64` p90 observed in the time period. - `P95 float64` p95 observed in the time period. - `P99 float64` p99 observed in the time period. - `ResourceFetchTimeMs Percentiles` - `ServerResponseTimeMs Percentiles` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) httpDetailsPercentiles, err := client.ZeroTrust.DEX.HTTPTests.Percentiles.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXHTTPTestPercentileGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("2023-09-20T17:00:00Z"), To: cloudflare.F("2023-09-20T17:00:00Z"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", httpDetailsPercentiles.DNSResponseTimeMs) } ``` #### Response ```json { "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": { "dnsResponseTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "resourceFetchTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "serverResponseTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 } } } ``` ## Domain Types ### HTTP Details Percentiles - `type HTTPDetailsPercentiles struct{…}` - `DNSResponseTimeMs Percentiles` - `P50 float64` p50 observed in the time period. - `P90 float64` p90 observed in the time period. - `P95 float64` p95 observed in the time period. - `P99 float64` p99 observed in the time period. - `ResourceFetchTimeMs Percentiles` - `ServerResponseTimeMs Percentiles` ### Test Stat Over Time - `type TestStatOverTime struct{…}` - `Slots []TestStatOverTimeSlot` - `Timestamp string` - `Value int64` - `Avg int64` average observed in the time period. - `Max int64` highest observed in the time period. - `Min int64` lowest observed in the time period. # Tests ## List DEX test analytics `client.ZeroTrust.DEX.Tests.List(ctx, params) (*V4PagePagination[Tests], error)` **get** `/accounts/{account_id}/dex/tests/overview` List DEX tests with overview metrics. ### Parameters - `params DEXTestListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `Colo param.Field[string]` Query param: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `DeviceID param.Field[[]string]` Query param: Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. - `Kind param.Field[DEXTestListParamsKind]` Query param: Filter by test type. - `const DEXTestListParamsKindHTTP DEXTestListParamsKind = "http"` - `const DEXTestListParamsKindTraceroute DEXTestListParamsKind = "traceroute"` - `Page param.Field[float64]` Query param: Page number of paginated results - `PerPage param.Field[float64]` Query param: Number of items per page - `RegistrationID param.Field[string]` Query param: Optionally filter results to a specific device registration. Must be used in combination with a single deviceId. - `TestName param.Field[string]` Query param: Optionally filter results by test name. ### Returns - `type Tests struct{…}` - `OverviewMetrics TestsOverviewMetrics` - `TestsTotal int64` number of tests. - `AvgHTTPAvailabilityPct float64` percentage availability for all HTTP test results in response. - `AvgTracerouteAvailabilityPct float64` percentage availability for all traceroutes results in response. - `Tests []TestsTest` array of test results objects. - `ID string` API Resource UUID tag. - `Created string` date the test was created. - `Description string` the test description defined during configuration - `Enabled bool` if true, then the test will run on targeted devices. Else, the test will not run. - `Host string` - `Interval string` The interval at which the synthetic application test is set to run. - `Kind TestsTestsKind` test type, http or traceroute - `const TestsTestsKindHTTP TestsTestsKind = "http"` - `const TestsTestsKindTraceroute TestsTestsKind = "traceroute"` - `Name string` name given to this test - `Updated string` - `HTTPResults TestsTestsHTTPResults` - `ResourceFetchTime TestsTestsHTTPResultsResourceFetchTime` - `History []TestsTestsHTTPResultsResourceFetchTimeHistory` - `TimePeriod AggregateTimePeriod` - `Units AggregateTimePeriodUnits` - `const AggregateTimePeriodUnitsHours AggregateTimePeriodUnits = "hours"` - `const AggregateTimePeriodUnitsDays AggregateTimePeriodUnits = "days"` - `const AggregateTimePeriodUnitsTestRuns AggregateTimePeriodUnits = "testRuns"` - `Value int64` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsHTTPResultsResourceFetchTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsHTTPResultsResourceFetchTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` - `HTTPResultsByColo []TestsTestsHTTPResultsByColo` - `Colo string` Cloudflare colo - `ResourceFetchTime TestsTestsHTTPResultsByColoResourceFetchTime` - `History []TestsTestsHTTPResultsByColoResourceFetchTimeHistory` - `TimePeriod AggregateTimePeriod` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsHTTPResultsByColoResourceFetchTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsHTTPResultsByColoResourceFetchTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` - `Method string` for HTTP, the method to use when running the test - `TargetPolicies []DigitalExperienceMonitor` - `ID string` API Resource UUID tag. - `Default bool` Whether the policy is the default for the account. - `Name string` - `Targeted bool` - `TracerouteResults TestsTestsTracerouteResults` - `RoundTripTime TestsTestsTracerouteResultsRoundTripTime` - `History []TestsTestsTracerouteResultsRoundTripTimeHistory` - `TimePeriod AggregateTimePeriod` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsTracerouteResultsRoundTripTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsTracerouteResultsRoundTripTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` - `TracerouteResultsByColo []TestsTestsTracerouteResultsByColo` - `Colo string` Cloudflare colo - `RoundTripTime TestsTestsTracerouteResultsByColoRoundTripTime` - `History []TestsTestsTracerouteResultsByColoRoundTripTimeHistory` - `TimePeriod AggregateTimePeriod` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsTracerouteResultsByColoRoundTripTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsTracerouteResultsByColoRoundTripTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.DEX.Tests.List(context.TODO(), zero_trust.DEXTestListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": { "overviewMetrics": { "testsTotal": 0, "avgHttpAvailabilityPct": 0, "avgTracerouteAvailabilityPct": 0 }, "tests": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created": "created", "description": "description", "enabled": true, "host": "host", "interval": "interval", "kind": "http", "name": "name", "updated": "updated", "httpResults": { "resourceFetchTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } }, "httpResultsByColo": [ { "colo": "SJC", "resourceFetchTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } } ], "method": "method", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "tracerouteResults": { "roundTripTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } }, "tracerouteResultsByColo": [ { "colo": "SJC", "roundTripTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } } ] } ] } } ``` ## Domain Types ### Aggregate Time Period - `type AggregateTimePeriod struct{…}` - `Units AggregateTimePeriodUnits` - `const AggregateTimePeriodUnitsHours AggregateTimePeriodUnits = "hours"` - `const AggregateTimePeriodUnitsDays AggregateTimePeriodUnits = "days"` - `const AggregateTimePeriodUnitsTestRuns AggregateTimePeriodUnits = "testRuns"` - `Value int64` ### Tests - `type Tests struct{…}` - `OverviewMetrics TestsOverviewMetrics` - `TestsTotal int64` number of tests. - `AvgHTTPAvailabilityPct float64` percentage availability for all HTTP test results in response. - `AvgTracerouteAvailabilityPct float64` percentage availability for all traceroutes results in response. - `Tests []TestsTest` array of test results objects. - `ID string` API Resource UUID tag. - `Created string` date the test was created. - `Description string` the test description defined during configuration - `Enabled bool` if true, then the test will run on targeted devices. Else, the test will not run. - `Host string` - `Interval string` The interval at which the synthetic application test is set to run. - `Kind TestsTestsKind` test type, http or traceroute - `const TestsTestsKindHTTP TestsTestsKind = "http"` - `const TestsTestsKindTraceroute TestsTestsKind = "traceroute"` - `Name string` name given to this test - `Updated string` - `HTTPResults TestsTestsHTTPResults` - `ResourceFetchTime TestsTestsHTTPResultsResourceFetchTime` - `History []TestsTestsHTTPResultsResourceFetchTimeHistory` - `TimePeriod AggregateTimePeriod` - `Units AggregateTimePeriodUnits` - `const AggregateTimePeriodUnitsHours AggregateTimePeriodUnits = "hours"` - `const AggregateTimePeriodUnitsDays AggregateTimePeriodUnits = "days"` - `const AggregateTimePeriodUnitsTestRuns AggregateTimePeriodUnits = "testRuns"` - `Value int64` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsHTTPResultsResourceFetchTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsHTTPResultsResourceFetchTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` - `HTTPResultsByColo []TestsTestsHTTPResultsByColo` - `Colo string` Cloudflare colo - `ResourceFetchTime TestsTestsHTTPResultsByColoResourceFetchTime` - `History []TestsTestsHTTPResultsByColoResourceFetchTimeHistory` - `TimePeriod AggregateTimePeriod` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsHTTPResultsByColoResourceFetchTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsHTTPResultsByColoResourceFetchTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` - `Method string` for HTTP, the method to use when running the test - `TargetPolicies []DigitalExperienceMonitor` - `ID string` API Resource UUID tag. - `Default bool` Whether the policy is the default for the account. - `Name string` - `Targeted bool` - `TracerouteResults TestsTestsTracerouteResults` - `RoundTripTime TestsTestsTracerouteResultsRoundTripTime` - `History []TestsTestsTracerouteResultsRoundTripTimeHistory` - `TimePeriod AggregateTimePeriod` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsTracerouteResultsRoundTripTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsTracerouteResultsRoundTripTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` - `TracerouteResultsByColo []TestsTestsTracerouteResultsByColo` - `Colo string` Cloudflare colo - `RoundTripTime TestsTestsTracerouteResultsByColoRoundTripTime` - `History []TestsTestsTracerouteResultsByColoRoundTripTimeHistory` - `TimePeriod AggregateTimePeriod` - `AvgMs int64` - `DeltaPct float64` - `AvgMs int64` - `OverTime TestsTestsTracerouteResultsByColoRoundTripTimeOverTime` - `TimePeriod AggregateTimePeriod` - `Values []TestsTestsTracerouteResultsByColoRoundTripTimeOverTimeValue` - `AvgMs int64` - `Timestamp string` # Unique Devices ## Get count of devices targeted `client.ZeroTrust.DEX.Tests.UniqueDevices.List(ctx, params) (*UniqueDevices, error)` **get** `/accounts/{account_id}/dex/tests/unique-devices` Returns unique count of devices that have run synthetic application monitoring tests in the past 7 days. ### Parameters - `params DEXTestUniqueDeviceListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `DeviceID param.Field[[]string]` Query param: Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. - `TestName param.Field[string]` Query param: Optionally filter results by test name. ### Returns - `type UniqueDevices struct{…}` - `UniqueDevicesTotal int64` total number of unique devices ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) uniqueDevices, err := client.ZeroTrust.DEX.Tests.UniqueDevices.List(context.TODO(), zero_trust.DEXTestUniqueDeviceListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", uniqueDevices.UniqueDevicesTotal) } ``` #### Response ```json { "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": { "uniqueDevicesTotal": 0 } } ``` ## Domain Types ### Unique Devices - `type UniqueDevices struct{…}` - `UniqueDevicesTotal int64` total number of unique devices # Traceroute Test Results # Network Path ## Get details for a specific traceroute test run `client.ZeroTrust.DEX.TracerouteTestResults.NetworkPath.Get(ctx, testResultID, query) (*DEXTracerouteTestResultNetworkPathGetResponse, error)` **get** `/accounts/{account_id}/dex/traceroute-test-results/{test_result_id}/network-path` Get a breakdown of hops and performance metrics for a specific traceroute test run ### Parameters - `testResultID string` API Resource UUID tag. - `query DEXTracerouteTestResultNetworkPathGetParams` - `AccountID param.Field[string]` Unique identifier linked to an account. ### Returns - `type DEXTracerouteTestResultNetworkPathGetResponse struct{…}` - `Hops []DEXTracerouteTestResultNetworkPathGetResponseHop` An array of the hops taken by the device to reach the end destination. - `TTL int64` - `ASN int64` - `Aso string` - `IPAddress string` - `Location DEXTracerouteTestResultNetworkPathGetResponseHopsLocation` - `City string` - `State string` - `Zip string` - `Mile DEXTracerouteTestResultNetworkPathGetResponseHopsMile` - `const DEXTracerouteTestResultNetworkPathGetResponseHopsMileClientToApp DEXTracerouteTestResultNetworkPathGetResponseHopsMile = "client-to-app"` - `const DEXTracerouteTestResultNetworkPathGetResponseHopsMileClientToCfEgress DEXTracerouteTestResultNetworkPathGetResponseHopsMile = "client-to-cf-egress"` - `const DEXTracerouteTestResultNetworkPathGetResponseHopsMileClientToCfIngress DEXTracerouteTestResultNetworkPathGetResponseHopsMile = "client-to-cf-ingress"` - `const DEXTracerouteTestResultNetworkPathGetResponseHopsMileClientToISP DEXTracerouteTestResultNetworkPathGetResponseHopsMile = "client-to-isp"` - `Name string` - `PacketLossPct float64` - `RTTMs int64` - `ResultID string` API Resource UUID tag. - `Colo string` Cloudflare colo airport code. - `DeviceName string` Name of the device associated with this network path response. - `ExecutionContext DEXTracerouteTestResultNetworkPathGetResponseExecutionContext` Whether the test was run inside or outside of the WARP tunnel. - `const DEXTracerouteTestResultNetworkPathGetResponseExecutionContextExecutionContextInvalid DEXTracerouteTestResultNetworkPathGetResponseExecutionContext = "EXECUTION_CONTEXT_INVALID"` - `const DEXTracerouteTestResultNetworkPathGetResponseExecutionContextOutOfTunnel DEXTracerouteTestResultNetworkPathGetResponseExecutionContext = "OUT_OF_TUNNEL"` - `const DEXTracerouteTestResultNetworkPathGetResponseExecutionContextInTunnel DEXTracerouteTestResultNetworkPathGetResponseExecutionContext = "IN_TUNNEL"` - `TestID string` API Resource UUID tag. - `TestName string` Name of the traceroute test. - `TimeStart string` Timestamp indicating when the traceroute test execution began. - `TunnelType string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) networkPath, err := client.ZeroTrust.DEX.TracerouteTestResults.NetworkPath.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXTracerouteTestResultNetworkPathGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", networkPath.Hops) } ``` #### Response ```json { "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": { "hops": [ { "ttl": 0, "asn": 0, "aso": "aso", "ipAddress": "ipAddress", "location": { "city": "city", "state": "state", "zip": "zip" }, "mile": "client-to-app", "name": "name", "packetLossPct": 0, "rttMs": 0 } ], "resultId": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "colo": "SJC", "deviceName": "deviceName", "execution_context": "EXECUTION_CONTEXT_INVALID", "testId": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "testName": "testName", "time_start": "2023-07-16 15:00:00+00", "tunnel_type": "tunnel_type" } } ``` # Traceroute Tests ## Get details and aggregate metrics for a traceroute test `client.ZeroTrust.DEX.TracerouteTests.Get(ctx, testID, params) (*Traceroute, error)` **get** `/accounts/{account_id}/dex/traceroute-tests/{test_id}` Get test details and aggregate performance metrics for a traceroute test for a given time period between 1 hour and 7 days. ### Parameters - `testID string` API Resource UUID tag. - `params DEXTracerouteTestGetParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start time for aggregate metrics in ISO ms. - `Interval param.Field[DEXTracerouteTestGetParamsInterval]` Query param: Time interval for aggregate time slots. - `const DEXTracerouteTestGetParamsIntervalMinute DEXTracerouteTestGetParamsInterval = "minute"` - `const DEXTracerouteTestGetParamsIntervalHour DEXTracerouteTestGetParamsInterval = "hour"` - `To param.Field[string]` Query param: End time for aggregate metrics in ISO ms. - `Colo param.Field[string]` Query param: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `DeviceID param.Field[[]string]` Query param: Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `type Traceroute struct{…}` - `Host string` The host of the Traceroute synthetic application test. - `Interval string` The interval at which the Traceroute synthetic application test is set to run. - `Kind TracerouteKind` - `const TracerouteKindTraceroute TracerouteKind = "traceroute"` - `Name string` The name of the Traceroute synthetic application test. - `TargetPolicies []DigitalExperienceMonitor` - `ID string` API Resource UUID tag. - `Default bool` Whether the policy is the default for the account. - `Name string` - `Targeted bool` - `TracerouteStats TracerouteTracerouteStats` - `AvailabilityPct TracerouteTracerouteStatsAvailabilityPct` - `Slots []TracerouteTracerouteStatsAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `HopsCount TestStatOverTime` - `Slots []TestStatOverTimeSlot` - `Timestamp string` - `Value int64` - `Avg int64` average observed in the time period. - `Max int64` highest observed in the time period. - `Min int64` lowest observed in the time period. - `PacketLossPct TracerouteTracerouteStatsPacketLossPct` - `Slots []TracerouteTracerouteStatsPacketLossPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `RoundTripTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. - `TracerouteStatsByColo []TracerouteTracerouteStatsByColo` - `AvailabilityPct TracerouteTracerouteStatsByColoAvailabilityPct` - `Slots []TracerouteTracerouteStatsByColoAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `Colo string` - `HopsCount TestStatOverTime` - `PacketLossPct TracerouteTracerouteStatsByColoPacketLossPct` - `Slots []TracerouteTracerouteStatsByColoPacketLossPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `RoundTripTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) traceroute, err := client.ZeroTrust.DEX.TracerouteTests.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXTracerouteTestGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("1689520412000"), Interval: cloudflare.F(zero_trust.DEXTracerouteTestGetParamsIntervalMinute), To: cloudflare.F("1689606812000"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", traceroute.Host) } ``` #### Response ```json { "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": { "host": "1.1.1.1", "interval": "0h5m0s", "kind": "traceroute", "name": "Atlassian Sign In Page", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "tracerouteStats": { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "hopsCount": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "packetLossPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "roundTripTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 }, "tracerouteStatsByColo": [ { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "colo": "DFW", "hopsCount": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "packetLossPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "roundTripTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 } ] } } ``` ## Get percentiles for a traceroute test `client.ZeroTrust.DEX.TracerouteTests.Percentiles(ctx, testID, params) (*DEXTracerouteTestPercentilesResponse, error)` **get** `/accounts/{account_id}/dex/traceroute-tests/{test_id}/percentiles` Get percentiles for a traceroute test for a given time period between 1 hour and 7 days. ### Parameters - `testID string` API Resource UUID tag. - `params DEXTracerouteTestPercentilesParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `From param.Field[string]` Query param: Start time for the query in ISO (RFC3339 - ISO 8601) format. - `To param.Field[string]` Query param: End time for the query in ISO (RFC3339 - ISO 8601) format. - `Colo param.Field[string]` Query param: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `DeviceID param.Field[[]string]` Query param: Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `type DEXTracerouteTestPercentilesResponse struct{…}` - `HopsCount Percentiles` - `P50 float64` p50 observed in the time period. - `P90 float64` p90 observed in the time period. - `P95 float64` p95 observed in the time period. - `P99 float64` p99 observed in the time period. - `PacketLossPct Percentiles` - `RoundTripTimeMs Percentiles` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.ZeroTrust.DEX.TracerouteTests.Percentiles( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXTracerouteTestPercentilesParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), From: cloudflare.F("2023-09-20T17:00:00Z"), To: cloudflare.F("2023-09-20T17:00:00Z"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.HopsCount) } ``` #### Response ```json { "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": { "hopsCount": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "packetLossPct": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "roundTripTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 } } } ``` ## Get network path breakdown for a traceroute test `client.ZeroTrust.DEX.TracerouteTests.NetworkPath(ctx, testID, params) (*NetworkPathResponse, error)` **get** `/accounts/{account_id}/dex/traceroute-tests/{test_id}/network-path` Get a breakdown of metrics by hop for individual traceroute test runs. ### Parameters - `testID string` API Resource UUID tag. - `params DEXTracerouteTestNetworkPathParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `DeviceID param.Field[string]` Query param: Device to filter traceroute result runs to. - `From param.Field[string]` Query param: Start time for aggregate metrics in ISO ms. - `Interval param.Field[DEXTracerouteTestNetworkPathParamsInterval]` Query param: Time interval for aggregate time slots. - `const DEXTracerouteTestNetworkPathParamsIntervalMinute DEXTracerouteTestNetworkPathParamsInterval = "minute"` - `const DEXTracerouteTestNetworkPathParamsIntervalHour DEXTracerouteTestNetworkPathParamsInterval = "hour"` - `To param.Field[string]` Query param: End time for aggregate metrics in ISO ms. ### Returns - `type NetworkPathResponse struct{…}` - `ID string` API Resource UUID tag. - `DeviceName string` Name of the device that ran the test. - `Interval string` The interval at which the Traceroute synthetic application test is set to run. - `Kind NetworkPathResponseKind` - `const NetworkPathResponseKindTraceroute NetworkPathResponseKind = "traceroute"` - `Name string` - `NetworkPath NetworkPath` - `Slots []NetworkPathSlot` - `ID string` API Resource UUID tag. - `ClientToAppRTTMs int64` Round trip time in ms of the client to app mile - `ClientToCfEgressRTTMs int64` Round trip time in ms of the client to Cloudflare egress mile - `ClientToCfIngressRTTMs int64` Round trip time in ms of the client to Cloudflare ingress mile - `Timestamp string` - `ClientToISPRTTMs int64` Round trip time in ms of the client to ISP mile - `Sampling NetworkPathSampling` Specifies the sampling applied, if any, to the slots response. When sampled, results shown represent the first test run to the start of each sampling interval. - `Unit NetworkPathSamplingUnit` - `const NetworkPathSamplingUnitHours NetworkPathSamplingUnit = "hours"` - `Value int64` - `URL string` The host of the Traceroute synthetic application test. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) networkPathResponse, err := client.ZeroTrust.DEX.TracerouteTests.NetworkPath( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXTracerouteTestNetworkPathParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), DeviceID: cloudflare.F("deviceId"), From: cloudflare.F("1689520412000"), Interval: cloudflare.F(zero_trust.DEXTracerouteTestNetworkPathParamsIntervalMinute), To: cloudflare.F("1689606812000"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", networkPathResponse.ID) } ``` #### Response ```json { "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": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "deviceName": "deviceName", "interval": "0h5m0s", "kind": "traceroute", "name": "name", "networkPath": { "slots": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "clientToAppRttMs": 0, "clientToCfEgressRttMs": 0, "clientToCfIngressRttMs": 0, "timestamp": "2023-07-16 15:00:00+00", "clientToIspRttMs": 0 } ], "sampling": { "unit": "hours", "value": 0 } }, "url": "1.1.1.1" } } ``` ## Domain Types ### Traceroute - `type Traceroute struct{…}` - `Host string` The host of the Traceroute synthetic application test. - `Interval string` The interval at which the Traceroute synthetic application test is set to run. - `Kind TracerouteKind` - `const TracerouteKindTraceroute TracerouteKind = "traceroute"` - `Name string` The name of the Traceroute synthetic application test. - `TargetPolicies []DigitalExperienceMonitor` - `ID string` API Resource UUID tag. - `Default bool` Whether the policy is the default for the account. - `Name string` - `Targeted bool` - `TracerouteStats TracerouteTracerouteStats` - `AvailabilityPct TracerouteTracerouteStatsAvailabilityPct` - `Slots []TracerouteTracerouteStatsAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `HopsCount TestStatOverTime` - `Slots []TestStatOverTimeSlot` - `Timestamp string` - `Value int64` - `Avg int64` average observed in the time period. - `Max int64` highest observed in the time period. - `Min int64` lowest observed in the time period. - `PacketLossPct TracerouteTracerouteStatsPacketLossPct` - `Slots []TracerouteTracerouteStatsPacketLossPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `RoundTripTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. - `TracerouteStatsByColo []TracerouteTracerouteStatsByColo` - `AvailabilityPct TracerouteTracerouteStatsByColoAvailabilityPct` - `Slots []TracerouteTracerouteStatsByColoAvailabilityPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `Colo string` - `HopsCount TestStatOverTime` - `PacketLossPct TracerouteTracerouteStatsByColoPacketLossPct` - `Slots []TracerouteTracerouteStatsByColoPacketLossPctSlot` - `Timestamp string` - `Value float64` - `Avg float64` average observed in the time period. - `Max float64` highest observed in the time period. - `Min float64` lowest observed in the time period. - `RoundTripTimeMs TestStatOverTime` - `UniqueDevicesTotal int64` Count of unique devices that have run this test in the given time period. # Rules ## Get DEX Rule `client.ZeroTrust.DEX.Rules.Get(ctx, ruleID, query) (*DEXRuleGetResponse, error)` **get** `/accounts/{account_id}/dex/rules/{rule_id}` Get details for a DEX Rule. ### Parameters - `ruleID string` API Resource UUID tag. - `query DEXRuleGetParams` - `AccountID param.Field[string]` Unique identifier linked to an account. ### Returns - `type DEXRuleGetResponse struct{…}` - `ID string` API Resource UUID tag. - `CreatedAt string` - `Match string` - `Name string` - `Description string` - `TargetedTests []DEXRuleGetResponseTargetedTest` - `Data SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `Host string` The desired endpoint to test. - `Kind SchemaDataKind` The type of test. - `const SchemaDataKindHTTP SchemaDataKind = "http"` - `const SchemaDataKindTraceroute SchemaDataKind = "traceroute"` - `Method SchemaDataMethod` The HTTP request method type. - `const SchemaDataMethodGet SchemaDataMethod = "GET"` - `Enabled bool` - `Name string` - `TestID string` - `UpdatedAt string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) rule, err := client.ZeroTrust.DEX.Rules.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXRuleGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", rule.ID) } ``` #### Response ```json { "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": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } } ``` ## Delete a DEX Rule `client.ZeroTrust.DEX.Rules.Delete(ctx, ruleID, body) (*bool, error)` **delete** `/accounts/{account_id}/dex/rules/{rule_id}` Delete a DEX Rule. ### Parameters - `ruleID string` API Resource UUID tag. - `body DEXRuleDeleteParams` - `AccountID param.Field[string]` Unique identifier linked to an account. ### Returns - `type DEXRuleDeleteResponseEnvelopeResult bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) rule, err := client.ZeroTrust.DEX.Rules.Delete( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXRuleDeleteParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", rule) } ``` #### Response ```json { "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": true } ``` ## Update a DEX Rule `client.ZeroTrust.DEX.Rules.Update(ctx, ruleID, params) (*DEXRuleUpdateResponse, error)` **patch** `/accounts/{account_id}/dex/rules/{rule_id}` Update a DEX Rule. ### Parameters - `ruleID string` API Resource UUID tag. - `params DEXRuleUpdateParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `Description param.Field[string]` Body param - `Match param.Field[string]` Body param: The wirefilter expression to match. - `Name param.Field[string]` Body param: The name of the Rule. ### Returns - `type DEXRuleUpdateResponse struct{…}` - `ID string` API Resource UUID tag. - `CreatedAt string` - `Match string` - `Name string` - `Description string` - `TargetedTests []DEXRuleUpdateResponseTargetedTest` - `Data SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `Host string` The desired endpoint to test. - `Kind SchemaDataKind` The type of test. - `const SchemaDataKindHTTP SchemaDataKind = "http"` - `const SchemaDataKindTraceroute SchemaDataKind = "traceroute"` - `Method SchemaDataMethod` The HTTP request method type. - `const SchemaDataMethodGet SchemaDataMethod = "GET"` - `Enabled bool` - `Name string` - `TestID string` - `UpdatedAt string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) rule, err := client.ZeroTrust.DEX.Rules.Update( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXRuleUpdateParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", rule.ID) } ``` #### Response ```json { "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": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } } ``` ## Create a DEX Rule `client.ZeroTrust.DEX.Rules.New(ctx, params) (*DEXRuleNewResponse, error)` **post** `/accounts/{account_id}/dex/rules` Create a DEX Rule. ### Parameters - `params DEXRuleNewParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `Match param.Field[string]` Body param: The wirefilter expression to match. - `Name param.Field[string]` Body param: The name of the Rule. - `Description param.Field[string]` Body param ### Returns - `type DEXRuleNewResponse struct{…}` - `ID string` API Resource UUID tag. - `CreatedAt string` - `Match string` - `Name string` - `Description string` - `TargetedTests []DEXRuleNewResponseTargetedTest` - `Data SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `Host string` The desired endpoint to test. - `Kind SchemaDataKind` The type of test. - `const SchemaDataKindHTTP SchemaDataKind = "http"` - `const SchemaDataKindTraceroute SchemaDataKind = "traceroute"` - `Method SchemaDataMethod` The HTTP request method type. - `const SchemaDataMethodGet SchemaDataMethod = "GET"` - `Enabled bool` - `Name string` - `TestID string` - `UpdatedAt string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) rule, err := client.ZeroTrust.DEX.Rules.New(context.TODO(), zero_trust.DEXRuleNewParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), Match: cloudflare.F("match"), Name: cloudflare.F("name"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", rule.ID) } ``` #### Response ```json { "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": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } } ``` ## List DEX Rules `client.ZeroTrust.DEX.Rules.List(ctx, params) (*V4PagePagination[DEXRuleListResponse], error)` **get** `/accounts/{account_id}/dex/rules` List DEX Rules. ### Parameters - `params DEXRuleListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `Page param.Field[float64]` Query param: Page number of paginated results. - `PerPage param.Field[float64]` Query param: Number of results per page. - `Name param.Field[string]` Query param: Filter results by rule name. - `SortBy param.Field[DEXRuleListParamsSortBy]` Query param: Which property to sort results by. - `const DEXRuleListParamsSortByName DEXRuleListParamsSortBy = "name"` - `const DEXRuleListParamsSortByCreatedAt DEXRuleListParamsSortBy = "created_at"` - `const DEXRuleListParamsSortByUpdatedAt DEXRuleListParamsSortBy = "updated_at"` - `SortOrder param.Field[DEXRuleListParamsSortOrder]` Query param: Sort direction for sort_by property. - `const DEXRuleListParamsSortOrderAsc DEXRuleListParamsSortOrder = "ASC"` - `const DEXRuleListParamsSortOrderDesc DEXRuleListParamsSortOrder = "DESC"` ### Returns - `type DEXRuleListResponse struct{…}` - `Rules []DEXRuleListResponseRule` - `ID string` API Resource UUID tag. - `CreatedAt string` - `Match string` - `Name string` - `Description string` - `TargetedTests []DEXRuleListResponseRulesTargetedTest` - `Data SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `Host string` The desired endpoint to test. - `Kind SchemaDataKind` The type of test. - `const SchemaDataKindHTTP SchemaDataKind = "http"` - `const SchemaDataKindTraceroute SchemaDataKind = "traceroute"` - `Method SchemaDataMethod` The HTTP request method type. - `const SchemaDataMethodGet SchemaDataMethod = "GET"` - `Enabled bool` - `Name string` - `TestID string` - `UpdatedAt string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.DEX.Rules.List(context.TODO(), zero_trust.DEXRuleListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(10.000000), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": { "rules": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` # Devices # ISPs ## List device ISPs `client.ZeroTrust.DEX.Devices.ISPs.List(ctx, deviceID, params) (*V4PagePagination[ISPs], error)` **get** `/accounts/{account_id}/dex/devices/{device_id}/isps` List ISP information observed for a specific device during traceroute tests. ### Parameters - `deviceID string` API Resource UUID tag. - `params DEXDeviceISPListParams` - `AccountID param.Field[string]` Path param: Unique identifier linked to an account. - `PerPage param.Field[int64]` Query param: Number of items per page - `Cursor param.Field[string]` Query param: Cursor for cursor-based pagination. Mutually exclusive with page. - `From param.Field[Time]` Query param: Start time for the query in ISO 8601 format. - `Page param.Field[int64]` Query param: Page number of paginated results. Mutually exclusive with cursor. - `SortBy param.Field[DEXDeviceISPListParamsSortBy]` Query param: The field to sort results by. - `const DEXDeviceISPListParamsSortByTimeStart DEXDeviceISPListParamsSortBy = "time_start"` - `SortOrder param.Field[DEXDeviceISPListParamsSortOrder]` Query param: The order to sort results. - `const DEXDeviceISPListParamsSortOrderAsc DEXDeviceISPListParamsSortOrder = "ASC"` - `const DEXDeviceISPListParamsSortOrderDesc DEXDeviceISPListParamsSortOrder = "DESC"` - `To param.Field[Time]` Query param: End time for the query in ISO 8601 format. ### Returns - `type ISPs struct{…}` - `ISPs []ISPsISP` - `TestID string` The test that generated this result. - `TestResultID string` The specific test result. - `TimeStart Time` Timestamp of when the ISP was observed. - `IP ISPsISPsIP` IP address information for the ISP hop. Fields marked as PII-gated (`name`, `address`, `netmask`, and all `location` sub-fields) will be returned as the literal string `"REDACTED"` for callers that do not have the PII permission. `asn`, `aso`, and `version` are always returned regardless of PII access. - `Address string` IP address. Returned as `"REDACTED"` without PII permission. - `ASN int64` Autonomous System Number. - `Aso string` Autonomous System Organization name. - `Location ISPsISPsIPLocation` Geographic location information. All fields are returned as the literal string `"REDACTED"` for callers that do not have the PII permission. - `City string` City name. Returned as `"REDACTED"` without PII permission. - `CountryISO string` Country ISO code. Returned as `"REDACTED"` without PII permission. - `StateISO string` State/province ISO code. Returned as `"REDACTED"` without PII permission. - `Zip string` ZIP/postal code. Returned as `"REDACTED"` without PII permission. - `Name string` Named IP address (reverse DNS hostname when available). Returned as `"REDACTED"` without PII permission. - `Netmask string` Network mask. Returned as `"REDACTED"` without PII permission. - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.DEX.Devices.ISPs.List( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DEXDeviceISPListParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), PerPage: cloudflare.F(int64(10)), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": { "isps": [ { "test_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "test_result_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "time_start": "2024-06-01T12:00:00Z", "ip": { "address": "203.0.113.1", "asn": 13335, "aso": "CLOUDFLARENET", "location": { "city": "San Francisco", "country_iso": "US", "state_iso": "CA", "zip": "94107" }, "name": "isp-gateway.example.com", "netmask": "255.255.255.0", "version": 1 } } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### ISPs - `type ISPs struct{…}` - `ISPs []ISPsISP` - `TestID string` The test that generated this result. - `TestResultID string` The specific test result. - `TimeStart Time` Timestamp of when the ISP was observed. - `IP ISPsISPsIP` IP address information for the ISP hop. Fields marked as PII-gated (`name`, `address`, `netmask`, and all `location` sub-fields) will be returned as the literal string `"REDACTED"` for callers that do not have the PII permission. `asn`, `aso`, and `version` are always returned regardless of PII access. - `Address string` IP address. Returned as `"REDACTED"` without PII permission. - `ASN int64` Autonomous System Number. - `Aso string` Autonomous System Organization name. - `Location ISPsISPsIPLocation` Geographic location information. All fields are returned as the literal string `"REDACTED"` for callers that do not have the PII permission. - `City string` City name. Returned as `"REDACTED"` without PII permission. - `CountryISO string` Country ISO code. Returned as `"REDACTED"` without PII permission. - `StateISO string` State/province ISO code. Returned as `"REDACTED"` without PII permission. - `Zip string` ZIP/postal code. Returned as `"REDACTED"` without PII permission. - `Name string` Named IP address (reverse DNS hostname when available). Returned as `"REDACTED"` without PII permission. - `Netmask string` Network mask. Returned as `"REDACTED"` without PII permission. - `Version int64` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown).