cloudflare

package module
v0.29.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2022 License: BSD-3-Clause Imports: 23 Imported by: 0

README

cloudflare-go

Go Reference Test Go Report Card

Note: This library is under active development as we expand it to cover our (expanding!) API. Consider the public API of this package a little unstable as we work towards a v1.0.

A Go library for interacting with Cloudflare's API v4. This library allows you to:

  • Manage and automate changes to your DNS records within Cloudflare
  • Manage and automate changes to your zones (domains) on Cloudflare, including adding new zones to your account
  • List and modify the status of WAF (Web Application Firewall) rules for your zones
  • Fetch Cloudflare's IP ranges for automating your firewall whitelisting

A command-line client, flarectl, is also available as part of this project.

Features

The current feature list includes:

  • Cache purging
  • Cloudflare IPs
  • Custom hostnames
  • DNS Records
  • Firewall (partial)
  • Keyless SSL
  • Load Balancing
  • Logpush Jobs
  • Organization Administration
  • Origin CA
  • Railgun administration
  • Rate Limiting
  • User Administration (partial)
  • DNS Firewall
  • Web Application Firewall (WAF)
  • Zone Lockdown and User-Agent Block rules
  • Zones
  • Workers KV
  • Notifications
  • Gateway Locations

Pull Requests are welcome, but please open an issue (or comment in an existing issue) to discuss any non-trivial changes before submitting code.

Installation

You need a working Go environment. We officially support only currently supported Go versions according to Go project's release policy.

go get github.com/cloudflare/cloudflare-go

Getting Started

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/cloudflare/cloudflare-go"
)

func main() {
	// Construct a new API object
	api, err := cloudflare.New(os.Getenv("CLOUDFLARE_API_KEY"), os.Getenv("CLOUDFLARE_API_EMAIL"))
	if err != nil {
		log.Fatal(err)
	}

	// Most API calls require a Context
	ctx := context.Background()

	// Fetch user details on the account
	u, err := api.UserDetails(ctx)
	if err != nil {
		log.Fatal(err)
	}
	// Print user details
	fmt.Println(u)

	// Fetch the zone ID
	id, err := api.ZoneIDByName("example.com") // Assuming example.com exists in your Cloudflare account already
	if err != nil {
		log.Fatal(err)
	}

	// Fetch zone details
	zone, err := api.ZoneDetails(ctx, id)
	if err != nil {
		log.Fatal(err)
	}
	// Print zone details
	fmt.Println(zone)
}

Also refer to the API documentation for how to use this package in-depth.

License

BSD licensed. See the LICENSE file for details.

Documentation

Overview

Package cloudflare implements the Cloudflare v4 API.

Example
package main

import (
	"context"
	"fmt"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

const (
	user   = "cloudflare@example.org"
	domain = "example.com"
	apiKey = "deadbeef"
)

func main() {
	api, err := cloudflare.New("deadbeef", "cloudflare@example.org")
	if err != nil {
		fmt.Println(err)
		return
	}

	// Fetch the zone ID for zone example.org
	zoneID, err := api.ZoneIDByName("example.org")
	if err != nil {
		fmt.Println(err)
		return
	}

	// Fetch all DNS records for example.org
	records, err := api.DNSRecords(context.Background(), zoneID, cloudflare.DNSRecord{})
	if err != nil {
		fmt.Println(err)
		return
	}

	for _, r := range records {
		fmt.Printf("%s: %s\n", r.Name, r.Content)
	}
}
Output:

Index

Examples

Constants

View Source
const (
	// AuthKeyEmail specifies that we should authenticate with API key and email address
	AuthKeyEmail = 1 << iota
	// AuthUserService specifies that we should authenticate with a User-Service key
	AuthUserService
	// AuthToken specifies that we should authenticate with an API Token
	AuthToken
)
View Source
const (
	// MagicFirewallRulesetKindRoot specifies a root Ruleset
	MagicFirewallRulesetKindRoot = "root"

	// MagicFirewallRulesetPhaseMagicTransit specifies the Magic Transit Ruleset phase
	MagicFirewallRulesetPhaseMagicTransit = "magic_transit"

	// MagicFirewallRulesetRuleActionSkip specifies a skip (allow) action
	MagicFirewallRulesetRuleActionSkip MagicFirewallRulesetRuleAction = "skip"

	// MagicFirewallRulesetRuleActionBlock specifies a block action
	MagicFirewallRulesetRuleActionBlock MagicFirewallRulesetRuleAction = "block"
)
View Source
const (
	RulesetKindCustom  RulesetKind = "custom"
	RulesetKindManaged RulesetKind = "managed"
	RulesetKindRoot    RulesetKind = "root"
	RulesetKindSchema  RulesetKind = "schema"
	RulesetKindZone    RulesetKind = "zone"

	RulesetPhaseDDoSL4                       RulesetPhase = "ddos_l4"
	RulesetPhaseDDoSL7                       RulesetPhase = "ddos_l7"
	RulesetPhaseHTTPRequestFirewallCustom    RulesetPhase = "http_request_firewall_custom"
	RulesetPhaseHTTPRequestFirewallManaged   RulesetPhase = "http_request_firewall_managed"
	RulesetPhaseHTTPRequestLateTransform     RulesetPhase = "http_request_late_transform"
	RulesetPhaseHTTPRequestMain              RulesetPhase = "http_request_main"
	RulesetPhaseHTTPRequestSanitize          RulesetPhase = "http_request_sanitize"
	RulesetPhaseHTTPRequestTransform         RulesetPhase = "http_request_transform"
	RulesetPhaseHTTPResponseHeadersTransform RulesetPhase = "http_response_headers_transform"
	RulesetPhaseHTTPResponseFirewallManaged  RulesetPhase = "http_response_firewall_managed"
	RulesetPhaseMagicTransit                 RulesetPhase = "magic_transit"
	RulesetPhaseRateLimit                    RulesetPhase = "http_ratelimit"

	RulesetRuleActionBlock                RulesetRuleAction = "block"
	RulesetRuleActionChallenge            RulesetRuleAction = "challenge"
	RulesetRuleActionDDoSDynamic          RulesetRuleAction = "ddos_dynamic"
	RulesetRuleActionExecute              RulesetRuleAction = "execute"
	RulesetRuleActionForceConnectionClose RulesetRuleAction = "force_connection_close"
	RulesetRuleActionJSChallenge          RulesetRuleAction = "js_challenge"
	RulesetRuleActionLog                  RulesetRuleAction = "log"
	RulesetRuleActionRewrite              RulesetRuleAction = "rewrite"
	RulesetRuleActionScore                RulesetRuleAction = "score"
	RulesetRuleActionSkip                 RulesetRuleAction = "skip"

	RulesetActionParameterProductBIC           RulesetActionParameterProduct = "bic"
	RulesetActionParameterProductHOT           RulesetActionParameterProduct = "hot"
	RulesetActionParameterProductRateLimit     RulesetActionParameterProduct = "ratelimit"
	RulesetActionParameterProductSecurityLevel RulesetActionParameterProduct = "securityLevel"
	RulesetActionParameterProductUABlock       RulesetActionParameterProduct = "uablock"
	RulesetActionParameterProductWAF           RulesetActionParameterProduct = "waf"
	RulesetActionParameterProductZoneLockdown  RulesetActionParameterProduct = "zonelockdown"

	RulesetRuleActionParametersHTTPHeaderOperationRemove RulesetRuleActionParametersHTTPHeaderOperation = "remove"
	RulesetRuleActionParametersHTTPHeaderOperationSet    RulesetRuleActionParametersHTTPHeaderOperation = "set"
)
View Source
const (
	// IPListTypeIP specifies a list containing IP addresses
	IPListTypeIP = "ip"
)

Variables

View Source
var ErrOriginPortInvalid = errors.New("invalid origin port")

ErrOriginPortInvalid is a common error for failing to parse a single port or port range

View Source
var PageRuleActions = map[string]string{
	"always_online":               "Always Online",
	"always_use_https":            "Always Use HTTPS",
	"automatic_https_rewrites":    "Automatic HTTPS Rewrites",
	"browser_cache_ttl":           "Browser Cache TTL",
	"browser_check":               "Browser Integrity Check",
	"bypass_cache_on_cookie":      "Bypass Cache on Cookie",
	"cache_by_device_type":        "Cache By Device Type",
	"cache_deception_armor":       "Cache Deception Armor",
	"cache_level":                 "Cache Level",
	"cache_key_fields":            "Custom Cache Key",
	"cache_on_cookie":             "Cache On Cookie",
	"disable_apps":                "Disable Apps",
	"disable_performance":         "Disable Performance",
	"disable_railgun":             "Disable Railgun",
	"disable_security":            "Disable Security",
	"edge_cache_ttl":              "Edge Cache TTL",
	"email_obfuscation":           "Email Obfuscation",
	"explicit_cache_control":      "Origin Cache Control",
	"forwarding_url":              "Forwarding URL",
	"host_header_override":        "Host Header Override",
	"ip_geolocation":              "IP Geolocation Header",
	"minify":                      "Minify",
	"mirage":                      "Mirage",
	"opportunistic_encryption":    "Opportunistic Encryption",
	"origin_error_page_pass_thru": "Origin Error Page Pass-thru",
	"polish":                      "Polish",
	"resolve_override":            "Resolve Override",
	"respect_strong_etag":         "Respect Strong ETags",
	"response_buffering":          "Response Buffering",
	"rocket_loader":               "Rocker Loader",
	"security_level":              "Security Level",
	"server_side_exclude":         "Server Side Excludes",
	"sort_query_string_for_cache": "Query String Sort",
	"ssl":                         "SSL",
	"true_client_ip_header":       "True Client IP Header",
	"waf":                         "Web Application Firewall",
}

PageRuleActions maps API action IDs to human-readable strings.

Functions

func OriginCARootCertificate added in v0.29.3

func OriginCARootCertificate(algorithm string) ([]byte, error)

Gets the Cloudflare Origin CA Root Certificate for a given algorithm in PEM format. Algorithm must be one of ['ecc', 'rsa'].

func RulesetActionParameterProductValues added in v0.29.3

func RulesetActionParameterProductValues() []string

RulesetActionParameterProductValues exposes all the available `RulesetActionParameterProduct` values as a slice of strings.

func RulesetKindValues added in v0.29.3

func RulesetKindValues() []string

RulesetKindValues exposes all the available `RulesetKind` values as a slice of strings.

func RulesetPhaseValues added in v0.29.3

func RulesetPhaseValues() []string

RulesetPhaseValues exposes all the available `RulesetPhase` values as a slice of strings.

func RulesetRuleActionParametersHTTPHeaderOperationValues added in v0.29.3

func RulesetRuleActionParametersHTTPHeaderOperationValues() []string

func RulesetRuleActionValues added in v0.29.3

func RulesetRuleActionValues() []string

RulesetRuleActionValues exposes all the available `RulesetRuleAction` values as a slice of strings.

func TeamsRulesActionValues added in v0.29.3

func TeamsRulesActionValues() []string

Types

type API

type API struct {
	APIKey            string
	APIEmail          string
	APIUserServiceKey string
	APIToken          string
	BaseURL           string
	AccountID         string
	UserAgent         string
	// contains filtered or unexported fields
}

API holds the configuration for the current API client. A client should not be modified concurrently.

func New

func New(key, email string, opts ...Option) (*API, error)

New creates a new Cloudflare v4 API client.

func NewWithAPIToken added in v0.29.3

func NewWithAPIToken(token string, opts ...Option) (*API, error)

NewWithAPIToken creates a new Cloudflare v4 API client using API Tokens

func NewWithUserServiceKey added in v0.29.3

func NewWithUserServiceKey(key string, opts ...Option) (*API, error)

NewWithUserServiceKey creates a new Cloudflare v4 API client using service key authentication.

func (*API) APITokens added in v0.29.3

func (api *API) APITokens(ctx context.Context) ([]APIToken, error)

APITokens returns all available API tokens.

API reference: https://api.cloudflare.com/#user-api-tokens-list-tokens

func (*API) AccessApplication added in v0.29.3

func (api *API) AccessApplication(ctx context.Context, accountID, applicationID string) (AccessApplication, error)

AccessApplication returns a single application based on the application ID.

API reference: https://api.cloudflare.com/#access-applications-access-applications-details

func (*API) AccessApplications added in v0.29.3

func (api *API) AccessApplications(ctx context.Context, accountID string, pageOpts PaginationOptions) ([]AccessApplication, ResultInfo, error)

AccessApplications returns all applications within an account.

API reference: https://api.cloudflare.com/#access-applications-list-access-applications

func (*API) AccessAuditLogs added in v0.29.3

func (api *API) AccessAuditLogs(ctx context.Context, accountID string, opts AccessAuditLogFilterOptions) ([]AccessAuditLogRecord, error)

AccessAuditLogs retrieves all audit logs for the Access service.

API reference: https://api.cloudflare.com/#access-requests-access-requests-audit

Example
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	filterOpts := cloudflare.AccessAuditLogFilterOptions{}
	results, _ := api.AccessAuditLogs(context.Background(), "someaccountid", filterOpts)

	for _, record := range results {
		b, _ := json.Marshal(record)
		fmt.Println(string(b))
	}
}
Output:

func (*API) AccessCACertificate added in v0.29.3

func (api *API) AccessCACertificate(ctx context.Context, accountID, applicationID string) (AccessCACertificate, error)

AccessCACertificate returns a single CA certificate associated with an Access Application.

API reference: https://api.cloudflare.com/#access-short-lived-certificates-short-lived-certificate-details

func (*API) AccessCACertificates added in v0.29.3

func (api *API) AccessCACertificates(ctx context.Context, accountID string) ([]AccessCACertificate, error)

AccessCACertificates returns all CA certificates within Access.

API reference: https://api.cloudflare.com/#access-short-lived-certificates-list-short-lived-certificates

func (*API) AccessGroup added in v0.29.3

func (api *API) AccessGroup(ctx context.Context, accountID, groupID string) (AccessGroup, error)

AccessGroup returns a single group based on the group ID.

API reference: https://api.cloudflare.com/#access-groups-access-group-details

func (*API) AccessGroups added in v0.29.3

func (api *API) AccessGroups(ctx context.Context, accountID string, pageOpts PaginationOptions) ([]AccessGroup, ResultInfo, error)

AccessGroups returns all access groups for an access application.

API reference: https://api.cloudflare.com/#access-groups-list-access-groups

func (*API) AccessIdentityProviderDetails added in v0.29.3

func (api *API) AccessIdentityProviderDetails(ctx context.Context, accountID, identityProviderID string) (AccessIdentityProvider, error)

AccessIdentityProviderDetails returns a single Access Identity Provider for an account.

API reference: https://api.cloudflare.com/#access-identity-providers-access-identity-providers-details

func (*API) AccessIdentityProviders added in v0.29.3

func (api *API) AccessIdentityProviders(ctx context.Context, accountID string) ([]AccessIdentityProvider, error)

AccessIdentityProviders returns all Access Identity Providers for an account.

API reference: https://api.cloudflare.com/#access-identity-providers-list-access-identity-providers

func (*API) AccessKeysConfig added in v0.29.3

func (api *API) AccessKeysConfig(ctx context.Context, accountID string) (AccessKeysConfig, error)

AccessKeysConfig returns the Access Keys Configuration for an account.

API reference: https://api.cloudflare.com/#access-keys-configuration-get-access-keys-configuration

func (*API) AccessMutualTLSCertificate added in v0.29.3

func (api *API) AccessMutualTLSCertificate(ctx context.Context, accountID, certificateID string) (AccessMutualTLSCertificate, error)

AccessMutualTLSCertificate returns a single account level Access Mutual TLS certificate.

API reference: https://api.cloudflare.com/#access-mutual-tls-authentication-access-certificate-details

func (*API) AccessMutualTLSCertificates added in v0.29.3

func (api *API) AccessMutualTLSCertificates(ctx context.Context, accountID string) ([]AccessMutualTLSCertificate, error)

AccessMutualTLSCertificates returns all Access TLS certificates for the account level.

API reference: https://api.cloudflare.com/#access-mutual-tls-authentication-properties

func (*API) AccessOrganization added in v0.29.3

func (api *API) AccessOrganization(ctx context.Context, accountID string) (AccessOrganization, ResultInfo, error)

AccessOrganization returns the Access organisation details.

API reference: https://api.cloudflare.com/#access-organizations-access-organization-details

func (*API) AccessPolicies added in v0.29.3

func (api *API) AccessPolicies(ctx context.Context, accountID, applicationID string, pageOpts PaginationOptions) ([]AccessPolicy, ResultInfo, error)

AccessPolicies returns all access policies for an access application.

API reference: https://api.cloudflare.com/#access-policy-list-access-policies

func (*API) AccessPolicy added in v0.29.3

func (api *API) AccessPolicy(ctx context.Context, accountID, applicationID, policyID string) (AccessPolicy, error)

AccessPolicy returns a single policy based on the policy ID.

API reference: https://api.cloudflare.com/#access-policy-access-policy-details

func (*API) AccessServiceTokens added in v0.29.3

func (api *API) AccessServiceTokens(ctx context.Context, accountID string) ([]AccessServiceToken, ResultInfo, error)

AccessServiceTokens returns all Access Service Tokens for an account.

API reference: https://api.cloudflare.com/#access-service-tokens-list-access-service-tokens

func (*API) Account added in v0.29.3

func (api *API) Account(ctx context.Context, accountID string) (Account, ResultInfo, error)

Account returns a single account based on the ID.

API reference: https://api.cloudflare.com/#accounts-account-details

func (*API) AccountAccessRule added in v0.29.3

func (api *API) AccountAccessRule(ctx context.Context, accountID string, accessRuleID string) (*AccessRuleResponse, error)

AccountAccessRule returns the details of an account's access rule.

API reference: https://api.cloudflare.com/#account-level-firewall-access-rule-access-rule-details

func (*API) AccountMember added in v0.29.3

func (api *API) AccountMember(ctx context.Context, accountID string, memberID string) (AccountMember, error)

AccountMember returns details of a single account member.

API reference: https://api.cloudflare.com/#account-members-member-details

func (*API) AccountMembers added in v0.29.3

func (api *API) AccountMembers(ctx context.Context, accountID string, pageOpts PaginationOptions) ([]AccountMember, ResultInfo, error)

AccountMembers returns all members of an account.

API reference: https://api.cloudflare.com/#accounts-list-accounts

func (*API) AccountRole added in v0.29.3

func (api *API) AccountRole(ctx context.Context, accountID string, roleID string) (AccountRole, error)

AccountRole returns the details of a single account role.

API reference: https://api.cloudflare.com/#account-roles-role-details

func (*API) AccountRoles added in v0.29.3

func (api *API) AccountRoles(ctx context.Context, accountID string) ([]AccountRole, error)

AccountRoles returns all roles of an account.

API reference: https://api.cloudflare.com/#account-roles-list-roles

func (*API) Accounts added in v0.29.3

func (api *API) Accounts(ctx context.Context, pageOpts PaginationOptions) ([]Account, ResultInfo, error)

Accounts returns all accounts the logged in user has access to.

API reference: https://api.cloudflare.com/#accounts-list-accounts

func (*API) ArgoSmartRouting added in v0.29.3

func (api *API) ArgoSmartRouting(ctx context.Context, zoneID string) (ArgoFeatureSetting, error)

ArgoSmartRouting returns the current settings for smart routing.

API reference: https://api.cloudflare.com/#argo-smart-routing-get-argo-smart-routing-setting

Example
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	smartRoutingSettings, err := api.ArgoSmartRouting(context.Background(), "01a7362d577a6c3019a474fd6f485823")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("smart routing is %s", smartRoutingSettings.Value)
}
Output:

func (*API) ArgoTieredCaching added in v0.29.3

func (api *API) ArgoTieredCaching(ctx context.Context, zoneID string) (ArgoFeatureSetting, error)

ArgoTieredCaching returns the current settings for tiered caching.

API reference: TBA

Example
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	tieredCachingSettings, err := api.ArgoTieredCaching(context.Background(), "01a7362d577a6c3019a474fd6f485823")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("tiered caching is %s", tieredCachingSettings.Value)
}
Output:

func (*API) ArgoTunnel added in v0.29.3

func (api *API) ArgoTunnel(ctx context.Context, accountID, tunnelUUID string) (ArgoTunnel, error)

ArgoTunnel returns a single Argo tunnel.

API reference: https://api.cloudflare.com/#argo-tunnel-get-argo-tunnel

func (*API) ArgoTunnels added in v0.29.3

func (api *API) ArgoTunnels(ctx context.Context, accountID string) ([]ArgoTunnel, error)

ArgoTunnels lists all tunnels.

API reference: https://api.cloudflare.com/#argo-tunnel-list-argo-tunnels

func (*API) AvailableZonePlans

func (api *API) AvailableZonePlans(ctx context.Context, zoneID string) ([]ZonePlan, error)

AvailableZonePlans returns information about all plans available to the specified zone.

API reference: https://api.cloudflare.com/#zone-rate-plan-list-available-plans

func (*API) AvailableZoneRatePlans added in v0.7.4

func (api *API) AvailableZoneRatePlans(ctx context.Context, zoneID string) ([]ZoneRatePlan, error)

AvailableZoneRatePlans returns information about all plans available to the specified zone.

API reference: https://api.cloudflare.com/#zone-plan-available-plans

func (*API) CancelRegistrarDomainTransfer added in v0.29.3

func (api *API) CancelRegistrarDomainTransfer(ctx context.Context, accountID, domainName string) ([]RegistrarDomain, error)

CancelRegistrarDomainTransfer cancels a pending domain transfer.

API reference: https://api.cloudflare.com/#registrar-domains-cancel-transfer

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

domains, err := api.CancelRegistrarDomainTransfer(context.Background(), "01a7362d577a6c3019a474fd6f485823", "cloudflare.com")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", domains)
Output:

func (*API) CertificatePack added in v0.29.3

func (api *API) CertificatePack(ctx context.Context, zoneID, certificatePackID string) (CertificatePack, error)

CertificatePack returns a single TLS certificate pack on a zone.

API Reference: https://api.cloudflare.com/#certificate-packs-get-certificate-pack

func (*API) ChangePageRule

func (api *API) ChangePageRule(ctx context.Context, zoneID, ruleID string, rule PageRule) error

ChangePageRule lets you change individual settings for a Page Rule. This is in contrast to UpdatePageRule which replaces the entire Page Rule.

API reference: https://api.cloudflare.com/#page-rules-for-a-zone-change-a-page-rule

func (*API) ChangeWaitingRoom added in v0.29.3

func (api *API) ChangeWaitingRoom(ctx context.Context, zoneID, waitingRoomID string, waitingRoom WaitingRoom) (WaitingRoom, error)

ChangeWaitingRoom lets you change individual settings for a Waiting room. This is in contrast to UpdateWaitingRoom which replaces the entire Waiting room.

API reference: https://api.cloudflare.com/#waiting-room-update-waiting-room

func (*API) CheckAccountLogpushDestinationExists added in v0.29.3

func (api *API) CheckAccountLogpushDestinationExists(ctx context.Context, accountID, destinationConf string) (bool, error)

CheckAccountLogpushDestinationExists returns account-level destination exists check result.

API reference: https://api.cloudflare.com/#logpush-jobs-check-destination-exists

func (*API) CheckLogpushDestinationExists deprecated added in v0.29.3

func (api *API) CheckLogpushDestinationExists(ctx context.Context, zoneID, destinationConf string) (bool, error)

CheckLogpushDestinationExists returns zone-level destination exists check result.

API reference: https://api.cloudflare.com/#logpush-jobs-check-destination-exists

Deprecated: Use `CheckZoneLogpushDestinationExists` or `CheckAccountLogpushDestinationExists` depending on the desired resource to target.

func (*API) CheckZoneLogpushDestinationExists added in v0.29.3

func (api *API) CheckZoneLogpushDestinationExists(ctx context.Context, zoneID, destinationConf string) (bool, error)

CheckZoneLogpushDestinationExists returns zone-level destination exists check result.

API reference: https://api.cloudflare.com/#logpush-jobs-check-destination-exists

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

exists, err := api.CheckZoneLogpushDestinationExists(context.Background(), zoneID, "destination_conf")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", exists)
Output:

func (*API) CleanupArgoTunnelConnections added in v0.29.3

func (api *API) CleanupArgoTunnelConnections(ctx context.Context, accountID, tunnelUUID string) error

CleanupArgoTunnelConnections deletes any inactive connections on a tunnel.

API reference: https://api.cloudflare.com/#argo-tunnel-clean-up-argo-tunnel-connections

func (*API) ConnectZoneRailgun

func (api *API) ConnectZoneRailgun(ctx context.Context, zoneID, railgunID string) (ZoneRailgun, error)

ConnectZoneRailgun connects a Railgun for a given zone.

API reference: https://api.cloudflare.com/#railguns-for-a-zone-connect-or-disconnect-a-railgun

func (*API) CreateAPIToken added in v0.29.3

func (api *API) CreateAPIToken(ctx context.Context, token APIToken) (APIToken, error)

CreateAPIToken creates a new token. Returns the API token that has been generated.

The token value itself is only shown once (post create) and will present as `Value` from this method. If you fail to capture it at this point, you will need to roll the token in order to get a new value.

API reference: https://api.cloudflare.com/#user-api-tokens-create-token

func (*API) CreateAccessApplication added in v0.29.3

func (api *API) CreateAccessApplication(ctx context.Context, accountID string, accessApplication AccessApplication) (AccessApplication, error)

CreateAccessApplication creates a new access application.

API reference: https://api.cloudflare.com/#access-applications-create-access-application

func (*API) CreateAccessCACertificate added in v0.29.3

func (api *API) CreateAccessCACertificate(ctx context.Context, accountID, applicationID string) (AccessCACertificate, error)

CreateAccessCACertificate creates a new CA certificate for an Access Application.

API reference: https://api.cloudflare.com/#access-short-lived-certificates-create-short-lived-certificate

func (*API) CreateAccessGroup added in v0.29.3

func (api *API) CreateAccessGroup(ctx context.Context, accountID string, accessGroup AccessGroup) (AccessGroup, error)

CreateAccessGroup creates a new access group.

API reference: https://api.cloudflare.com/#access-groups-create-access-group

func (*API) CreateAccessIdentityProvider added in v0.29.3

func (api *API) CreateAccessIdentityProvider(ctx context.Context, accountID string, identityProviderConfiguration AccessIdentityProvider) (AccessIdentityProvider, error)

CreateAccessIdentityProvider creates a new Access Identity Provider.

API reference: https://api.cloudflare.com/#access-identity-providers-create-access-identity-provider

func (*API) CreateAccessMutualTLSCertificate added in v0.29.3

func (api *API) CreateAccessMutualTLSCertificate(ctx context.Context, accountID string, certificate AccessMutualTLSCertificate) (AccessMutualTLSCertificate, error)

CreateAccessMutualTLSCertificate creates an account level Access TLS Mutual certificate.

API reference: https://api.cloudflare.com/#access-mutual-tls-authentication-create-access-certificate

func (*API) CreateAccessOrganization added in v0.29.3

func (api *API) CreateAccessOrganization(ctx context.Context, accountID string, accessOrganization AccessOrganization) (AccessOrganization, error)

CreateAccessOrganization creates the Access organisation details.

API reference: https://api.cloudflare.com/#access-organizations-create-access-organization

func (*API) CreateAccessPolicy added in v0.29.3

func (api *API) CreateAccessPolicy(ctx context.Context, accountID, applicationID string, accessPolicy AccessPolicy) (AccessPolicy, error)

CreateAccessPolicy creates a new access policy.

API reference: https://api.cloudflare.com/#access-policy-create-access-policy

func (*API) CreateAccessServiceToken added in v0.29.3

func (api *API) CreateAccessServiceToken(ctx context.Context, accountID, name string) (AccessServiceTokenCreateResponse, error)

CreateAccessServiceToken creates a new Access Service Token for an account.

API reference: https://api.cloudflare.com/#access-service-tokens-create-access-service-token

func (*API) CreateAccount added in v0.29.3

func (api *API) CreateAccount(ctx context.Context, account Account) (Account, error)

CreateAccount creates a new account. Note: This requires the Tenant entitlement.

API reference: https://developers.cloudflare.com/tenant/tutorial/provisioning-resources#creating-an-account

func (*API) CreateAccountAccessRule added in v0.29.3

func (api *API) CreateAccountAccessRule(ctx context.Context, accountID string, accessRule AccessRule) (*AccessRuleResponse, error)

CreateAccountAccessRule creates a firewall access rule for the given account identifier.

API reference: https://api.cloudflare.com/#account-level-firewall-access-rule-create-access-rule

func (*API) CreateAccountLogpushJob added in v0.29.3

func (api *API) CreateAccountLogpushJob(ctx context.Context, accountID string, job LogpushJob) (*LogpushJob, error)

CreateAccountLogpushJob creates a new account-level Logpush Job.

API reference: https://api.cloudflare.com/#logpush-jobs-create-logpush-job

func (*API) CreateAccountMember added in v0.29.3

func (api *API) CreateAccountMember(ctx context.Context, accountID string, emailAddress string, roles []string) (AccountMember, error)

CreateAccountMember invites a new member to join an account. The member will be placed into "pending" status and receive an email confirmation.

API reference: https://api.cloudflare.com/#account-members-add-member

func (*API) CreateAccountMemberWithStatus added in v0.29.3

func (api *API) CreateAccountMemberWithStatus(ctx context.Context, accountID string, emailAddress string, roles []string, status string) (AccountMember, error)

CreateAccountMemberWithStatus invites a new member to join an account, allowing setting the status.

Refer to the API reference for valid statuses.

API reference: https://api.cloudflare.com/#account-members-add-member

func (*API) CreateAccountRuleset added in v0.29.3

func (api *API) CreateAccountRuleset(ctx context.Context, accountID string, ruleset Ruleset) (Ruleset, error)

CreateAccountRuleset creates a new ruleset for an account.

API reference: https://api.cloudflare.com/#account-rulesets-create-account-ruleset

func (*API) CreateAdvancedCertificatePack added in v0.29.3

func (api *API) CreateAdvancedCertificatePack(ctx context.Context, zoneID string, cert CertificatePackAdvancedCertificate) (CertificatePackAdvancedCertificate, error)

CreateAdvancedCertificatePack creates a new certificate pack associated with a zone.

API Reference: https://api.cloudflare.com/#certificate-packs-order-certificate-pack

func (*API) CreateArgoTunnel added in v0.29.3

func (api *API) CreateArgoTunnel(ctx context.Context, accountID, name, secret string) (ArgoTunnel, error)

CreateArgoTunnel creates a new tunnel for the account.

API reference: https://api.cloudflare.com/#argo-tunnel-create-argo-tunnel

func (*API) CreateCertificatePack added in v0.29.3

func (api *API) CreateCertificatePack(ctx context.Context, zoneID string, cert CertificatePackRequest) (CertificatePack, error)

CreateCertificatePack creates a new certificate pack associated with a zone.

API Reference: https://api.cloudflare.com/#certificate-packs-order-certificate-pack

func (*API) CreateCustomHostname added in v0.7.4

func (api *API) CreateCustomHostname(ctx context.Context, zoneID string, ch CustomHostname) (*CustomHostnameResponse, error)

CreateCustomHostname creates a new custom hostname and requests that an SSL certificate be issued for it.

API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-create-custom-hostname

func (*API) CreateDNSFirewallCluster added in v0.29.3

func (api *API) CreateDNSFirewallCluster(ctx context.Context, v DNSFirewallCluster) (*DNSFirewallCluster, error)

CreateDNSFirewallCluster creates a new DNS Firewall cluster.

API reference: https://api.cloudflare.com/#dns-firewall-create-dns-firewall-cluster

func (*API) CreateDNSRecord

func (api *API) CreateDNSRecord(ctx context.Context, zoneID string, rr DNSRecord) (*DNSRecordResponse, error)

CreateDNSRecord creates a DNS record for the zone identifier.

API reference: https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record

func (*API) CreateDevicePostureIntegration added in v0.29.3

func (api *API) CreateDevicePostureIntegration(ctx context.Context, accountID string, integration DevicePostureIntegration) (DevicePostureIntegration, error)

CreateDevicePostureIntegration creates a device posture integration within an account.

API reference: https://api.cloudflare.com/#device-posture-integrations-create-device-posture-integration

func (*API) CreateDevicePostureRule added in v0.29.3

func (api *API) CreateDevicePostureRule(ctx context.Context, accountID string, rule DevicePostureRule) (DevicePostureRule, error)

CreateDevicePostureRule creates a new device posture rule.

API reference: https://api.cloudflare.com/#device-posture-rules-create-device-posture-rule

func (*API) CreateFilters added in v0.29.3

func (api *API) CreateFilters(ctx context.Context, zoneID string, filters []Filter) ([]Filter, error)

CreateFilters creates new filters.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/post/

func (*API) CreateFirewallRules added in v0.29.3

func (api *API) CreateFirewallRules(ctx context.Context, zoneID string, firewallRules []FirewallRule) ([]FirewallRule, error)

CreateFirewallRules creates new firewall rules.

API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/post/

func (*API) CreateHealthcheck added in v0.29.3

func (api *API) CreateHealthcheck(ctx context.Context, zoneID string, healthcheck Healthcheck) (Healthcheck, error)

CreateHealthcheck creates a new healthcheck in a zone.

API reference: https://api.cloudflare.com/#health-checks-create-health-check

func (*API) CreateHealthcheckPreview added in v0.29.3

func (api *API) CreateHealthcheckPreview(ctx context.Context, zoneID string, healthcheck Healthcheck) (Healthcheck, error)

CreateHealthcheckPreview creates a new preview of a healthcheck in a zone.

API reference: https://api.cloudflare.com/#health-checks-create-preview-health-check

func (*API) CreateIPList added in v0.29.3

func (api *API) CreateIPList(ctx context.Context, name string, description string, kind string) (IPList,
	error)

CreateIPList creates a new IP List

API reference: https://api.cloudflare.com/#rules-lists-create-list

func (*API) CreateIPListItem added in v0.29.3

func (api *API) CreateIPListItem(ctx context.Context, id, ip, comment string) ([]IPListItem, error)

CreateIPListItem creates a new IP List Item synchronously and returns the current set of IP List Items

func (*API) CreateIPListItemAsync added in v0.29.3

func (api *API) CreateIPListItemAsync(ctx context.Context, id, ip, comment string) (IPListItemCreateResponse, error)

CreateIPListItemAsync creates a new IP List Item asynchronously. Users have to poll the operation status by using the operation_id returned by this function.

API reference: https://api.cloudflare.com/#rules-lists-create-list-items

func (*API) CreateIPListItems added in v0.29.3

func (api *API) CreateIPListItems(ctx context.Context, id string, items []IPListItemCreateRequest) (
	[]IPListItem, error)

CreateIPListItems bulk creates many IP List Items synchronously and returns the current set of IP List Items

func (*API) CreateIPListItemsAsync added in v0.29.3

func (api *API) CreateIPListItemsAsync(ctx context.Context, id string, items []IPListItemCreateRequest) (
	IPListItemCreateResponse, error)

CreateIPListItemsAsync bulk creates many IP List Items asynchronously. Users have to poll the operation status by using the operation_id returned by this function.

API reference: https://api.cloudflare.com/#rules-lists-create-list-items

func (*API) CreateKeylessSSL added in v0.29.3

func (api *API) CreateKeylessSSL(ctx context.Context, zoneID string, keylessSSL KeylessSSLCreateRequest) (KeylessSSL, error)

CreateKeylessSSL creates a new Keyless SSL configuration for the zone.

API reference: https://api.cloudflare.com/#keyless-ssl-for-a-zone-create-keyless-ssl-configuration

func (*API) CreateLoadBalancer added in v0.8.0

func (api *API) CreateLoadBalancer(ctx context.Context, zoneID string, lb LoadBalancer) (LoadBalancer, error)

CreateLoadBalancer creates a new load balancer.

API reference: https://api.cloudflare.com/#load-balancers-create-load-balancer

func (*API) CreateLoadBalancerMonitor added in v0.8.0

func (api *API) CreateLoadBalancerMonitor(ctx context.Context, monitor LoadBalancerMonitor) (LoadBalancerMonitor, error)

CreateLoadBalancerMonitor creates a new load balancer monitor.

API reference: https://api.cloudflare.com/#load-balancer-monitors-create-monitor

func (*API) CreateLoadBalancerPool added in v0.8.0

func (api *API) CreateLoadBalancerPool(ctx context.Context, pool LoadBalancerPool) (LoadBalancerPool, error)

CreateLoadBalancerPool creates a new load balancer pool.

API reference: https://api.cloudflare.com/#load-balancer-pools-create-pool

func (*API) CreateLogpushJob deprecated added in v0.29.3

func (api *API) CreateLogpushJob(ctx context.Context, zoneID string, job LogpushJob) (*LogpushJob, error)

CreateLogpushJob creates a new zone-level Logpush Job.

API reference: https://api.cloudflare.com/#logpush-jobs-create-logpush-job

Deprecated: Use `CreateZoneLogpushJob` or `CreateAccountLogpushJob` depending on the desired resource to target.

func (*API) CreateMagicFirewallRuleset added in v0.29.3

func (api *API) CreateMagicFirewallRuleset(ctx context.Context, name string, description string, rules []MagicFirewallRulesetRule) (MagicFirewallRuleset, error)

CreateMagicFirewallRuleset creates a Magic Firewall ruleset

API reference: https://api.cloudflare.com/#rulesets-list-rulesets

func (*API) CreateMagicTransitStaticRoute added in v0.29.3

func (api *API) CreateMagicTransitStaticRoute(ctx context.Context, route MagicTransitStaticRoute) ([]MagicTransitStaticRoute, error)

CreateMagicTransitStaticRoute creates a new static route

API reference: https://api.cloudflare.com/#magic-transit-static-routes-create-routes

func (*API) CreateNotificationPolicy added in v0.29.3

func (api *API) CreateNotificationPolicy(ctx context.Context, accountID string, policy NotificationPolicy) (SaveResponse, error)

CreateNotificationPolicy creates a notification policy for an account.

API Reference: https://api.cloudflare.com/#notification-policies-create-notification-policy

func (*API) CreateNotificationWebhooks added in v0.29.3

func (api *API) CreateNotificationWebhooks(ctx context.Context, accountID string, webhooks *NotificationUpsertWebhooks) (SaveResponse, error)

CreateNotificationWebhooks will help connect a webhooks destination. A test message will be sent to the webhooks endpoint during creation. If added successfully, the webhooks can be setup as a destination mechanism while creating policies.

Notifications will be posted to this URL.

API Reference: https://api.cloudflare.com/#notification-webhooks-create-webhook

func (*API) CreateOriginCertificate added in v0.7.4

func (api *API) CreateOriginCertificate(ctx context.Context, certificate OriginCACertificate) (*OriginCACertificate, error)

CreateOriginCertificate creates a Cloudflare-signed certificate.

This function requires api.APIUserServiceKey be set to your Certificates API key.

API reference: https://api.cloudflare.com/#cloudflare-ca-create-certificate

func (*API) CreatePageRule

func (api *API) CreatePageRule(ctx context.Context, zoneID string, rule PageRule) (*PageRule, error)

CreatePageRule creates a new Page Rule for a zone.

API reference: https://api.cloudflare.com/#page-rules-for-a-zone-create-a-page-rule

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

pageRule, err := api.CreatePageRule(context.Background(), zoneID, exampleNewPageRule)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", pageRule)
Output:

func (*API) CreatePagesProject added in v0.29.3

func (api *API) CreatePagesProject(ctx context.Context, accountID string, pagesProject PagesProject) (PagesProject, error)

CreatePagesProject creates a new Pages project in an account.

API reference: https://api.cloudflare.com/#pages-project-create-project

func (*API) CreateRailgun

func (api *API) CreateRailgun(ctx context.Context, name string) (Railgun, error)

CreateRailgun creates a new Railgun.

API reference: https://api.cloudflare.com/#railgun-create-railgun

func (*API) CreateRateLimit added in v0.8.5

func (api *API) CreateRateLimit(ctx context.Context, zoneID string, limit RateLimit) (RateLimit, error)

CreateRateLimit creates a new rate limit for a zone.

API reference: https://api.cloudflare.com/#rate-limits-for-a-zone-create-a-ratelimit

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

rateLimit, err := api.CreateRateLimit(context.Background(), zoneID, exampleNewRateLimit)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", rateLimit)
Output:

func (*API) CreateSSL

func (api *API) CreateSSL(ctx context.Context, zoneID string, options ZoneCustomSSLOptions) (ZoneCustomSSL, error)

CreateSSL allows you to add a custom SSL certificate to the given zone.

API reference: https://api.cloudflare.com/#custom-ssl-for-a-zone-create-ssl-configuration

func (*API) CreateSecondaryDNSPrimary added in v0.29.3

func (api *API) CreateSecondaryDNSPrimary(ctx context.Context, accountID string, primary SecondaryDNSPrimary) (SecondaryDNSPrimary, error)

CreateSecondaryDNSPrimary creates a secondary DNS primary.

API reference: https://api.cloudflare.com/#secondary-dns-primary--create-primary

func (*API) CreateSecondaryDNSTSIG added in v0.29.3

func (api *API) CreateSecondaryDNSTSIG(ctx context.Context, accountID string, tsig SecondaryDNSTSIG) (SecondaryDNSTSIG, error)

CreateSecondaryDNSTSIG creates a secondary DNS TSIG at the account level.

API reference: https://api.cloudflare.com/#secondary-dns-tsig--create-tsig

func (*API) CreateSecondaryDNSZone added in v0.29.3

func (api *API) CreateSecondaryDNSZone(ctx context.Context, zoneID string, zone SecondaryDNSZone) (SecondaryDNSZone, error)

CreateSecondaryDNSZone creates a secondary DNS zone.

API reference: https://api.cloudflare.com/#secondary-dns-create-secondary-zone-configuration

func (*API) CreateSpectrumApplication added in v0.29.3

func (api *API) CreateSpectrumApplication(ctx context.Context, zoneID string, appDetails SpectrumApplication) (SpectrumApplication, error)

CreateSpectrumApplication creates a new Spectrum application.

API reference: https://developers.cloudflare.com/spectrum/api-reference/#create-a-spectrum-application

func (*API) CreateTeamsList added in v0.29.3

func (api *API) CreateTeamsList(ctx context.Context, accountID string, teamsList TeamsList) (TeamsList, error)

CreateTeamsList creates a new teams list.

API reference: https://api.cloudflare.com/#teams-lists-create-teams-list

func (*API) CreateTeamsLocation added in v0.29.3

func (api *API) CreateTeamsLocation(ctx context.Context, accountID string, teamsLocation TeamsLocation) (TeamsLocation, error)

CreateTeamsLocation creates a new teams location.

API reference: https://api.cloudflare.com/#teams-locations-create-teams-location

func (*API) CreateUserAccessRule added in v0.8.1

func (api *API) CreateUserAccessRule(ctx context.Context, accessRule AccessRule) (*AccessRuleResponse, error)

CreateUserAccessRule creates a firewall access rule for the logged-in user.

API reference: https://api.cloudflare.com/#user-level-firewall-access-rule-create-access-rule

func (*API) CreateUserAgentRule added in v0.8.0

func (api *API) CreateUserAgentRule(ctx context.Context, zoneID string, ld UserAgentRule) (*UserAgentRuleResponse, error)

CreateUserAgentRule creates a User-Agent Block rule for the given zone ID.

API reference: https://api.cloudflare.com/#user-agent-blocking-rules-create-a-useragent-rule

func (*API) CreateVirtualDNS deprecated

func (api *API) CreateVirtualDNS(ctx context.Context, v *VirtualDNS) (*VirtualDNS, error)

CreateVirtualDNS creates a new Virtual DNS cluster.

Deprecated: Use CreateDNSFirewallCluster instead.

func (*API) CreateWAFOverride added in v0.29.3

func (api *API) CreateWAFOverride(ctx context.Context, zoneID string, override WAFOverride) (WAFOverride, error)

CreateWAFOverride creates a new WAF override.

API reference: https://api.cloudflare.com/#waf-overrides-create-a-uri-controlled-waf-configuration

func (*API) CreateWaitingRoom added in v0.29.3

func (api *API) CreateWaitingRoom(ctx context.Context, zoneID string, waitingRoom WaitingRoom) (*WaitingRoom, error)

CreateWaitingRoom creates a new Waiting Room for a zone.

API reference: https://api.cloudflare.com/#waiting-room-create-waiting-room

func (*API) CreateWorkerRoute added in v0.29.3

func (api *API) CreateWorkerRoute(ctx context.Context, zoneID string, route WorkerRoute) (WorkerRouteResponse, error)

CreateWorkerRoute creates worker route for a zone

API reference: https://api.cloudflare.com/#worker-filters-create-filter, https://api.cloudflare.com/#worker-routes-create-route

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}
route := cloudflare.WorkerRoute{Pattern: "app1.example.com/*", Enabled: true}
res, err := api.CreateWorkerRoute(context.Background(), zoneID, route)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res)
Output:

func (*API) CreateWorkersKVNamespace added in v0.29.3

func (api *API) CreateWorkersKVNamespace(ctx context.Context, req *WorkersKVNamespaceRequest) (WorkersKVNamespaceResponse, error)

CreateWorkersKVNamespace creates a namespace under the given title. A 400 is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.

API reference: https://api.cloudflare.com/#workers-kv-namespace-create-a-namespace

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

req := &cloudflare.WorkersKVNamespaceRequest{Title: "test_namespace2"}
response, err := api.CreateWorkersKVNamespace(context.Background(), req)
if err != nil {
	log.Fatal(err)
}

fmt.Println(response)
Output:

func (*API) CreateZone

func (api *API) CreateZone(ctx context.Context, name string, jumpstart bool, account Account, zoneType string) (Zone, error)

CreateZone creates a zone on an account.

Setting jumpstart to true will attempt to automatically scan for existing DNS records. Setting this to false will create the zone with no DNS records.

If account is non-empty, it must have at least the ID field populated. This will add the new zone to the specified multi-user account.

API reference: https://api.cloudflare.com/#zone-create-a-zone

func (*API) CreateZoneAccessMutualTLSCertificate added in v0.29.3

func (api *API) CreateZoneAccessMutualTLSCertificate(ctx context.Context, zoneID string, certificate AccessMutualTLSCertificate) (AccessMutualTLSCertificate, error)

CreateZoneAccessMutualTLSCertificate creates a zone level Access TLS Mutual certificate.

API reference: https://api.cloudflare.com/#zone-level-access-mutual-tls-authentication-create-access-certificate

func (*API) CreateZoneAccessRule added in v0.8.1

func (api *API) CreateZoneAccessRule(ctx context.Context, zoneID string, accessRule AccessRule) (*AccessRuleResponse, error)

CreateZoneAccessRule creates a firewall access rule for the given zone identifier.

API reference: https://api.cloudflare.com/#firewall-access-rule-for-a-zone-create-access-rule

func (*API) CreateZoneLevelAccessApplication added in v0.29.3

func (api *API) CreateZoneLevelAccessApplication(ctx context.Context, zoneID string, accessApplication AccessApplication) (AccessApplication, error)

CreateZoneLevelAccessApplication creates a new zone level access application.

API reference: https://api.cloudflare.com/#zone-level-access-applications-create-access-application

func (*API) CreateZoneLevelAccessCACertificate added in v0.29.3

func (api *API) CreateZoneLevelAccessCACertificate(ctx context.Context, zoneID string, applicationID string) (AccessCACertificate, error)

CreateZoneLevelAccessCACertificate creates a new zone level CA certificate for an Access Application.

API reference: https://api.cloudflare.com/#zone-level-access-short-lived-certificates-create-short-lived-certificate

func (*API) CreateZoneLevelAccessGroup added in v0.29.3

func (api *API) CreateZoneLevelAccessGroup(ctx context.Context, zoneID string, accessGroup AccessGroup) (AccessGroup, error)

CreateZoneLevelAccessGroup creates a new zone level access group.

API reference: https://api.cloudflare.com/#zone-level-access-groups-create-access-group

func (*API) CreateZoneLevelAccessIdentityProvider added in v0.29.3

func (api *API) CreateZoneLevelAccessIdentityProvider(ctx context.Context, zoneID string, identityProviderConfiguration AccessIdentityProvider) (AccessIdentityProvider, error)

CreateZoneLevelAccessIdentityProvider creates a new zone level Access Identity Provider.

API reference: https://api.cloudflare.com/#zone-level-access-identity-providers-create-access-identity-provider

func (*API) CreateZoneLevelAccessOrganization added in v0.29.3

func (api *API) CreateZoneLevelAccessOrganization(ctx context.Context, zoneID string, accessOrganization AccessOrganization) (AccessOrganization, error)

CreateZoneLevelAccessOrganization creates the zone level Access organisation details.

API reference: https://api.cloudflare.com/#zone-level-access-organizations-create-access-organization

func (*API) CreateZoneLevelAccessPolicy added in v0.29.3

func (api *API) CreateZoneLevelAccessPolicy(ctx context.Context, zoneID, applicationID string, accessPolicy AccessPolicy) (AccessPolicy, error)

CreateZoneLevelAccessPolicy creates a new zone level access policy.

API reference: https://api.cloudflare.com/#zone-level-access-policy-create-access-policy

func (*API) CreateZoneLevelAccessServiceToken added in v0.29.3

func (api *API) CreateZoneLevelAccessServiceToken(ctx context.Context, zoneID, name string) (AccessServiceTokenCreateResponse, error)

CreateZoneLevelAccessServiceToken creates a new Access Service Token for a zone.

API reference: https://api.cloudflare.com/#zone-level-access-service-tokens-create-access-service-token

func (*API) CreateZoneLockdown added in v0.8.0

func (api *API) CreateZoneLockdown(ctx context.Context, zoneID string, ld ZoneLockdown) (*ZoneLockdownResponse, error)

CreateZoneLockdown creates a Zone ZoneLockdown rule for the given zone ID.

API reference: https://api.cloudflare.com/#zone-ZoneLockdown-create-a-ZoneLockdown-rule

Example
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.org")
	if err != nil {
		log.Fatal(err)
	}

	newZoneLockdown := cloudflare.ZoneLockdown{
		Description: "Test Zone Lockdown Rule",
		URLs: []string{
			"*.example.org/test",
		},
		Configurations: []cloudflare.ZoneLockdownConfig{
			{
				Target: "ip",
				Value:  "127.0.0.1",
			},
		},
		Paused:   false,
		Priority: 1,
	}

	response, err := api.CreateZoneLockdown(context.Background(), zoneID, newZoneLockdown)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Response: ", response)
}
Output:

func (*API) CreateZoneLogpushJob added in v0.29.3

func (api *API) CreateZoneLogpushJob(ctx context.Context, zoneID string, job LogpushJob) (*LogpushJob, error)

CreateZoneLogpushJob creates a new zone-level Logpush Job.

API reference: https://api.cloudflare.com/#logpush-jobs-create-logpush-job

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

job, err := api.CreateZoneLogpushJob(context.Background(), zoneID, exampleNewLogpushJob)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", job)
Output:

func (*API) CreateZoneRuleset added in v0.29.3

func (api *API) CreateZoneRuleset(ctx context.Context, zoneID string, ruleset Ruleset) (Ruleset, error)

CreateZoneRuleset creates a new ruleset for a zone.

API reference: https://api.cloudflare.com/#zone-rulesets-create-zone-ruleset

func (*API) CustomHostname added in v0.7.4

func (api *API) CustomHostname(ctx context.Context, zoneID string, customHostnameID string) (CustomHostname, error)

CustomHostname inspects the given custom hostname in the given zone.

API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-custom-hostname-configuration-details

func (*API) CustomHostnameFallbackOrigin added in v0.29.3

func (api *API) CustomHostnameFallbackOrigin(ctx context.Context, zoneID string) (CustomHostnameFallbackOrigin, error)

CustomHostnameFallbackOrigin inspects the Custom Hostname Fallback origin in the given zone.

API reference: https://api.cloudflare.com/#custom-hostname-fallback-origin-for-a-zone-properties

func (*API) CustomHostnameIDByName added in v0.7.4

func (api *API) CustomHostnameIDByName(ctx context.Context, zoneID string, hostname string) (string, error)

CustomHostnameIDByName retrieves the ID for the given hostname in the given zone.

func (*API) CustomHostnames added in v0.7.4

func (api *API) CustomHostnames(ctx context.Context, zoneID string, page int, filter CustomHostname) ([]CustomHostname, ResultInfo, error)

CustomHostnames fetches custom hostnames for the given zone, by applying filter.Hostname if not empty and scoping the result to page'th 50 items.

The returned ResultInfo can be used to implement pagination.

API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-list-custom-hostnames

func (*API) CustomPage added in v0.29.3

func (api *API) CustomPage(ctx context.Context, options *CustomPageOptions, customPageID string) (CustomPage, error)

CustomPage lists a single custom page based on the ID.

Zone API reference: https://api.cloudflare.com/#custom-pages-for-a-zone-custom-page-details Account API reference: https://api.cloudflare.com/#custom-pages-account--custom-page-details

func (*API) CustomPages added in v0.29.3

func (api *API) CustomPages(ctx context.Context, options *CustomPageOptions) ([]CustomPage, error)

CustomPages lists custom pages for a zone or account.

Zone API reference: https://api.cloudflare.com/#custom-pages-for-a-zone-list-available-custom-pages Account API reference: https://api.cloudflare.com/#custom-pages-account--list-custom-pages

func (*API) DNSFirewallCluster added in v0.29.3

func (api *API) DNSFirewallCluster(ctx context.Context, clusterID string) (*DNSFirewallCluster, error)

DNSFirewallCluster fetches a single DNS Firewall cluster.

API reference: https://api.cloudflare.com/#dns-firewall-dns-firewall-cluster-details

func (*API) DNSFirewallUserAnalytics added in v0.29.3

func (api *API) DNSFirewallUserAnalytics(ctx context.Context, clusterID string, o DNSFirewallUserAnalyticsOptions) (DNSFirewallAnalytics, error)

DNSFirewallUserAnalytics retrieves analytics report for a specified dimension and time range

func (*API) DNSRecord

func (api *API) DNSRecord(ctx context.Context, zoneID, recordID string) (DNSRecord, error)

DNSRecord returns a single DNS record for the given zone & record identifiers.

API reference: https://api.cloudflare.com/#dns-records-for-a-zone-dns-record-details

func (*API) DNSRecords

func (api *API) DNSRecords(ctx context.Context, zoneID string, rr DNSRecord) ([]DNSRecord, error)

DNSRecords returns a slice of DNS records for the given zone identifier.

This takes a DNSRecord to allow filtering of the results returned.

API reference: https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records

Example (All)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch all records for a zone
	recs, err := api.DNSRecords(context.Background(), zoneID, cloudflare.DNSRecord{})
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range recs {
		fmt.Printf("%s: %s\n", r.Name, r.Content)
	}
}
Output:

Example (FilterByContent)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch only records whose content is 127.0.0.1
	localhost := cloudflare.DNSRecord{Content: "127.0.0.1"}
	recs, err := api.DNSRecords(context.Background(), zoneID, localhost)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range recs {
		fmt.Printf("%s: %s\n", r.Name, r.Content)
	}
}
Output:

Example (FilterByName)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch records of any type with name "foo.example.com"
	// The name must be fully-qualified
	foo := cloudflare.DNSRecord{Name: "foo.example.com"}
	recs, err := api.DNSRecords(context.Background(), zoneID, foo)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range recs {
		fmt.Printf("%s: %s\n", r.Name, r.Content)
	}
}
Output:

Example (FilterByType)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch only AAAA type records
	aaaa := cloudflare.DNSRecord{Type: "AAAA"}
	recs, err := api.DNSRecords(context.Background(), zoneID, aaaa)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range recs {
		fmt.Printf("%s: %s\n", r.Name, r.Content)
	}
}
Output:

func (*API) DeleteAPIToken added in v0.29.3

func (api *API) DeleteAPIToken(ctx context.Context, tokenID string) error

DeleteAPIToken deletes a single API token.

API reference: https://api.cloudflare.com/#user-api-tokens-delete-token

func (*API) DeleteAccessApplication added in v0.29.3

func (api *API) DeleteAccessApplication(ctx context.Context, accountID, applicationID string) error

DeleteAccessApplication deletes an access application.

API reference: https://api.cloudflare.com/#access-applications-delete-access-application

func (*API) DeleteAccessCACertificate added in v0.29.3

func (api *API) DeleteAccessCACertificate(ctx context.Context, accountID, applicationID string) error

DeleteAccessCACertificate deletes an Access CA certificate on a defined Access Application.

API reference: https://api.cloudflare.com/#access-short-lived-certificates-delete-access-certificate

func (*API) DeleteAccessGroup added in v0.29.3

func (api *API) DeleteAccessGroup(ctx context.Context, accountID, groupID string) error

DeleteAccessGroup deletes an access group.

API reference: https://api.cloudflare.com/#access-groups-delete-access-group

func (*API) DeleteAccessIdentityProvider added in v0.29.3

func (api *API) DeleteAccessIdentityProvider(ctx context.Context, accountID, identityProviderUUID string) (AccessIdentityProvider, error)

DeleteAccessIdentityProvider deletes an Access Identity Provider.

API reference: https://api.cloudflare.com/#access-identity-providers-create-access-identity-provider

func (*API) DeleteAccessMutualTLSCertificate added in v0.29.3

func (api *API) DeleteAccessMutualTLSCertificate(ctx context.Context, accountID, certificateID string) error

DeleteAccessMutualTLSCertificate destroys an account level Access Mutual TLS certificate.

API reference: https://api.cloudflare.com/#access-mutual-tls-authentication-update-access-certificate

func (*API) DeleteAccessPolicy added in v0.29.3

func (api *API) DeleteAccessPolicy(ctx context.Context, accountID, applicationID, accessPolicyID string) error

DeleteAccessPolicy deletes an access policy.

API reference: https://api.cloudflare.com/#access-policy-update-access-policy

func (*API) DeleteAccessServiceToken added in v0.29.3

func (api *API) DeleteAccessServiceToken(ctx context.Context, accountID, uuid string) (AccessServiceTokenUpdateResponse, error)

DeleteAccessServiceToken removes an existing Access Service Token for an account.

API reference: https://api.cloudflare.com/#access-service-tokens-delete-access-service-token

func (*API) DeleteAccount added in v0.29.3

func (api *API) DeleteAccount(ctx context.Context, accountID string) error

DeleteAccount removes an account. Note: This requires the Tenant entitlement.

API reference: https://developers.cloudflare.com/tenant/tutorial/provisioning-resources#optional-deleting-accounts

func (*API) DeleteAccountAccessRule added in v0.29.3

func (api *API) DeleteAccountAccessRule(ctx context.Context, accountID, accessRuleID string) (*AccessRuleResponse, error)

DeleteAccountAccessRule deletes a single access rule for the given account and access rule identifiers.

API reference: https://api.cloudflare.com/#account-level-firewall-access-rule-delete-access-rule

func (*API) DeleteAccountLogpushJob added in v0.29.3

func (api *API) DeleteAccountLogpushJob(ctx context.Context, accountID string, jobID int) error

DeleteAccountLogpushJob deletes an account-level Logpush Job.

API reference: https://api.cloudflare.com/#logpush-jobs-delete-logpush-job

func (*API) DeleteAccountMember added in v0.29.3

func (api *API) DeleteAccountMember(ctx context.Context, accountID string, userID string) error

DeleteAccountMember removes a member from an account.

API reference: https://api.cloudflare.com/#account-members-remove-member

func (*API) DeleteAccountRuleset added in v0.29.3

func (api *API) DeleteAccountRuleset(ctx context.Context, accountID, rulesetID string) error

DeleteAccountRuleset deletes a single ruleset for an account.

API reference: https://api.cloudflare.com/#account-rulesets-delete-account-ruleset

func (*API) DeleteArgoTunnel added in v0.29.3

func (api *API) DeleteArgoTunnel(ctx context.Context, accountID, tunnelUUID string) error

DeleteArgoTunnel removes a single Argo tunnel.

API reference: https://api.cloudflare.com/#argo-tunnel-delete-argo-tunnel

func (*API) DeleteCertificatePack added in v0.29.3

func (api *API) DeleteCertificatePack(ctx context.Context, zoneID, certificateID string) error

DeleteCertificatePack removes a certificate pack associated with a zone.

API Reference: https://api.cloudflare.com/#certificate-packs-delete-advanced-certificate-manager-certificate-pack

func (*API) DeleteCustomHostname added in v0.7.4

func (api *API) DeleteCustomHostname(ctx context.Context, zoneID string, customHostnameID string) error

DeleteCustomHostname deletes a custom hostname (and any issued SSL certificates).

API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-delete-a-custom-hostname-and-any-issued-ssl-certificates-

func (*API) DeleteCustomHostnameFallbackOrigin added in v0.29.3

func (api *API) DeleteCustomHostnameFallbackOrigin(ctx context.Context, zoneID string) error

DeleteCustomHostnameFallbackOrigin deletes the Custom Hostname Fallback origin in the given zone.

API reference: https://api.cloudflare.com/#custom-hostname-fallback-origin-for-a-zone-delete-fallback-origin-for-custom-hostnames

func (*API) DeleteDNSFirewallCluster added in v0.29.3

func (api *API) DeleteDNSFirewallCluster(ctx context.Context, clusterID string) error

DeleteDNSFirewallCluster deletes a DNS Firewall cluster. Note that this cannot be undone, and will stop all traffic to that cluster.

API reference: https://api.cloudflare.com/#dns-firewall-delete-dns-firewall-cluster

func (*API) DeleteDNSRecord

func (api *API) DeleteDNSRecord(ctx context.Context, zoneID, recordID string) error

DeleteDNSRecord deletes a single DNS record for the given zone & record identifiers.

API reference: https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record

func (*API) DeleteDevicePostureIntegration added in v0.29.3

func (api *API) DeleteDevicePostureIntegration(ctx context.Context, accountID, ruleID string) error

DeleteDevicePostureIntegration deletes a device posture integration.

API reference: https://api.cloudflare.com/#device-posture-integrations-delete-device-posture-integration

func (*API) DeleteDevicePostureRule added in v0.29.3

func (api *API) DeleteDevicePostureRule(ctx context.Context, accountID, ruleID string) error

DeleteDevicePostureRule deletes a device posture rule.

API reference: https://api.cloudflare.com/#device-posture-rules-delete-device-posture-rule

func (*API) DeleteFilter added in v0.29.3

func (api *API) DeleteFilter(ctx context.Context, zoneID, filterID string) error

DeleteFilter deletes a single filter.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/delete/#delete-a-single-filter

func (*API) DeleteFilters added in v0.29.3

func (api *API) DeleteFilters(ctx context.Context, zoneID string, filterIDs []string) error

DeleteFilters deletes multiple filters.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/delete/#delete-multiple-filters

func (*API) DeleteFirewallRule added in v0.29.3

func (api *API) DeleteFirewallRule(ctx context.Context, zoneID, firewallRuleID string) error

DeleteFirewallRule deletes a single firewall rule.

API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/delete/#delete-a-single-rule

func (*API) DeleteFirewallRules added in v0.29.3

func (api *API) DeleteFirewallRules(ctx context.Context, zoneID string, firewallRuleIDs []string) error

DeleteFirewallRules deletes multiple firewall rules at once.

API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/delete/#delete-multiple-rules

func (*API) DeleteHealthcheck added in v0.29.3

func (api *API) DeleteHealthcheck(ctx context.Context, zoneID string, healthcheckID string) error

DeleteHealthcheck deletes a healthcheck in a zone.

API reference: https://api.cloudflare.com/#health-checks-delete-health-check

func (*API) DeleteHealthcheckPreview added in v0.29.3

func (api *API) DeleteHealthcheckPreview(ctx context.Context, zoneID string, id string) error

DeleteHealthcheckPreview deletes a healthcheck preview in a zone if it exists.

API reference: https://api.cloudflare.com/#health-checks-delete-preview-health-check

func (*API) DeleteIPList added in v0.29.3

func (api *API) DeleteIPList(ctx context.Context, id string) (IPListDeleteResponse, error)

DeleteIPList deletes an IP List

API reference: https://api.cloudflare.com/#rules-lists-delete-list

func (*API) DeleteIPListItems added in v0.29.3

func (api *API) DeleteIPListItems(ctx context.Context, id string, items IPListItemDeleteRequest) (
	[]IPListItem, error)

DeleteIPListItems removes specific Items of an IP List by their ID synchronously and returns the current set of IP List Items

func (*API) DeleteIPListItemsAsync added in v0.29.3

func (api *API) DeleteIPListItemsAsync(ctx context.Context, id string, items IPListItemDeleteRequest) (
	IPListItemDeleteResponse, error)

DeleteIPListItemsAsync removes specific Items of an IP List by their ID asynchronously. Users have to poll the operation status by using the operation_id returned by this function.

API reference: https://api.cloudflare.com/#rules-lists-delete-list-items

func (*API) DeleteKeylessSSL added in v0.29.3

func (api *API) DeleteKeylessSSL(ctx context.Context, zoneID, keylessSSLID string) error

DeleteKeylessSSL deletes an existing Keyless SSL configuration.

API reference: https://api.cloudflare.com/#keyless-ssl-for-a-zone-delete-keyless-ssl-configuration

func (*API) DeleteLoadBalancer added in v0.8.0

func (api *API) DeleteLoadBalancer(ctx context.Context, zoneID, lbID string) error

DeleteLoadBalancer disables and deletes a load balancer.

API reference: https://api.cloudflare.com/#load-balancers-delete-load-balancer

func (*API) DeleteLoadBalancerMonitor added in v0.8.0

func (api *API) DeleteLoadBalancerMonitor(ctx context.Context, monitorID string) error

DeleteLoadBalancerMonitor disables and deletes a load balancer monitor.

API reference: https://api.cloudflare.com/#load-balancer-monitors-delete-monitor

func (*API) DeleteLoadBalancerPool added in v0.8.0

func (api *API) DeleteLoadBalancerPool(ctx context.Context, poolID string) error

DeleteLoadBalancerPool disables and deletes a load balancer pool.

API reference: https://api.cloudflare.com/#load-balancer-pools-delete-pool

func (*API) DeleteLogpushJob deprecated added in v0.29.3

func (api *API) DeleteLogpushJob(ctx context.Context, zoneID string, jobID int) error

DeleteLogpushJob deletes a Logpush Job for a zone.

API reference: https://api.cloudflare.com/#logpush-jobs-delete-logpush-job

Deprecated: Use `DeleteZoneLogpushJob` or `DeleteAccountLogpushJob` depending on the desired resource to target.

func (*API) DeleteMagicFirewallRuleset added in v0.29.3

func (api *API) DeleteMagicFirewallRuleset(ctx context.Context, id string) error

DeleteMagicFirewallRuleset deletes a Magic Firewall ruleset

API reference: https://api.cloudflare.com/#rulesets-delete-ruleset

func (*API) DeleteMagicTransitStaticRoute added in v0.29.3

func (api *API) DeleteMagicTransitStaticRoute(ctx context.Context, id string) (MagicTransitStaticRoute, error)

DeleteMagicTransitStaticRoute deletes a static route

API reference: https://api.cloudflare.com/#magic-transit-static-routes-delete-route

func (*API) DeleteNotificationPolicy added in v0.29.3

func (api *API) DeleteNotificationPolicy(ctx context.Context, accountID, policyID string) (SaveResponse, error)

DeleteNotificationPolicy deletes a notification policy for an account.

API Reference: https://api.cloudflare.com/#notification-policies-delete-notification-policy

func (*API) DeleteNotificationWebhooks added in v0.29.3

func (api *API) DeleteNotificationWebhooks(ctx context.Context, accountID, webhookID string) (SaveResponse, error)

DeleteNotificationWebhooks will delete a webhook, given the account and webhooks ids. Deleting the webhooks will remove it from any connected notification policies.

API Reference: https://api.cloudflare.com/#notification-webhooks-delete-webhook

func (*API) DeletePageRule

func (api *API) DeletePageRule(ctx context.Context, zoneID, ruleID string) error

DeletePageRule deletes a Page Rule for a zone.

API reference: https://api.cloudflare.com/#page-rules-for-a-zone-delete-a-page-rule

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

err = api.DeletePageRule(context.Background(), zoneID, "my_page_rule_id")
if err != nil {
	log.Fatal(err)
}
Output:

func (*API) DeletePagesProject added in v0.29.3

func (api *API) DeletePagesProject(ctx context.Context, accountID, projectName string) error

DeletePagesProject deletes a Pages project by name.

API reference: https://api.cloudflare.com/#pages-project-delete-project

func (*API) DeletePerHostnameAuthenticatedOriginPullsCertificate added in v0.29.3

func (api *API) DeletePerHostnameAuthenticatedOriginPullsCertificate(ctx context.Context, zoneID, certificateID string) (PerHostnameAuthenticatedOriginPullsCertificateDetails, error)

DeletePerHostnameAuthenticatedOriginPullsCertificate will remove the requested Per Hostname certificate from the edge.

API reference: https://api.cloudflare.com/#per-hostname-authenticated-origin-pull-delete-hostname-client-certificate

func (*API) DeletePerZoneAuthenticatedOriginPullsCertificate added in v0.29.3

func (api *API) DeletePerZoneAuthenticatedOriginPullsCertificate(ctx context.Context, zoneID, certificateID string) (PerZoneAuthenticatedOriginPullsCertificateDetails, error)

DeletePerZoneAuthenticatedOriginPullsCertificate removes the specified client certificate from the edge.

API reference: https://api.cloudflare.com/#zone-level-authenticated-origin-pulls-delete-certificate

func (*API) DeleteRailgun

func (api *API) DeleteRailgun(ctx context.Context, railgunID string) error

DeleteRailgun disables and deletes a Railgun.

API reference: https://api.cloudflare.com/#railgun-delete-railgun

func (*API) DeleteRateLimit added in v0.8.5

func (api *API) DeleteRateLimit(ctx context.Context, zoneID, limitID string) error

DeleteRateLimit deletes a Rate Limit for a zone.

API reference: https://api.cloudflare.com/#rate-limits-for-a-zone-delete-rate-limit

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

err = api.DeleteRateLimit(context.Background(), zoneID, "my_rate_limit_id")
if err != nil {
	log.Fatal(err)
}
Output:

func (*API) DeleteSSL

func (api *API) DeleteSSL(ctx context.Context, zoneID, certificateID string) error

DeleteSSL deletes a custom SSL certificate from the given zone.

API reference: https://api.cloudflare.com/#custom-ssl-for-a-zone-delete-an-ssl-certificate

func (*API) DeleteSecondaryDNSPrimary added in v0.29.3

func (api *API) DeleteSecondaryDNSPrimary(ctx context.Context, accountID, primaryID string) error

DeleteSecondaryDNSPrimary deletes a secondary DNS primary.

API reference: https://api.cloudflare.com/#secondary-dns-primary--delete-primary

func (*API) DeleteSecondaryDNSTSIG added in v0.29.3

func (api *API) DeleteSecondaryDNSTSIG(ctx context.Context, accountID, tsigID string) error

DeleteSecondaryDNSTSIG deletes a secondary DNS TSIG.

API reference: https://api.cloudflare.com/#secondary-dns-tsig--delete-tsig

func (*API) DeleteSecondaryDNSZone added in v0.29.3

func (api *API) DeleteSecondaryDNSZone(ctx context.Context, zoneID string) error

DeleteSecondaryDNSZone deletes a secondary DNS zone.

API reference: https://api.cloudflare.com/#secondary-dns-delete-secondary-zone-configuration

func (*API) DeleteSpectrumApplication added in v0.29.3

func (api *API) DeleteSpectrumApplication(ctx context.Context, zoneID string, applicationID string) error

DeleteSpectrumApplication removes a Spectrum application based on the ID.

API reference: https://developers.cloudflare.com/spectrum/api-reference/#delete-a-spectrum-application

func (*API) DeleteTeamsList added in v0.29.3

func (api *API) DeleteTeamsList(ctx context.Context, accountID, teamsListID string) error

DeleteTeamsList deletes a teams list.

API reference: https://api.cloudflare.com/#teams-lists-delete-teams-list

func (*API) DeleteTeamsLocation added in v0.29.3

func (api *API) DeleteTeamsLocation(ctx context.Context, accountID, teamsLocationID string) error

DeleteTeamsLocation deletes a teams location.

API reference: https://api.cloudflare.com/#teams-locations-delete-teams-location

func (*API) DeleteUserAccessRule added in v0.8.1

func (api *API) DeleteUserAccessRule(ctx context.Context, accessRuleID string) (*AccessRuleResponse, error)

DeleteUserAccessRule deletes a single access rule for the logged-in user and access rule identifiers.

API reference: https://api.cloudflare.com/#user-level-firewall-access-rule-update-access-rule

func (*API) DeleteUserAgentRule added in v0.8.0

func (api *API) DeleteUserAgentRule(ctx context.Context, zoneID string, id string) (*UserAgentRuleResponse, error)

DeleteUserAgentRule deletes a User-Agent Block rule (based on the ID) for the given zone ID.

API reference: https://api.cloudflare.com/#user-agent-blocking-rules-delete-useragent-rule

func (*API) DeleteVirtualDNS deprecated

func (api *API) DeleteVirtualDNS(ctx context.Context, virtualDNSID string) error

DeleteVirtualDNS deletes a Virtual DNS cluster. Note that this cannot be undone, and will stop all traffic to that cluster.

Deprecated: Use DeleteDNSFirewallCluster instead.

func (*API) DeleteWAFOverride added in v0.29.3

func (api *API) DeleteWAFOverride(ctx context.Context, zoneID, overrideID string) error

DeleteWAFOverride deletes a WAF override for a zone.

API reference: https://api.cloudflare.com/#waf-overrides-delete-lockdown-rule

func (*API) DeleteWaitingRoom added in v0.29.3

func (api *API) DeleteWaitingRoom(ctx context.Context, zoneID, waitingRoomID string) error

DeleteWaitingRoom deletes a Waiting Room for a zone.

API reference: https://api.cloudflare.com/#waiting-room-delete-waiting-room

func (*API) DeleteWorker added in v0.29.3

func (api *API) DeleteWorker(ctx context.Context, requestParams *WorkerRequestParams) (WorkerScriptResponse, error)

DeleteWorker deletes worker for a zone.

API reference: https://api.cloudflare.com/#worker-script-delete-worker

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}
res, err := api.DeleteWorker(context.Background(), &cloudflare.WorkerRequestParams{ZoneID: zoneID})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res)

DeleteWorkerWithName()
Output:

func (*API) DeleteWorkerRoute added in v0.29.3

func (api *API) DeleteWorkerRoute(ctx context.Context, zoneID string, routeID string) (WorkerRouteResponse, error)

DeleteWorkerRoute deletes worker route for a zone

API reference: https://api.cloudflare.com/#worker-routes-delete-route

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}
// pull from existing list of routes to perform delete on
routesResponse, err := api.ListWorkerRoutes(context.Background(), zoneID)
if err != nil {
	log.Fatal(err)
}
// delete first route retrieved from the listWorkerRoutes call
res, err := api.DeleteWorkerRoute(context.Background(), zoneID, routesResponse.Routes[0].ID)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res)
Output:

func (API) DeleteWorkersKV added in v0.29.3

func (api API) DeleteWorkersKV(ctx context.Context, namespaceID, key string) (Response, error)

DeleteWorkersKV deletes a key and value for a provided storage namespace

API reference: https://api.cloudflare.com/#workers-kv-namespace-delete-key-value-pair

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

key := "test_key"
resp, err := api.DeleteWorkersKV(context.Background(), namespace, key)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", resp)
Output:

func (*API) DeleteWorkersKVBulk added in v0.29.3

func (api *API) DeleteWorkersKVBulk(ctx context.Context, namespaceID string, keys []string) (Response, error)

DeleteWorkersKVBulk deletes multiple KVs at once.

API reference: https://api.cloudflare.com/#workers-kv-namespace-delete-multiple-key-value-pairs

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

keys := []string{"key1", "key2", "key3"}

resp, err := api.DeleteWorkersKVBulk(context.Background(), namespace, keys)
if err != nil {
	log.Fatal(err)
}

fmt.Println(resp)
Output:

func (*API) DeleteWorkersKVNamespace added in v0.29.3

func (api *API) DeleteWorkersKVNamespace(ctx context.Context, namespaceID string) (Response, error)

DeleteWorkersKVNamespace deletes the namespace corresponding to the given ID

API reference: https://api.cloudflare.com/#workers-kv-namespace-remove-a-namespace

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

response, err := api.DeleteWorkersKVNamespace(context.Background(), namespace)
if err != nil {
	log.Fatal(err)
}

fmt.Println(response)
Output:

func (*API) DeleteWorkersSecret added in v0.29.3

func (api *API) DeleteWorkersSecret(ctx context.Context, script, secretName string) (Response, error)

DeleteWorkersSecret deletes a secret API reference: https://api.cloudflare.com/

func (*API) DeleteZone

func (api *API) DeleteZone(ctx context.Context, zoneID string) (ZoneID, error)

DeleteZone deletes the given zone.

API reference: https://api.cloudflare.com/#zone-delete-a-zone

func (*API) DeleteZoneAccessMutualTLSCertificate added in v0.29.3

func (api *API) DeleteZoneAccessMutualTLSCertificate(ctx context.Context, zoneID, certificateID string) error

DeleteZoneAccessMutualTLSCertificate destroys a zone level Access Mutual TLS certificate.

API reference: https://api.cloudflare.com/#zone-level-access-mutual-tls-authentication-update-access-certificate

func (*API) DeleteZoneAccessRule added in v0.8.1

func (api *API) DeleteZoneAccessRule(ctx context.Context, zoneID, accessRuleID string) (*AccessRuleResponse, error)

DeleteZoneAccessRule deletes a single access rule for the given zone and access rule identifiers.

API reference: https://api.cloudflare.com/#firewall-access-rule-for-a-zone-delete-access-rule

func (*API) DeleteZoneDNSSEC added in v0.29.3

func (api *API) DeleteZoneDNSSEC(ctx context.Context, zoneID string) (string, error)

DeleteZoneDNSSEC deletes DNSSEC for zone

API reference: https://api.cloudflare.com/#dnssec-delete-dnssec-records

func (*API) DeleteZoneLevelAccessApplication added in v0.29.3

func (api *API) DeleteZoneLevelAccessApplication(ctx context.Context, zoneID, applicationID string) error

DeleteZoneLevelAccessApplication deletes a zone level access application.

API reference: https://api.cloudflare.com/#zone-level-access-applications-delete-access-application

func (*API) DeleteZoneLevelAccessCACertificate added in v0.29.3

func (api *API) DeleteZoneLevelAccessCACertificate(ctx context.Context, zoneID, applicationID string) error

DeleteZoneLevelAccessCACertificate deletes a zone level Access CA certificate on a defined Access Application.

API reference: https://api.cloudflare.com/#zone-level-access-short-lived-certificates-delete-access-certificate

func (*API) DeleteZoneLevelAccessGroup added in v0.29.3

func (api *API) DeleteZoneLevelAccessGroup(ctx context.Context, zoneID, groupID string) error

DeleteZoneLevelAccessGroup deletes a zone level access group.

API reference: https://api.cloudflare.com/#zone-level-access-groups-delete-access-group

func (*API) DeleteZoneLevelAccessIdentityProvider added in v0.29.3

func (api *API) DeleteZoneLevelAccessIdentityProvider(ctx context.Context, zoneID, identityProviderUUID string) (AccessIdentityProvider, error)

DeleteZoneLevelAccessIdentityProvider deletes a zone level Access Identity Provider.

API reference: https://api.cloudflare.com/#zone-level-access-identity-providers-delete-access-identity-provider

func (*API) DeleteZoneLevelAccessPolicy added in v0.29.3

func (api *API) DeleteZoneLevelAccessPolicy(ctx context.Context, zoneID, applicationID, accessPolicyID string) error

DeleteZoneLevelAccessPolicy deletes a zone level access policy.

API reference: https://api.cloudflare.com/#zone-level-access-policy-delete-access-policy

func (*API) DeleteZoneLevelAccessServiceToken added in v0.29.3

func (api *API) DeleteZoneLevelAccessServiceToken(ctx context.Context, zoneID, uuid string) (AccessServiceTokenUpdateResponse, error)

DeleteZoneLevelAccessServiceToken removes an existing Access Service Token for a zone.

API reference: https://api.cloudflare.com/#zone-level-access-service-tokens-delete-access-service-token

func (*API) DeleteZoneLockdown added in v0.8.0

func (api *API) DeleteZoneLockdown(ctx context.Context, zoneID string, id string) (*ZoneLockdownResponse, error)

DeleteZoneLockdown deletes a Zone ZoneLockdown rule (based on the ID) for the given zone ID.

API reference: https://api.cloudflare.com/#zone-ZoneLockdown-delete-ZoneLockdown-rule

func (*API) DeleteZoneLogpushJob added in v0.29.3

func (api *API) DeleteZoneLogpushJob(ctx context.Context, zoneID string, jobID int) error

DeleteZoneLogpushJob deletes a Logpush Job for a zone.

API reference: https://api.cloudflare.com/#logpush-jobs-delete-logpush-job

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

err = api.DeleteZoneLogpushJob(context.Background(), zoneID, 1)
if err != nil {
	log.Fatal(err)
}
Output:

func (*API) DeleteZoneRuleset added in v0.29.3

func (api *API) DeleteZoneRuleset(ctx context.Context, zoneID, rulesetID string) error

DeleteZoneRuleset deletes a single ruleset for a zone.

API reference: https://api.cloudflare.com/#zone-rulesets-delete-zone-ruleset

func (*API) DevicePostureIntegration added in v0.29.3

func (api *API) DevicePostureIntegration(ctx context.Context, accountID, integrationID string) (DevicePostureIntegration, error)

DevicePostureIntegration returns a specific device posture integrations within an account.

API reference: https://api.cloudflare.com/#device-posture-integrations-device-posture-integration-details

func (*API) DevicePostureIntegrations added in v0.29.3

func (api *API) DevicePostureIntegrations(ctx context.Context, accountID string) ([]DevicePostureIntegration, ResultInfo, error)

DevicePostureIntegrations returns all device posture integrations within an account.

API reference: https://api.cloudflare.com/#device-posture-integrations-list-device-posture-integrations

func (*API) DevicePostureRule added in v0.29.3

func (api *API) DevicePostureRule(ctx context.Context, accountID, ruleID string) (DevicePostureRule, error)

DevicePostureRule returns a single device posture rule based on the rule ID.

API reference: https://api.cloudflare.com/#device-posture-rules-device-posture-rules-details

func (*API) DevicePostureRules added in v0.29.3

func (api *API) DevicePostureRules(ctx context.Context, accountID string) ([]DevicePostureRule, ResultInfo, error)

DevicePostureRules returns all device posture rules within an account.

API reference: https://api.cloudflare.com/#device-posture-rules-list-device-posture-rules

func (*API) DisableRailgun

func (api *API) DisableRailgun(ctx context.Context, railgunID string) (Railgun, error)

DisableRailgun enables a Railgun for all zones connected to it.

API reference: https://api.cloudflare.com/#railgun-enable-or-disable-a-railgun

func (*API) DisconnectZoneRailgun

func (api *API) DisconnectZoneRailgun(ctx context.Context, zoneID, railgunID string) (ZoneRailgun, error)

DisconnectZoneRailgun disconnects a Railgun for a given zone.

API reference: https://api.cloudflare.com/#railguns-for-a-zone-connect-or-disconnect-a-railgun

func (*API) DownloadWorker added in v0.29.3

func (api *API) DownloadWorker(ctx context.Context, requestParams *WorkerRequestParams) (WorkerScriptResponse, error)

DownloadWorker fetch raw script content for your worker returns []byte containing worker code js

API reference: https://api.cloudflare.com/#worker-script-download-worker

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

res, err := api.DownloadWorker(context.Background(), &cloudflare.WorkerRequestParams{ZoneID: zoneID})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res)

DownloadWorkerWithName()
Output:

func (*API) EditPerHostnameAuthenticatedOriginPullsConfig added in v0.29.3

func (api *API) EditPerHostnameAuthenticatedOriginPullsConfig(ctx context.Context, zoneID string, config []PerHostnameAuthenticatedOriginPullsConfig) ([]PerHostnameAuthenticatedOriginPullsDetails, error)

EditPerHostnameAuthenticatedOriginPullsConfig applies the supplied Per Hostname AuthenticatedOriginPulls config onto a hostname(s) in the edge.

API reference: https://api.cloudflare.com/#per-hostname-authenticated-origin-pull-enable-or-disable-a-hostname-for-client-authentication

func (*API) EditUniversalSSLSetting added in v0.29.3

func (api *API) EditUniversalSSLSetting(ctx context.Context, zoneID string, setting UniversalSSLSetting) (UniversalSSLSetting, error)

EditUniversalSSLSetting edits the universal ssl setting for a zone

API reference: https://api.cloudflare.com/#universal-ssl-settings-for-a-zone-edit-universal-ssl-settings

func (*API) EditZone

func (api *API) EditZone(ctx context.Context, zoneID string, zoneOpts ZoneOptions) (Zone, error)

EditZone edits the given zone.

This is usually called by ZoneSetPaused, ZoneSetType, or ZoneSetVanityNS.

API reference: https://api.cloudflare.com/#zone-edit-zone-properties

func (*API) EnableRailgun

func (api *API) EnableRailgun(ctx context.Context, railgunID string) (Railgun, error)

EnableRailgun enables a Railgun for all zones connected to it.

API reference: https://api.cloudflare.com/#railgun-enable-or-disable-a-railgun

func (*API) FallbackOrigin added in v0.29.3

func (api *API) FallbackOrigin(ctx context.Context, zoneID string) (FallbackOrigin, error)

FallbackOrigin returns information about the fallback origin for the specified zone.

API reference: https://developers.cloudflare.com/ssl/ssl-for-saas/api-calls/#fallback-origin-configuration

func (*API) Filter added in v0.29.3

func (api *API) Filter(ctx context.Context, zoneID, filterID string) (Filter, error)

Filter returns a single filter in a zone based on the filter ID.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/get/#get-by-filter-id

func (*API) Filters added in v0.29.3

func (api *API) Filters(ctx context.Context, zoneID string, pageOpts PaginationOptions) ([]Filter, error)

Filters returns all filters for a zone.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/get/#get-all-filters

func (*API) FirewallRule added in v0.29.3

func (api *API) FirewallRule(ctx context.Context, zoneID, firewallRuleID string) (FirewallRule, error)

FirewallRule returns a single firewall rule based on the ID.

API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/get/#get-by-rule-id

func (*API) FirewallRules added in v0.29.3

func (api *API) FirewallRules(ctx context.Context, zoneID string, pageOpts PaginationOptions) ([]FirewallRule, error)

FirewallRules returns all firewall rules.

API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/get/#get-all-rules

func (*API) ForceSecondaryDNSZoneAXFR added in v0.29.3

func (api *API) ForceSecondaryDNSZoneAXFR(ctx context.Context, zoneID string) error

ForceSecondaryDNSZoneAXFR requests an immediate AXFR request.

API reference: https://api.cloudflare.com/#secondary-dns-update-secondary-zone-configuration

func (*API) GetAPIToken added in v0.29.3

func (api *API) GetAPIToken(ctx context.Context, tokenID string) (APIToken, error)

GetAPIToken returns a single API token based on the ID.

API reference: https://api.cloudflare.com/#user-api-tokens-token-details

func (*API) GetAccountLogpushFields added in v0.29.3

func (api *API) GetAccountLogpushFields(ctx context.Context, accountID, dataset string) (LogpushFields, error)

GetAccountLogpushFields returns fields for a given account-level dataset.

Account fields documentation: https://developers.cloudflare.com/logs/reference/log-fields/account

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs

func (*API) GetAccountLogpushJob added in v0.29.3

func (api *API) GetAccountLogpushJob(ctx context.Context, accountID string, jobID int) (LogpushJob, error)

GetAccountLogpushJob fetches detail about one account-level Logpush Job.

API reference: https://api.cloudflare.com/#logpush-jobs-logpush-job-details

func (*API) GetAccountLogpushOwnershipChallenge added in v0.29.3

func (api *API) GetAccountLogpushOwnershipChallenge(ctx context.Context, accountID, destinationConf string) (*LogpushGetOwnershipChallenge, error)

GetAccountLogpushOwnershipChallenge returns ownership challenge.

API reference: https://api.cloudflare.com/#logpush-jobs-get-ownership-challenge

func (*API) GetAccountRuleset added in v0.29.3

func (api *API) GetAccountRuleset(ctx context.Context, accountID, rulesetID string) (Ruleset, error)

GetAccountRuleset fetches a single ruleset for an account.

API reference: https://api.cloudflare.com/#account-rulesets-get-an-account-ruleset

func (*API) GetAccountRulesetPhase added in v0.29.3

func (api *API) GetAccountRulesetPhase(ctx context.Context, accountID, rulesetPhase string) (Ruleset, error)

GetAccountRulesetPhase returns a ruleset phase for an account.

API reference: TBA

func (*API) GetAdvertisementStatus added in v0.29.3

func (api *API) GetAdvertisementStatus(ctx context.Context, id string) (AdvertisementStatus, error)

GetAdvertisementStatus returns the BGP status of the IP prefix

API reference: https://api.cloudflare.com/#ip-address-management-prefixes-update-prefix-description

func (*API) GetAuthenticatedOriginPullsStatus added in v0.29.3

func (api *API) GetAuthenticatedOriginPullsStatus(ctx context.Context, zoneID string) (AuthenticatedOriginPulls, error)

GetAuthenticatedOriginPullsStatus returns the configuration details for global AuthenticatedOriginPulls (tls_client_auth).

API reference: https://api.cloudflare.com/#zone-settings-get-tls-client-auth-setting

func (*API) GetAvailableNotificationTypes added in v0.29.3

func (api *API) GetAvailableNotificationTypes(ctx context.Context, accountID string) (NotificationAvailableAlertsResponse, error)

GetAvailableNotificationTypes will return the alert types available for a given account.

API Reference: https://api.cloudflare.com/#notification-mechanism-eligibility-properties

func (*API) GetEligibleNotificationDestinations added in v0.29.3

func (api *API) GetEligibleNotificationDestinations(ctx context.Context, accountID string) (NotificationEligibilityResponse, error)

GetEligibleNotificationDestinations will return the types of destinations an account is eligible to configure.

API Reference: https://api.cloudflare.com/#notification-mechanism-eligibility-properties

func (*API) GetIPList added in v0.29.3

func (api *API) GetIPList(ctx context.Context, id string) (IPList, error)

GetIPList returns a single IP List

API reference: https://api.cloudflare.com/#rules-lists-get-list

func (*API) GetIPListBulkOperation added in v0.29.3

func (api *API) GetIPListBulkOperation(ctx context.Context, id string) (IPListBulkOperation, error)

GetIPListBulkOperation returns the status of a bulk operation

API reference: https://api.cloudflare.com/#rules-lists-get-bulk-operation

func (*API) GetIPListItem added in v0.29.3

func (api *API) GetIPListItem(ctx context.Context, listID, id string) (IPListItem, error)

GetIPListItem returns a single IP List Item

API reference: https://api.cloudflare.com/#rules-lists-get-list-item

func (*API) GetLogpullRetentionFlag added in v0.29.3

func (api *API) GetLogpullRetentionFlag(ctx context.Context, zoneID string) (*LogpullRetentionConfiguration, error)

GetLogpullRetentionFlag gets the current setting flag.

API reference: https://developers.cloudflare.com/logs/logpull-api/enabling-log-retention/

func (*API) GetLogpushOwnershipChallenge deprecated added in v0.29.3

func (api *API) GetLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf string) (*LogpushGetOwnershipChallenge, error)

GetLogpushOwnershipChallenge returns ownership challenge.

API reference: https://api.cloudflare.com/#logpush-jobs-get-ownership-challenge

Deprecated: Use `GetZoneLogpushOwnershipChallenge` or `GetAccountLogpushOwnershipChallenge` depending on the desired resource to target.

func (*API) GetMagicFirewallRuleset added in v0.29.3

func (api *API) GetMagicFirewallRuleset(ctx context.Context, id string) (MagicFirewallRuleset, error)

GetMagicFirewallRuleset returns a specific Magic Firewall Ruleset

API reference: https://api.cloudflare.com/#rulesets-get-a-ruleset

func (*API) GetMagicTransitStaticRoute added in v0.29.3

func (api *API) GetMagicTransitStaticRoute(ctx context.Context, id string) (MagicTransitStaticRoute, error)

GetMagicTransitStaticRoute returns exactly one static route

API reference: https://api.cloudflare.com/#magic-transit-static-routes-route-details

func (*API) GetNotificationPolicy added in v0.29.3

func (api *API) GetNotificationPolicy(ctx context.Context, accountID, policyID string) (NotificationPolicyResponse, error)

GetNotificationPolicy returns a specific created by a user, given the account id and the policy id.

API Reference: https://api.cloudflare.com/#notification-policies-properties

func (*API) GetNotificationWebhooks added in v0.29.3

func (api *API) GetNotificationWebhooks(ctx context.Context, accountID, webhookID string) (NotificationWebhookResponse, error)

GetNotificationWebhooks will return a specific webhook destination, given the account and webhooks ids.

API Reference: https://api.cloudflare.com/#notification-webhooks-get-webhook

func (*API) GetOrganizationAuditLogs added in v0.29.3

func (api *API) GetOrganizationAuditLogs(ctx context.Context, organizationID string, a AuditLogFilter) (AuditLogResponse, error)

GetOrganizationAuditLogs will return the audit logs of a specific organization, based on the ID passed in. The audit logs can be filtered based on any argument in the AuditLogFilter

API Reference: https://api.cloudflare.com/#audit-logs-list-organization-audit-logs

func (*API) GetPerHostnameAuthenticatedOriginPullsCertificate added in v0.29.3

func (api *API) GetPerHostnameAuthenticatedOriginPullsCertificate(ctx context.Context, zoneID, certificateID string) (PerHostnameAuthenticatedOriginPullsCertificateDetails, error)

GetPerHostnameAuthenticatedOriginPullsCertificate retrieves certificate metadata about the requested Per Hostname certificate.

API reference: https://api.cloudflare.com/#per-hostname-authenticated-origin-pull-get-the-hostname-client-certificate

func (*API) GetPerHostnameAuthenticatedOriginPullsConfig added in v0.29.3

func (api *API) GetPerHostnameAuthenticatedOriginPullsConfig(ctx context.Context, zoneID, hostname string) (PerHostnameAuthenticatedOriginPullsDetails, error)

GetPerHostnameAuthenticatedOriginPullsConfig returns the config state of Per Hostname AuthenticatedOriginPulls of the provided hostname within a zone.

API reference: https://api.cloudflare.com/#per-hostname-authenticated-origin-pull-get-the-hostname-status-for-client-authentication

func (*API) GetPerZoneAuthenticatedOriginPullsCertificateDetails added in v0.29.3

func (api *API) GetPerZoneAuthenticatedOriginPullsCertificateDetails(ctx context.Context, zoneID, certificateID string) (PerZoneAuthenticatedOriginPullsCertificateDetails, error)

GetPerZoneAuthenticatedOriginPullsCertificateDetails returns the metadata associated with a user uploaded client certificate to Per Zone AuthenticatedOriginPulls.

API reference: https://api.cloudflare.com/#zone-level-authenticated-origin-pulls-get-certificate-details

func (*API) GetPerZoneAuthenticatedOriginPullsStatus added in v0.29.3

func (api *API) GetPerZoneAuthenticatedOriginPullsStatus(ctx context.Context, zoneID string) (PerZoneAuthenticatedOriginPullsSettings, error)

GetPerZoneAuthenticatedOriginPullsStatus returns whether per zone AuthenticatedOriginPulls is enabled or not. It is false by default.

API reference: https://api.cloudflare.com/#zone-level-authenticated-origin-pulls-get-enablement-setting-for-zone

func (*API) GetPrefix added in v0.29.3

func (api *API) GetPrefix(ctx context.Context, id string) (IPPrefix, error)

GetPrefix returns a specific IP prefix

API reference: https://api.cloudflare.com/#ip-address-management-prefixes-prefix-details

func (*API) GetSecondaryDNSPrimary added in v0.29.3

func (api *API) GetSecondaryDNSPrimary(ctx context.Context, accountID, primaryID string) (SecondaryDNSPrimary, error)

GetSecondaryDNSPrimary returns a single secondary DNS primary.

API reference: https://api.cloudflare.com/#secondary-dns-primary--primary-details

func (*API) GetSecondaryDNSTSIG added in v0.29.3

func (api *API) GetSecondaryDNSTSIG(ctx context.Context, accountID, tsigID string) (SecondaryDNSTSIG, error)

GetSecondaryDNSTSIG gets a single account level TSIG for a secondary DNS configuration.

API reference: https://api.cloudflare.com/#secondary-dns-tsig--tsig-details

func (*API) GetSecondaryDNSZone added in v0.29.3

func (api *API) GetSecondaryDNSZone(ctx context.Context, zoneID string) (SecondaryDNSZone, error)

GetSecondaryDNSZone returns the secondary DNS zone configuration for a single zone.

API reference: https://api.cloudflare.com/#secondary-dns-secondary-zone-configuration-details

func (*API) GetUserAuditLogs added in v0.29.3

func (api *API) GetUserAuditLogs(ctx context.Context, a AuditLogFilter) (AuditLogResponse, error)

GetUserAuditLogs will return your user's audit logs. The audit logs can be filtered based on any argument in the AuditLogFilter

API Reference: https://api.cloudflare.com/#audit-logs-list-user-audit-logs

func (*API) GetWorkerRoute added in v0.29.3

func (api *API) GetWorkerRoute(ctx context.Context, zoneID string, routeID string) (WorkerRouteResponse, error)

GetWorkerRoute returns a worker route.

API reference: https://api.cloudflare.com/#worker-routes-get-route

func (*API) GetZoneLogpushFields added in v0.29.3

func (api *API) GetZoneLogpushFields(ctx context.Context, zoneID, dataset string) (LogpushFields, error)

GetZoneLogpushFields returns fields for a given zone-level dataset.

Zone fields documentation: https://developers.cloudflare.com/logs/reference/log-fields/zone

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs

func (*API) GetZoneLogpushJob added in v0.29.3

func (api *API) GetZoneLogpushJob(ctx context.Context, zoneID string, jobID int) (LogpushJob, error)

GetZoneLogpushJob fetches detail about one Logpush Job for a zone.

API reference: https://api.cloudflare.com/#logpush-jobs-logpush-job-details

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

job, err := api.GetZoneLogpushJob(context.Background(), zoneID, 1)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", job)
Output:

func (*API) GetZoneLogpushOwnershipChallenge added in v0.29.3

func (api *API) GetZoneLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf string) (*LogpushGetOwnershipChallenge, error)

GetZoneLogpushOwnershipChallenge returns ownership challenge.

API reference: https://api.cloudflare.com/#logpush-jobs-get-ownership-challenge

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

ownershipChallenge, err := api.GetZoneLogpushOwnershipChallenge(context.Background(), zoneID, "destination_conf")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", ownershipChallenge)
Output:

func (*API) GetZoneRuleset added in v0.29.3

func (api *API) GetZoneRuleset(ctx context.Context, zoneID, rulesetID string) (Ruleset, error)

GetZoneRuleset fetches a single ruleset for a zone.

API reference: https://api.cloudflare.com/#zone-rulesets-get-a-zone-ruleset

func (*API) GetZoneRulesetPhase added in v0.29.3

func (api *API) GetZoneRulesetPhase(ctx context.Context, zoneID, rulesetPhase string) (Ruleset, error)

GetZoneRulesetPhase returns a ruleset phase for a zone.

API reference: TBA

func (*API) Healthcheck added in v0.29.3

func (api *API) Healthcheck(ctx context.Context, zoneID, healthcheckID string) (Healthcheck, error)

Healthcheck returns a single healthcheck by ID.

API reference: https://api.cloudflare.com/#health-checks-health-check-details

func (*API) HealthcheckPreview added in v0.29.3

func (api *API) HealthcheckPreview(ctx context.Context, zoneID, id string) (Healthcheck, error)

HealthcheckPreview returns a single healthcheck preview by its ID.

API reference: https://api.cloudflare.com/#health-checks-health-check-preview-details

func (*API) Healthchecks added in v0.29.3

func (api *API) Healthchecks(ctx context.Context, zoneID string) ([]Healthcheck, error)

Healthchecks returns all healthchecks for a zone.

API reference: https://api.cloudflare.com/#health-checks-list-health-checks

func (*API) KeylessSSL added in v0.29.3

func (api *API) KeylessSSL(ctx context.Context, zoneID, keylessSSLID string) (KeylessSSL, error)

KeylessSSL provides the configuration for a given Keyless SSL identifier.

API reference: https://api.cloudflare.com/#keyless-ssl-for-a-zone-keyless-ssl-details

func (*API) ListAPITokensPermissionGroups added in v0.29.3

func (api *API) ListAPITokensPermissionGroups(ctx context.Context) ([]APITokenPermissionGroups, error)

ListAPITokensPermissionGroups returns all available API token permission groups.

API reference: https://api.cloudflare.com/#permission-groups-list-permission-groups

func (*API) ListAccountAccessRules added in v0.29.3

func (api *API) ListAccountAccessRules(ctx context.Context, accountID string, accessRule AccessRule, page int) (*AccessRuleListResponse, error)

ListAccountAccessRules returns a slice of access rules for the given account identifier.

This takes an AccessRule to allow filtering of the results returned.

API reference: https://api.cloudflare.com/#account-level-firewall-access-rule-list-access-rules

func (*API) ListAccountLogpushJobs added in v0.29.3

func (api *API) ListAccountLogpushJobs(ctx context.Context, accountID string) ([]LogpushJob, error)

ListAccountLogpushJobs returns all account-level Logpush Jobs for all datasets.

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs

func (*API) ListAccountLogpushJobsForDataset added in v0.29.3

func (api *API) ListAccountLogpushJobsForDataset(ctx context.Context, accountID, dataset string) ([]LogpushJob, error)

ListAccountLogpushJobsForDataset returns all account-level Logpush Jobs for a dataset.

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs-for-a-dataset

func (*API) ListAccountRulesets added in v0.29.3

func (api *API) ListAccountRulesets(ctx context.Context, accountID string) ([]Ruleset, error)

ListAccountRulesets fetches all rulesets for an account.

API reference: https://api.cloudflare.com/#account-rulesets-list-account-rulesets

func (*API) ListAllRateLimits added in v0.8.5

func (api *API) ListAllRateLimits(ctx context.Context, zoneID string) ([]RateLimit, error)

ListAllRateLimits returns all Rate Limits for a zone.

API reference: https://api.cloudflare.com/#rate-limits-for-a-zone-list-rate-limits

func (*API) ListCertificatePacks added in v0.29.3

func (api *API) ListCertificatePacks(ctx context.Context, zoneID string) ([]CertificatePack, error)

ListCertificatePacks returns all available TLS certificate packs for a zone.

API Reference: https://api.cloudflare.com/#certificate-packs-list-certificate-packs

func (*API) ListDNSFirewallClusters added in v0.29.3

func (api *API) ListDNSFirewallClusters(ctx context.Context) ([]*DNSFirewallCluster, error)

ListDNSFirewallClusters lists the DNS Firewall clusters associated with an account.

API reference: https://api.cloudflare.com/#dns-firewall-list-dns-firewall-clusters

func (*API) ListFallbackDomains added in v0.29.3

func (api *API) ListFallbackDomains(ctx context.Context, accountID string) ([]FallbackDomain, error)

ListFallbackDomains returns all fallback domains within an account.

API reference: https://api.cloudflare.com/#devices-get-local-domain-fallback-list

func (*API) ListIPListItems added in v0.29.3

func (api *API) ListIPListItems(ctx context.Context, id string) ([]IPListItem, error)

ListIPListItems returns a list with all items in an IP List

API reference: https://api.cloudflare.com/#rules-lists-list-list-items

func (*API) ListIPLists added in v0.29.3

func (api *API) ListIPLists(ctx context.Context) ([]IPList, error)

ListIPLists lists all IP Lists

API reference: https://api.cloudflare.com/#rules-lists-list-lists

func (*API) ListKeylessSSL added in v0.29.3

func (api *API) ListKeylessSSL(ctx context.Context, zoneID string) ([]KeylessSSL, error)

ListKeylessSSL lists Keyless SSL configurations for a zone.

API reference: https://api.cloudflare.com/#keyless-ssl-for-a-zone-list-keyless-ssl-configurations

func (*API) ListLoadBalancerMonitors added in v0.8.0

func (api *API) ListLoadBalancerMonitors(ctx context.Context) ([]LoadBalancerMonitor, error)

ListLoadBalancerMonitors lists load balancer monitors connected to an account.

API reference: https://api.cloudflare.com/#load-balancer-monitors-list-monitors

func (*API) ListLoadBalancerPools added in v0.8.0

func (api *API) ListLoadBalancerPools(ctx context.Context) ([]LoadBalancerPool, error)

ListLoadBalancerPools lists load balancer pools connected to an account.

API reference: https://api.cloudflare.com/#load-balancer-pools-list-pools

func (*API) ListLoadBalancers added in v0.8.0

func (api *API) ListLoadBalancers(ctx context.Context, zoneID string) ([]LoadBalancer, error)

ListLoadBalancers lists load balancers configured on a zone.

API reference: https://api.cloudflare.com/#load-balancers-list-load-balancers

Example
package main

import (
	context "context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	// Construct a new API object.
	api, err := cloudflare.New("deadbeef", "test@example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch the zone ID.
	id, err := api.ZoneIDByName("example.com") // Assuming example.com exists in your Cloudflare account
	if err != nil {
		log.Fatal(err)
	}

	// List LBs configured in zone.
	lbList, err := api.ListLoadBalancers(context.Background(), id)
	if err != nil {
		log.Fatal(err)
	}

	for _, lb := range lbList {
		fmt.Println(lb)
	}
}
Output:

func (*API) ListMagicFirewallRulesets added in v0.29.3

func (api *API) ListMagicFirewallRulesets(ctx context.Context) ([]MagicFirewallRuleset, error)

ListMagicFirewallRulesets lists all Rulesets for a given account

API reference: https://api.cloudflare.com/#rulesets-list-rulesets

func (*API) ListMagicTransitStaticRoutes added in v0.29.3

func (api *API) ListMagicTransitStaticRoutes(ctx context.Context) ([]MagicTransitStaticRoute, error)

ListMagicTransitStaticRoutes lists all static routes for a given account

API reference: https://api.cloudflare.com/#magic-transit-static-routes-list-routes

func (*API) ListNotificationHistory added in v0.29.3

func (api *API) ListNotificationHistory(ctx context.Context, accountID string, pageOpts PaginationOptions) ([]NotificationHistory, ResultInfo, error)

ListNotificationHistory will return the history of alerts sent for a given account. The time period varies based on zone plan. Free, Biz, Pro = 30 days Ent = 90 days

API Reference: https://api.cloudflare.com/#notification-history-list-history

func (*API) ListNotificationPolicies added in v0.29.3

func (api *API) ListNotificationPolicies(ctx context.Context, accountID string) (NotificationPoliciesResponse, error)

ListNotificationPolicies will return the notification policies created by a user for a specific account.

API Reference: https://api.cloudflare.com/#notification-policies-properties

func (*API) ListNotificationWebhooks added in v0.29.3

func (api *API) ListNotificationWebhooks(ctx context.Context, accountID string) (NotificationWebhooksResponse, error)

ListNotificationWebhooks will return the webhook destinations configured for an account.

API Reference: https://api.cloudflare.com/#notification-webhooks-list-webhooks

func (*API) ListPageRules

func (api *API) ListPageRules(ctx context.Context, zoneID string) ([]PageRule, error)

ListPageRules returns all Page Rules for a zone.

API reference: https://api.cloudflare.com/#page-rules-for-a-zone-list-page-rules

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

pageRules, err := api.ListPageRules(context.Background(), zoneID)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", pageRules)
for _, r := range pageRules {
	fmt.Printf("%+v\n", r)
}
Output:

func (*API) ListPagerDutyNotificationDestinations added in v0.29.3

func (api *API) ListPagerDutyNotificationDestinations(ctx context.Context, accountID string) (NotificationPagerDutyResponse, error)

ListPagerDutyNotificationDestinations will return the pagerduty destinations configured for an account.

API Reference: https://api.cloudflare.com/#notification-destinations-with-pagerduty-list-pagerduty-services

func (*API) ListPagesProjects added in v0.29.3

func (api *API) ListPagesProjects(ctx context.Context, accountID string, pageOpts PaginationOptions) ([]PagesProject, ResultInfo, error)

ListPagesProjects returns all Pages projects for an account.

API reference: https://api.cloudflare.com/#pages-project-get-projects

func (*API) ListPerHostnameAuthenticatedOriginPullsCertificates added in v0.29.3

func (api *API) ListPerHostnameAuthenticatedOriginPullsCertificates(ctx context.Context, zoneID string) ([]PerHostnameAuthenticatedOriginPullsDetails, error)

ListPerHostnameAuthenticatedOriginPullsCertificates will get all certificate under Per Hostname AuthenticatedOriginPulls zone.

API reference: https://api.cloudflare.com/#per-hostname-authenticated-origin-pull-list-certificates

func (*API) ListPerZoneAuthenticatedOriginPullsCertificates added in v0.29.3

func (api *API) ListPerZoneAuthenticatedOriginPullsCertificates(ctx context.Context, zoneID string) ([]PerZoneAuthenticatedOriginPullsCertificateDetails, error)

ListPerZoneAuthenticatedOriginPullsCertificates returns a list of all user uploaded client certificates to Per Zone AuthenticatedOriginPulls.

API reference: https://api.cloudflare.com/#zone-level-authenticated-origin-pulls-list-certificates

func (*API) ListPrefixes added in v0.29.3

func (api *API) ListPrefixes(ctx context.Context) ([]IPPrefix, error)

ListPrefixes lists all IP prefixes for a given account

API reference: https://api.cloudflare.com/#ip-address-management-prefixes-list-prefixes

func (*API) ListRailguns

func (api *API) ListRailguns(ctx context.Context, options RailgunListOptions) ([]Railgun, error)

ListRailguns lists Railguns connected to an account.

API reference: https://api.cloudflare.com/#railgun-list-railguns

func (*API) ListRateLimits added in v0.8.5

func (api *API) ListRateLimits(ctx context.Context, zoneID string, pageOpts PaginationOptions) ([]RateLimit, ResultInfo, error)

ListRateLimits returns Rate Limits for a zone, paginated according to the provided options

API reference: https://api.cloudflare.com/#rate-limits-for-a-zone-list-rate-limits

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

pageOpts := cloudflare.PaginationOptions{
	PerPage: 5,
	Page:    1,
}
rateLimits, _, err := api.ListRateLimits(context.Background(), zoneID, pageOpts)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", rateLimits)
for _, r := range rateLimits {
	fmt.Printf("%+v\n", r)
}
Output:

func (*API) ListSSL

func (api *API) ListSSL(ctx context.Context, zoneID string) ([]ZoneCustomSSL, error)

ListSSL lists the custom certificates for the given zone.

API reference: https://api.cloudflare.com/#custom-ssl-for-a-zone-list-ssl-configurations

func (*API) ListSecondaryDNSPrimaries added in v0.29.3

func (api *API) ListSecondaryDNSPrimaries(ctx context.Context, accountID string) ([]SecondaryDNSPrimary, error)

ListSecondaryDNSPrimaries returns all secondary DNS primaries for an account.

API reference: https://api.cloudflare.com/#secondary-dns-primary--list-primaries

func (*API) ListSecondaryDNSTSIGs added in v0.29.3

func (api *API) ListSecondaryDNSTSIGs(ctx context.Context, accountID string) ([]SecondaryDNSTSIG, error)

ListSecondaryDNSTSIGs gets all account level TSIG for a secondary DNS configuration.

API reference: https://api.cloudflare.com/#secondary-dns-tsig--list-tsigs

func (*API) ListSplitTunnels added in v0.29.3

func (api *API) ListSplitTunnels(ctx context.Context, accountID string, mode string) ([]SplitTunnel, error)

ListSplitTunnel returns all include or exclude split tunnel within an account.

API reference for include: https://api.cloudflare.com/#device-policy-get-split-tunnel-include-list API reference for exclude: https://api.cloudflare.com/#device-policy-get-split-tunnel-exclude-list

func (*API) ListUserAccessRules added in v0.8.1

func (api *API) ListUserAccessRules(ctx context.Context, accessRule AccessRule, page int) (*AccessRuleListResponse, error)

ListUserAccessRules returns a slice of access rules for the logged-in user.

This takes an AccessRule to allow filtering of the results returned.

API reference: https://api.cloudflare.com/#user-level-firewall-access-rule-list-access-rules

func (*API) ListUserAgentRules added in v0.8.0

func (api *API) ListUserAgentRules(ctx context.Context, zoneID string, page int) (*UserAgentRuleListResponse, error)

ListUserAgentRules retrieves a list of User-Agent Block rules for a given zone ID by page number.

API reference: https://api.cloudflare.com/#user-agent-blocking-rules-list-useragent-rules

Example (All)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch all Zone Lockdown rules for a zone, by page.
	rules, err := api.ListUserAgentRules(context.Background(), zoneID, 1)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range rules.Result {
		fmt.Printf("%s: %s\n", r.Configuration.Target, r.Configuration.Value)
	}
}
Output:

func (*API) ListVirtualDNS deprecated

func (api *API) ListVirtualDNS(ctx context.Context) ([]*VirtualDNS, error)

ListVirtualDNS lists the virtual DNS clusters associated with an account.

Deprecated: Use ListDNSFirewallClusters instead.

func (*API) ListWAFGroups added in v0.29.3

func (api *API) ListWAFGroups(ctx context.Context, zoneID, packageID string) ([]WAFGroup, error)

ListWAFGroups returns a slice of the WAF groups for the given WAF package.

API Reference: https://api.cloudflare.com/#waf-rule-groups-list-rule-groups

func (*API) ListWAFOverrides added in v0.29.3

func (api *API) ListWAFOverrides(ctx context.Context, zoneID string) ([]WAFOverride, error)

ListWAFOverrides returns a slice of the WAF overrides.

API Reference: https://api.cloudflare.com/#waf-overrides-list-uri-controlled-waf-configurations

func (*API) ListWAFPackages

func (api *API) ListWAFPackages(ctx context.Context, zoneID string) ([]WAFPackage, error)

ListWAFPackages returns a slice of the WAF packages for the given zone.

API Reference: https://api.cloudflare.com/#waf-rule-packages-list-firewall-packages

func (*API) ListWAFRules

func (api *API) ListWAFRules(ctx context.Context, zoneID, packageID string) ([]WAFRule, error)

ListWAFRules returns a slice of the WAF rules for the given WAF package.

API Reference: https://api.cloudflare.com/#waf-rules-list-rules

func (*API) ListWaitingRooms added in v0.29.3

func (api *API) ListWaitingRooms(ctx context.Context, zoneID string) ([]WaitingRoom, error)

ListWaitingRooms returns all Waiting Room for a zone.

API reference: https://api.cloudflare.com/#waiting-room-list-waiting-rooms

func (*API) ListWorkerBindings added in v0.29.3

func (api *API) ListWorkerBindings(ctx context.Context, requestParams *WorkerRequestParams) (WorkerBindingListResponse, error)

ListWorkerBindings returns all the bindings for a particular worker

func (*API) ListWorkerCronTriggers added in v0.29.3

func (api *API) ListWorkerCronTriggers(ctx context.Context, scriptName string) ([]WorkerCronTrigger, error)

ListWorkerCronTriggers fetches all available cron triggers for a single Worker script.

API reference: https://api.cloudflare.com/#worker-cron-trigger-get-cron-triggers

func (*API) ListWorkerRoutes added in v0.29.3

func (api *API) ListWorkerRoutes(ctx context.Context, zoneID string) (WorkerRoutesResponse, error)

ListWorkerRoutes returns list of worker routes

API reference: https://api.cloudflare.com/#worker-filters-list-filters, https://api.cloudflare.com/#worker-routes-list-routes

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}
res, err := api.ListWorkerRoutes(context.Background(), zoneID)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res)
Output:

func (*API) ListWorkerScripts added in v0.29.3

func (api *API) ListWorkerScripts(ctx context.Context) (WorkerListResponse, error)

ListWorkerScripts returns list of worker scripts for given account.

API reference: https://developers.cloudflare.com/workers/tooling/api/scripts/

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount("foo"))
if err != nil {
	log.Fatal(err)
}

res, err := api.ListWorkerScripts(context.Background())
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res.WorkerList)
Output:

func (*API) ListWorkersKVNamespaces added in v0.29.3

func (api *API) ListWorkersKVNamespaces(ctx context.Context) ([]WorkersKVNamespace, error)

ListWorkersKVNamespaces lists storage namespaces

API reference: https://api.cloudflare.com/#workers-kv-namespace-list-namespaces

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

lsr, err := api.ListWorkersKVNamespaces(context.Background())
if err != nil {
	log.Fatal(err)
}

fmt.Println(lsr)
Output:

func (API) ListWorkersKVs added in v0.29.3

func (api API) ListWorkersKVs(ctx context.Context, namespaceID string) (ListStorageKeysResponse, error)

ListWorkersKVs lists a namespace's keys

API Reference: https://api.cloudflare.com/#workers-kv-namespace-list-a-namespace-s-keys

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

resp, err := api.ListWorkersKVs(context.Background(), namespace)
if err != nil {
	log.Fatal(err)
}

fmt.Println(resp)
Output:

func (API) ListWorkersKVsWithOptions added in v0.29.3

func (api API) ListWorkersKVsWithOptions(ctx context.Context, namespaceID string, o ListWorkersKVsOptions) (ListStorageKeysResponse, error)

ListWorkersKVsWithOptions lists a namespace's keys with optional parameters

API Reference: https://api.cloudflare.com/#workers-kv-namespace-list-a-namespace-s-keys

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

limit := 50
prefix := "my-prefix"
cursor := "AArAbNSOuYcr4HmzGH02-cfDN8Ck9ejOwkn_Ai5rsn7S9NEqVJBenU9-gYRlrsziyjKLx48hNDLvtYzBAmkPsLGdye8ECr5PqFYcIOfUITdhkyTc1x6bV8nmyjz5DO-XaZH4kYY1KfqT8NRBIe5sic6yYt3FUDttGjafy0ivi-Up-TkVdRB0OxCf3O3OB-svG6DXheV5XTdDNrNx1o_CVqy2l2j0F4iKV1qFe_KhdkjC7Y6QjhUZ1MOb3J_uznNYVCoxZ-bVAAsJmXA"

options := cloudflare.ListWorkersKVsOptions{
	Limit:  &limit,
	Prefix: &prefix,
	Cursor: &cursor,
}

resp, err := api.ListWorkersKVsWithOptions(context.Background(), namespace, options)
if err != nil {
	log.Fatal(err)
}

fmt.Println(resp)
Output:

func (*API) ListWorkersSecrets added in v0.29.3

func (api *API) ListWorkersSecrets(ctx context.Context, script string) (WorkersListSecretsResponse, error)

ListWorkersSecrets lists secrets for a given worker API reference: https://api.cloudflare.com/

func (*API) ListZoneAccessRules added in v0.8.1

func (api *API) ListZoneAccessRules(ctx context.Context, zoneID string, accessRule AccessRule, page int) (*AccessRuleListResponse, error)

ListZoneAccessRules returns a slice of access rules for the given zone identifier.

This takes an AccessRule to allow filtering of the results returned.

API reference: https://api.cloudflare.com/#firewall-access-rule-for-a-zone-list-access-rules

Example (All)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch all access rules for a zone
	response, err := api.ListZoneAccessRules(context.Background(), zoneID, cloudflare.AccessRule{}, 1)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range response.Result {
		fmt.Printf("%s: %s\n", r.Configuration.Value, r.Mode)
	}
}
Output:

Example (FilterByIP)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch only access rules whose target is 127.0.0.1
	localhost := cloudflare.AccessRule{
		Configuration: cloudflare.AccessRuleConfiguration{Target: "127.0.0.1"},
	}
	response, err := api.ListZoneAccessRules(context.Background(), zoneID, localhost, 1)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range response.Result {
		fmt.Printf("%s: %s\n", r.Configuration.Value, r.Mode)
	}
}
Output:

Example (FilterByMode)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch access rules with an action of "block"
	foo := cloudflare.AccessRule{
		Mode: "block",
	}
	response, err := api.ListZoneAccessRules(context.Background(), zoneID, foo, 1)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range response.Result {
		fmt.Printf("%s: %s\n", r.Configuration.Value, r.Mode)
	}
}
Output:

Example (FilterByNote)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch only access rules with notes containing "example"
	foo := cloudflare.AccessRule{
		Notes: "example",
	}
	response, err := api.ListZoneAccessRules(context.Background(), zoneID, foo, 1)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range response.Result {
		fmt.Printf("%s: %s\n", r.Configuration.Value, r.Mode)
	}
}
Output:

func (*API) ListZoneLockdowns added in v0.8.0

func (api *API) ListZoneLockdowns(ctx context.Context, zoneID string, page int) (*ZoneLockdownListResponse, error)

ListZoneLockdowns retrieves a list of Zone ZoneLockdown rules for a given zone ID by page number.

API reference: https://api.cloudflare.com/#zone-ZoneLockdown-list-ZoneLockdown-rules

Example (All)
package main

import (
	"context"
	"fmt"
	"log"
	"strings"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	zoneID, err := api.ZoneIDByName("example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch all Zone Lockdown rules for a zone, by page.
	rules, err := api.ListZoneLockdowns(context.Background(), zoneID, 1)
	if err != nil {
		log.Fatal(err)
	}

	for _, r := range rules.Result {
		fmt.Printf("%s: %s\n", strings.Join(r.URLs, ", "), r.Configurations)
	}
}
Output:

func (*API) ListZoneLogpushJobs added in v0.29.3

func (api *API) ListZoneLogpushJobs(ctx context.Context, zoneID string) ([]LogpushJob, error)

ListZoneLogpushJobs returns all zone-level Logpush Jobs for all datasets.

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

jobs, err := api.ListZoneLogpushJobs(context.Background(), zoneID)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", jobs)
for _, r := range jobs {
	fmt.Printf("%+v\n", r)
}
Output:

func (*API) ListZoneLogpushJobsForDataset added in v0.29.3

func (api *API) ListZoneLogpushJobsForDataset(ctx context.Context, zoneID, dataset string) ([]LogpushJob, error)

ListZoneLogpushJobsForDataset returns all zone-level Logpush Jobs for a dataset.

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs-for-a-dataset

func (*API) ListZoneRulesets added in v0.29.3

func (api *API) ListZoneRulesets(ctx context.Context, zoneID string) ([]Ruleset, error)

ListZoneRulesets fetches all rulesets for a zone.

API reference: https://api.cloudflare.com/#zone-rulesets-list-zone-rulesets

func (*API) ListZones

func (api *API) ListZones(ctx context.Context, z ...string) ([]Zone, error)

ListZones lists zones on an account. Optionally takes a list of zone names to filter against.

API reference: https://api.cloudflare.com/#zone-list-zones

Example (All)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch all zones available to this user.
	zones, err := api.ListZones(context.Background())
	if err != nil {
		log.Fatal(err)
	}

	for _, z := range zones {
		fmt.Println(z.Name)
	}
}
Output:

Example (Filter)
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch a slice of zones example.org and example.net.
	zones, err := api.ListZones(context.Background(), "example.org", "example.net")
	if err != nil {
		log.Fatal(err)
	}

	for _, z := range zones {
		fmt.Println(z.Name)
	}
}
Output:

func (*API) ListZonesContext added in v0.29.3

func (api *API) ListZonesContext(ctx context.Context, opts ...ReqOption) (r ZonesResponse, err error)

ListZonesContext lists all zones on an account automatically handling the pagination. Optionally takes a list of ReqOptions.

func (*API) LoadBalancerDetails added in v0.8.0

func (api *API) LoadBalancerDetails(ctx context.Context, zoneID, lbID string) (LoadBalancer, error)

LoadBalancerDetails returns the details for a load balancer.

API reference: https://api.cloudflare.com/#load-balancers-load-balancer-details

func (*API) LoadBalancerMonitorDetails added in v0.8.0

func (api *API) LoadBalancerMonitorDetails(ctx context.Context, monitorID string) (LoadBalancerMonitor, error)

LoadBalancerMonitorDetails returns the details for a load balancer monitor.

API reference: https://api.cloudflare.com/#load-balancer-monitors-monitor-details

func (*API) LoadBalancerPoolDetails added in v0.8.0

func (api *API) LoadBalancerPoolDetails(ctx context.Context, poolID string) (LoadBalancerPool, error)

LoadBalancerPoolDetails returns the details for a load balancer pool.

API reference: https://api.cloudflare.com/#load-balancer-pools-pool-details

func (*API) LogpushFields deprecated added in v0.29.3

func (api *API) LogpushFields(ctx context.Context, zoneID, dataset string) (LogpushFields, error)

LogpushFields returns fields for a given dataset.

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs

Deprecated: Use `GetZoneLogpushFields` or `GetAccountLogpushFields` depending on the desired resource to target.

func (*API) LogpushJob deprecated added in v0.29.3

func (api *API) LogpushJob(ctx context.Context, zoneID string, jobID int) (LogpushJob, error)

LogpushJob fetches detail about one Logpush Job for a zone.

API reference: https://api.cloudflare.com/#logpush-jobs-logpush-job-details

Deprecated: Use `GetZoneLogpushJob` or `GetAccountLogpushJob` depending on the desired resource to target.

func (*API) LogpushJobs deprecated added in v0.29.3

func (api *API) LogpushJobs(ctx context.Context, zoneID string) ([]LogpushJob, error)

LogpushJobs returns all zone-level Logpush Jobs for all datasets.

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs

Deprecated: Use `ListZoneLogpushJobs` or `ListAccountLogpushJobs` depending on the desired resource to target.

func (*API) LogpushJobsForDataset deprecated added in v0.29.3

func (api *API) LogpushJobsForDataset(ctx context.Context, zoneID, dataset string) ([]LogpushJob, error)

LogpushJobsForDataset returns all zone-level Logpush Jobs for a dataset.

API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs-for-a-dataset

Deprecated: Use `ListZoneLogpushJobsForDataset` or `ListAccountLogpushJobsForDataset` depending on the desired resource to target.

func (*API) ModifyLoadBalancer added in v0.8.0

func (api *API) ModifyLoadBalancer(ctx context.Context, zoneID string, lb LoadBalancer) (LoadBalancer, error)

ModifyLoadBalancer modifies a configured load balancer.

API reference: https://api.cloudflare.com/#load-balancers-update-load-balancer

func (*API) ModifyLoadBalancerMonitor added in v0.8.0

func (api *API) ModifyLoadBalancerMonitor(ctx context.Context, monitor LoadBalancerMonitor) (LoadBalancerMonitor, error)

ModifyLoadBalancerMonitor modifies a configured load balancer monitor.

API reference: https://api.cloudflare.com/#load-balancer-monitors-update-monitor

func (*API) ModifyLoadBalancerPool added in v0.8.0

func (api *API) ModifyLoadBalancerPool(ctx context.Context, pool LoadBalancerPool) (LoadBalancerPool, error)

ModifyLoadBalancerPool modifies a configured load balancer pool.

API reference: https://api.cloudflare.com/#load-balancer-pools-update-pool

func (*API) OriginCertificate added in v0.7.4

func (api *API) OriginCertificate(ctx context.Context, certificateID string) (*OriginCACertificate, error)

OriginCertificate returns the details for a Cloudflare-issued certificate.

This function requires api.APIUserServiceKey be set to your Certificates API key.

API reference: https://api.cloudflare.com/#cloudflare-ca-certificate-details

func (*API) OriginCertificates added in v0.7.4

func (api *API) OriginCertificates(ctx context.Context, options OriginCACertificateListOptions) ([]OriginCACertificate, error)

OriginCertificates lists all Cloudflare-issued certificates.

This function requires api.APIUserServiceKey be set to your Certificates API key.

API reference: https://api.cloudflare.com/#cloudflare-ca-list-certificates

func (*API) PageRule

func (api *API) PageRule(ctx context.Context, zoneID, ruleID string) (PageRule, error)

PageRule fetches detail about one Page Rule for a zone.

API reference: https://api.cloudflare.com/#page-rules-for-a-zone-page-rule-details

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

pageRules, err := api.PageRule(context.Background(), zoneID, "my_page_rule_id")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", pageRules)
Output:

func (*API) PagesProject added in v0.29.3

func (api *API) PagesProject(ctx context.Context, accountID, projectName string) (PagesProject, error)

PagesProject returns a single Pages project by name.

API reference: https://api.cloudflare.com/#pages-project-get-project

func (*API) PatchTeamsList added in v0.29.3

func (api *API) PatchTeamsList(ctx context.Context, accountID string, listPatch PatchTeamsList) (TeamsList, error)

PatchTeamsList updates the items in an existing teams list.

API reference: https://api.cloudflare.com/#teams-lists-patch-teams-list

func (*API) PerformTraceroute added in v0.29.3

func (api *API) PerformTraceroute(ctx context.Context, accountID string, targets, colos []string, tracerouteOptions DiagnosticsTracerouteConfigurationOptions) ([]DiagnosticsTracerouteResponseResult, error)

PerformTraceroute initiates a traceroute from the Cloudflare network to the requested targets.

API documentation: https://api.cloudflare.com/#diagnostics-traceroute

func (*API) PoolHealthDetails added in v0.29.3

func (api *API) PoolHealthDetails(ctx context.Context, poolID string) (LoadBalancerPoolHealth, error)

PoolHealthDetails fetches the latest healtcheck details for a single pool.

API reference: https://api.cloudflare.com/#load-balancer-pools-pool-health-details

Example
package main

import (
	context "context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	// Construct a new API object.
	api, err := cloudflare.New("deadbeef", "test@example.com")
	if err != nil {
		log.Fatal(err)
	}

	// Fetch pool health details.
	healthInfo, err := api.PoolHealthDetails(context.Background(), "example-pool-id")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(healthInfo)
}
Output:

func (*API) PurgeCache

func (api *API) PurgeCache(ctx context.Context, zoneID string, pcr PurgeCacheRequest) (PurgeCacheResponse, error)

PurgeCache purges the cache using the given PurgeCacheRequest (zone/url/tag).

API reference: https://api.cloudflare.com/#zone-purge-individual-files-by-url-and-cache-tags

func (*API) PurgeCacheContext added in v0.29.3

func (api *API) PurgeCacheContext(ctx context.Context, zoneID string, pcr PurgeCacheRequest) (PurgeCacheResponse, error)

PurgeCacheContext purges the cache using the given PurgeCacheRequest (zone/url/tag).

API reference: https://api.cloudflare.com/#zone-purge-individual-files-by-url-and-cache-tags

func (*API) PurgeEverything

func (api *API) PurgeEverything(ctx context.Context, zoneID string) (PurgeCacheResponse, error)

PurgeEverything purges the cache for the given zone.

Note: this will substantially increase load on the origin server for that zone if there is a high cached vs. uncached request ratio.

API reference: https://api.cloudflare.com/#zone-purge-all-files

func (*API) RailgunDetails

func (api *API) RailgunDetails(ctx context.Context, railgunID string) (Railgun, error)

RailgunDetails returns the details for a Railgun.

API reference: https://api.cloudflare.com/#railgun-railgun-details

func (*API) RailgunZones

func (api *API) RailgunZones(ctx context.Context, railgunID string) ([]Zone, error)

RailgunZones returns the zones that are currently using a Railgun.

API reference: https://api.cloudflare.com/#railgun-get-zones-connected-to-a-railgun

func (*API) RateLimit added in v0.8.5

func (api *API) RateLimit(ctx context.Context, zoneID, limitID string) (RateLimit, error)

RateLimit fetches detail about one Rate Limit for a zone.

API reference: https://api.cloudflare.com/#rate-limits-for-a-zone-rate-limit-details

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

rateLimits, err := api.RateLimit(context.Background(), zoneID, "my_rate_limit_id")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", rateLimits)
Output:

func (*API) Raw added in v0.8.0

func (api *API) Raw(method, endpoint string, data interface{}) (json.RawMessage, error)

Raw makes a HTTP request with user provided params and returns the result as untouched JSON.

func (API) ReadWorkersKV added in v0.29.3

func (api API) ReadWorkersKV(ctx context.Context, namespaceID, key string) ([]byte, error)

ReadWorkersKV returns the value associated with the given key in the given namespace

API reference: https://api.cloudflare.com/#workers-kv-namespace-read-key-value-pair

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

key := "test_key"
resp, err := api.ReadWorkersKV(context.Background(), namespace, key)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%s\n", resp)
Output:

func (*API) RegistrarDomain added in v0.29.3

func (api *API) RegistrarDomain(ctx context.Context, accountID, domainName string) (RegistrarDomain, error)

RegistrarDomain returns a single domain based on the account ID and domain name.

API reference: https://api.cloudflare.com/#registrar-domains-get-domain

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

domain, err := api.RegistrarDomain(context.Background(), "01a7362d577a6c3019a474fd6f485823", "cloudflare.com")
if err != nil {
	log.Fatal(err)
}
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", domain)
Output:

func (*API) RegistrarDomains added in v0.29.3

func (api *API) RegistrarDomains(ctx context.Context, accountID string) ([]RegistrarDomain, error)

RegistrarDomains returns all registrar domains based on the account ID.

API reference: https://api.cloudflare.com/#registrar-domains-list-domains

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

domains, err := api.RegistrarDomains(context.Background(), "01a7362d577a6c3019a474fd6f485823")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", domains)
Output:

func (*API) ReplaceIPListItems added in v0.29.3

func (api *API) ReplaceIPListItems(ctx context.Context, id string, items []IPListItemCreateRequest) (
	[]IPListItem, error)

ReplaceIPListItems replaces all IP List Items synchronously and returns the current set of IP List Items

func (*API) ReplaceIPListItemsAsync added in v0.29.3

func (api *API) ReplaceIPListItemsAsync(ctx context.Context, id string, items []IPListItemCreateRequest) (
	IPListItemCreateResponse, error)

ReplaceIPListItemsAsync replaces all IP List Items asynchronously. Users have to poll the operation status by using the operation_id returned by this function.

API reference: https://api.cloudflare.com/#rules-lists-replace-list-items

func (*API) ReprioritizeSSL

func (api *API) ReprioritizeSSL(ctx context.Context, zoneID string, p []ZoneCustomSSLPriority) ([]ZoneCustomSSL, error)

ReprioritizeSSL allows you to change the priority (which is served for a given request) of custom SSL certificates associated with the given zone.

API reference: https://api.cloudflare.com/#custom-ssl-for-a-zone-re-prioritize-ssl-certificates

func (*API) RestartAdvancedCertificateValidation added in v0.29.3

func (api *API) RestartAdvancedCertificateValidation(ctx context.Context, zoneID, certificateID string) (CertificatePackAdvancedCertificate, error)

RestartAdvancedCertificateValidation kicks off the validation process for a pending certificate pack.

API Reference: https://api.cloudflare.com/#certificate-packs-restart-validation-for-advanced-certificate-manager-certificate-pack

func (*API) RevokeAccessApplicationTokens added in v0.29.3

func (api *API) RevokeAccessApplicationTokens(ctx context.Context, accountID, applicationID string) error

RevokeAccessApplicationTokens revokes tokens associated with an access application.

API reference: https://api.cloudflare.com/#access-applications-revoke-access-tokens

func (*API) RevokeOriginCertificate added in v0.7.4

func (api *API) RevokeOriginCertificate(ctx context.Context, certificateID string) (*OriginCACertificateID, error)

RevokeOriginCertificate revokes a created certificate for a zone.

This function requires api.APIUserServiceKey be set to your Certificates API key.

API reference: https://api.cloudflare.com/#cloudflare-ca-revoke-certificate

func (*API) RevokeZoneLevelAccessApplicationTokens added in v0.29.3

func (api *API) RevokeZoneLevelAccessApplicationTokens(ctx context.Context, zoneID, applicationID string) error

RevokeZoneLevelAccessApplicationTokens revokes tokens associated with a zone level access application.

API reference: https://api.cloudflare.com/#zone-level-access-applications-revoke-access-tokens

func (*API) RollAPIToken added in v0.29.3

func (api *API) RollAPIToken(ctx context.Context, tokenID string) (string, error)

RollAPIToken rolls the credential associated with the token.

API reference: https://api.cloudflare.com/#user-api-tokens-roll-token

func (*API) RotateAccessKeys added in v0.29.3

func (api *API) RotateAccessKeys(ctx context.Context, accountID string) (AccessKeysConfig, error)

RotateAccessKeys rotates the Access Keys for an account and returns the updated Access Keys Configuration

API reference: https://api.cloudflare.com/#access-keys-configuration-rotate-access-keys

func (*API) SSLDetails

func (api *API) SSLDetails(ctx context.Context, zoneID, certificateID string) (ZoneCustomSSL, error)

SSLDetails returns the configuration details for a custom SSL certificate.

API reference: https://api.cloudflare.com/#custom-ssl-for-a-zone-ssl-configuration-details

func (*API) SetAuthType added in v0.7.4

func (api *API) SetAuthType(authType int)

SetAuthType sets the authentication method (AuthKeyEmail, AuthToken, or AuthUserService).

func (*API) SetAuthenticatedOriginPullsStatus added in v0.29.3

func (api *API) SetAuthenticatedOriginPullsStatus(ctx context.Context, zoneID string, enable bool) (AuthenticatedOriginPulls, error)

SetAuthenticatedOriginPullsStatus toggles whether global AuthenticatedOriginPulls is enabled for the zone.

API reference: https://api.cloudflare.com/#zone-settings-change-tls-client-auth-setting

func (*API) SetLogpullRetentionFlag added in v0.29.3

func (api *API) SetLogpullRetentionFlag(ctx context.Context, zoneID string, enabled bool) (*LogpullRetentionConfiguration, error)

SetLogpullRetentionFlag updates the retention flag to the defined boolean.

API reference: https://developers.cloudflare.com/logs/logpull-api/enabling-log-retention/

func (*API) SetPerZoneAuthenticatedOriginPullsStatus added in v0.29.3

func (api *API) SetPerZoneAuthenticatedOriginPullsStatus(ctx context.Context, zoneID string, enable bool) (PerZoneAuthenticatedOriginPullsSettings, error)

SetPerZoneAuthenticatedOriginPullsStatus will update whether Per Zone AuthenticatedOriginPulls is enabled for the zone.

API reference: https://api.cloudflare.com/#zone-level-authenticated-origin-pulls-set-enablement-for-zone

func (*API) SetWorkersSecret added in v0.29.3

func (api *API) SetWorkersSecret(ctx context.Context, script string, req *WorkersPutSecretRequest) (WorkersPutSecretResponse, error)

SetWorkersSecret creates or updates a secret API reference: https://api.cloudflare.com/

func (*API) SpectrumApplication added in v0.29.3

func (api *API) SpectrumApplication(ctx context.Context, zoneID string, applicationID string) (SpectrumApplication, error)

SpectrumApplication fetches a single Spectrum application based on the ID.

API reference: https://developers.cloudflare.com/spectrum/api-reference/#list-spectrum-applications

func (*API) SpectrumApplications added in v0.29.3

func (api *API) SpectrumApplications(ctx context.Context, zoneID string) ([]SpectrumApplication, error)

SpectrumApplications fetches all of the Spectrum applications for a zone.

API reference: https://developers.cloudflare.com/spectrum/api-reference/#list-spectrum-applications

func (*API) TeamsAccount added in v0.29.3

func (api *API) TeamsAccount(ctx context.Context, accountID string) (TeamsAccount, error)

TeamsAccount returns teams account information with internal and external ID.

API reference: TBA

func (*API) TeamsAccountConfiguration added in v0.29.3

func (api *API) TeamsAccountConfiguration(ctx context.Context, accountID string) (TeamsConfiguration, error)

TeamsAccountConfiguration returns teams account configuration.

API reference: TBA

func (*API) TeamsAccountUpdateConfiguration added in v0.29.3

func (api *API) TeamsAccountUpdateConfiguration(ctx context.Context, accountID string, config TeamsConfiguration) (TeamsConfiguration, error)

TeamsAccountUpdateConfiguration updates a teams account configuration.

API reference: TBA

func (*API) TeamsCreateRule added in v0.29.3

func (api *API) TeamsCreateRule(ctx context.Context, accountID string, rule TeamsRule) (TeamsRule, error)

TeamsCreateRule creates a rule with wirefilter expression.

API reference: https://api.cloudflare.com/#teams-rules-properties

func (*API) TeamsDeleteRule added in v0.29.3

func (api *API) TeamsDeleteRule(ctx context.Context, accountID string, ruleId string) error

TeamsDeleteRule deletes a rule.

API reference: https://api.cloudflare.com/#teams-rules-properties

func (*API) TeamsList added in v0.29.3

func (api *API) TeamsList(ctx context.Context, accountID, listID string) (TeamsList, error)

TeamsList returns a single list based on the list ID.

API reference: https://api.cloudflare.com/#teams-lists-teams-list-details

func (*API) TeamsListItems added in v0.29.3

func (api *API) TeamsListItems(ctx context.Context, accountID, listID string) ([]TeamsListItem, ResultInfo, error)

TeamsListItems returns all list items for a list.

API reference: https://api.cloudflare.com/#teams-lists-teams-list-items

func (*API) TeamsLists added in v0.29.3

func (api *API) TeamsLists(ctx context.Context, accountID string) ([]TeamsList, ResultInfo, error)

TeamsLists returns all lists within an account.

API reference: https://api.cloudflare.com/#teams-lists-list-teams-lists

func (*API) TeamsLocation added in v0.29.3

func (api *API) TeamsLocation(ctx context.Context, accountID, locationID string) (TeamsLocation, error)

TeamsLocation returns a single location based on the ID.

API reference: https://api.cloudflare.com/#teams-locations-teams-location-details

func (*API) TeamsLocations added in v0.29.3

func (api *API) TeamsLocations(ctx context.Context, accountID string) ([]TeamsLocation, ResultInfo, error)

TeamsLocations returns all locations within an account.

API reference: https://api.cloudflare.com/#teams-locations-list-teams-locations

func (*API) TeamsPatchRule added in v0.29.3

func (api *API) TeamsPatchRule(ctx context.Context, accountID string, ruleId string, rule TeamsRulePatchRequest) (TeamsRule, error)

TeamsPatchRule patches a rule associated values.

API reference: https://api.cloudflare.com/#teams-rules-properties

func (*API) TeamsRule added in v0.29.3

func (api *API) TeamsRule(ctx context.Context, accountID string, ruleId string) (TeamsRule, error)

TeamsRule returns the rule with rule ID in the URL.

API reference: https://api.cloudflare.com/#teams-rules-properties

func (*API) TeamsRules added in v0.29.3

func (api *API) TeamsRules(ctx context.Context, accountID string) ([]TeamsRule, error)

TeamsRules returns all rules within an account.

API reference: https://api.cloudflare.com/#teams-rules-properties

func (*API) TeamsUpdateRule added in v0.29.3

func (api *API) TeamsUpdateRule(ctx context.Context, accountID string, ruleId string, rule TeamsRule) (TeamsRule, error)

TeamsUpdateRule updates a rule with wirefilter expression.

API reference: https://api.cloudflare.com/#teams-rules-properties

func (*API) TestRailgunConnection

func (api *API) TestRailgunConnection(ctx context.Context, zoneID, railgunID string) (RailgunDiagnosis, error)

TestRailgunConnection tests a Railgun connection for a given zone.

API reference: https://api.cloudflare.com/#railgun-connections-for-a-zone-test-railgun-connection

func (*API) TransferRegistrarDomain added in v0.29.3

func (api *API) TransferRegistrarDomain(ctx context.Context, accountID, domainName string) ([]RegistrarDomain, error)

TransferRegistrarDomain initiates the transfer from another registrar to Cloudflare Registrar.

API reference: https://api.cloudflare.com/#registrar-domains-transfer-domain

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

domain, err := api.TransferRegistrarDomain(context.Background(), "01a7362d577a6c3019a474fd6f485823", "cloudflare.com")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", domain)
Output:

func (*API) UniversalSSLSettingDetails added in v0.29.3

func (api *API) UniversalSSLSettingDetails(ctx context.Context, zoneID string) (UniversalSSLSetting, error)

UniversalSSLSettingDetails returns the details for a universal ssl setting

API reference: https://api.cloudflare.com/#universal-ssl-settings-for-a-zone-universal-ssl-settings-details

func (*API) UniversalSSLVerificationDetails added in v0.29.3

func (api *API) UniversalSSLVerificationDetails(ctx context.Context, zoneID string) ([]UniversalSSLVerificationDetails, error)

UniversalSSLVerificationDetails returns the details for a universal ssl verification

API reference: https://api.cloudflare.com/#ssl-verification-ssl-verification-details

func (*API) UpdateAPIToken added in v0.29.3

func (api *API) UpdateAPIToken(ctx context.Context, tokenID string, token APIToken) (APIToken, error)

UpdateAPIToken updates an existing API token.

API reference: https://api.cloudflare.com/#user-api-tokens-update-token

func (*API) UpdateAccessApplication added in v0.29.3

func (api *API) UpdateAccessApplication(ctx context.Context, accountID string, accessApplication AccessApplication) (AccessApplication, error)

UpdateAccessApplication updates an existing access application.

API reference: https://api.cloudflare.com/#access-applications-update-access-application

func (*API) UpdateAccessGroup added in v0.29.3

func (api *API) UpdateAccessGroup(ctx context.Context, accountID string, accessGroup AccessGroup) (AccessGroup, error)

UpdateAccessGroup updates an existing access group.

API reference: https://api.cloudflare.com/#access-groups-update-access-group

func (*API) UpdateAccessIdentityProvider added in v0.29.3

func (api *API) UpdateAccessIdentityProvider(ctx context.Context, accountID, identityProviderUUID string, identityProviderConfiguration AccessIdentityProvider) (AccessIdentityProvider, error)

UpdateAccessIdentityProvider updates an existing Access Identity Provider.

API reference: https://api.cloudflare.com/#access-identity-providers-create-access-identity-provider

func (*API) UpdateAccessKeysConfig added in v0.29.3

func (api *API) UpdateAccessKeysConfig(ctx context.Context, accountID string, request AccessKeysConfigUpdateRequest) (AccessKeysConfig, error)

UpdateAccessKeysConfig updates the Access Keys Configuration for an account.

API reference: https://api.cloudflare.com/#access-keys-configuration-update-access-keys-configuration

func (*API) UpdateAccessMutualTLSCertificate added in v0.29.3

func (api *API) UpdateAccessMutualTLSCertificate(ctx context.Context, accountID, certificateID string, certificate AccessMutualTLSCertificate) (AccessMutualTLSCertificate, error)

UpdateAccessMutualTLSCertificate updates an account level Access TLS Mutual certificate.

API reference: https://api.cloudflare.com/#access-mutual-tls-authentication-update-access-certificate

func (*API) UpdateAccessOrganization added in v0.29.3

func (api *API) UpdateAccessOrganization(ctx context.Context, accountID string, accessOrganization AccessOrganization) (AccessOrganization, error)

UpdateAccessOrganization updates the Access organisation details.

API reference: https://api.cloudflare.com/#access-organizations-update-access-organization

func (*API) UpdateAccessPolicy added in v0.29.3

func (api *API) UpdateAccessPolicy(ctx context.Context, accountID, applicationID string, accessPolicy AccessPolicy) (AccessPolicy, error)

UpdateAccessPolicy updates an existing access policy.

API reference: https://api.cloudflare.com/#access-policy-update-access-policy

func (*API) UpdateAccessServiceToken added in v0.29.3

func (api *API) UpdateAccessServiceToken(ctx context.Context, accountID, uuid, name string) (AccessServiceTokenUpdateResponse, error)

UpdateAccessServiceToken updates an existing Access Service Token for an account.

API reference: https://api.cloudflare.com/#access-service-tokens-update-access-service-token

func (*API) UpdateAccount added in v0.29.3

func (api *API) UpdateAccount(ctx context.Context, accountID string, account Account) (Account, error)

UpdateAccount allows management of an account using the account ID.

API reference: https://api.cloudflare.com/#accounts-update-account

func (*API) UpdateAccountAccessRule added in v0.29.3

func (api *API) UpdateAccountAccessRule(ctx context.Context, accountID, accessRuleID string, accessRule AccessRule) (*AccessRuleResponse, error)

UpdateAccountAccessRule updates a single access rule for the given account & access rule identifiers.

API reference: https://api.cloudflare.com/#account-level-firewall-access-rule-update-access-rule

func (*API) UpdateAccountLogpushJob added in v0.29.3

func (api *API) UpdateAccountLogpushJob(ctx context.Context, accountID string, jobID int, job LogpushJob) error

UpdateAccountLogpushJob lets you update an account-level Logpush Job.

API reference: https://api.cloudflare.com/#logpush-jobs-update-logpush-job

func (*API) UpdateAccountMember added in v0.29.3

func (api *API) UpdateAccountMember(ctx context.Context, accountID string, userID string, member AccountMember) (AccountMember, error)

UpdateAccountMember modifies an existing account member.

API reference: https://api.cloudflare.com/#account-members-update-member

func (*API) UpdateAccountRuleset added in v0.29.3

func (api *API) UpdateAccountRuleset(ctx context.Context, accountID, rulesetID, description string, rules []RulesetRule) (Ruleset, error)

UpdateAccountRuleset updates a single ruleset for an account.

API reference: https://api.cloudflare.com/#account-rulesets-update-account-ruleset

func (*API) UpdateAccountRulesetPhase added in v0.29.3

func (api *API) UpdateAccountRulesetPhase(ctx context.Context, accountID, rulesetPhase string, ruleset Ruleset) (Ruleset, error)

UpdateAccountRulesetPhase updates a ruleset phase for an account.

API reference: TBA

func (*API) UpdateAdvertisementStatus added in v0.29.3

func (api *API) UpdateAdvertisementStatus(ctx context.Context, id string, advertised bool) (AdvertisementStatus, error)

UpdateAdvertisementStatus changes the BGP status of an IP prefix

API reference: https://api.cloudflare.com/#ip-address-management-prefixes-update-prefix-description

func (*API) UpdateArgoSmartRouting added in v0.29.3

func (api *API) UpdateArgoSmartRouting(ctx context.Context, zoneID, settingValue string) (ArgoFeatureSetting, error)

UpdateArgoSmartRouting updates the setting for smart routing.

API reference: https://api.cloudflare.com/#argo-smart-routing-patch-argo-smart-routing-setting

Example
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	smartRoutingSettings, err := api.UpdateArgoSmartRouting(context.Background(), "01a7362d577a6c3019a474fd6f485823", "on")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("smart routing is %s", smartRoutingSettings.Value)
}
Output:

func (*API) UpdateArgoTieredCaching added in v0.29.3

func (api *API) UpdateArgoTieredCaching(ctx context.Context, zoneID, settingValue string) (ArgoFeatureSetting, error)

UpdateArgoTieredCaching updates the setting for tiered caching.

API reference: TBA

Example
package main

import (
	"context"
	"fmt"
	"log"

	cloudflare "github.com/cloudflare/cloudflare-go"
)

func main() {
	api, err := cloudflare.New("deadbeef", "test@example.org")
	if err != nil {
		log.Fatal(err)
	}

	tieredCachingSettings, err := api.UpdateArgoTieredCaching(context.Background(), "01a7362d577a6c3019a474fd6f485823", "on")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("tiered caching is %s", tieredCachingSettings.Value)
}
Output:

func (*API) UpdateCustomHostname added in v0.29.3

func (api *API) UpdateCustomHostname(ctx context.Context, zoneID string, customHostnameID string, ch CustomHostname) (*CustomHostnameResponse, error)

UpdateCustomHostname modifies configuration for the given custom hostname in the given zone.

API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-update-custom-hostname-configuration

func (*API) UpdateCustomHostnameFallbackOrigin added in v0.29.3

func (api *API) UpdateCustomHostnameFallbackOrigin(ctx context.Context, zoneID string, chfo CustomHostnameFallbackOrigin) (*CustomHostnameFallbackOriginResponse, error)

UpdateCustomHostnameFallbackOrigin modifies the Custom Hostname Fallback origin in the given zone.

API reference: https://api.cloudflare.com/#custom-hostname-fallback-origin-for-a-zone-update-fallback-origin-for-custom-hostnames

func (*API) UpdateCustomHostnameSSL added in v0.7.4

func (api *API) UpdateCustomHostnameSSL(ctx context.Context, zoneID string, customHostnameID string, ssl *CustomHostnameSSL) (*CustomHostnameResponse, error)

UpdateCustomHostnameSSL modifies SSL configuration for the given custom hostname in the given zone.

API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-update-custom-hostname-configuration

func (*API) UpdateCustomPage added in v0.29.3

func (api *API) UpdateCustomPage(ctx context.Context, options *CustomPageOptions, customPageID string, pageParameters CustomPageParameters) (CustomPage, error)

UpdateCustomPage updates a single custom page setting.

Zone API reference: https://api.cloudflare.com/#custom-pages-for-a-zone-update-custom-page-url Account API reference: https://api.cloudflare.com/#custom-pages-account--update-custom-page

func (*API) UpdateDNSFirewallCluster added in v0.29.3

func (api *API) UpdateDNSFirewallCluster(ctx context.Context, clusterID string, vv DNSFirewallCluster) error

UpdateDNSFirewallCluster updates a DNS Firewall cluster.

API reference: https://api.cloudflare.com/#dns-firewall-update-dns-firewall-cluster

func (*API) UpdateDNSRecord

func (api *API) UpdateDNSRecord(ctx context.Context, zoneID, recordID string, rr DNSRecord) error

UpdateDNSRecord updates a single DNS record for the given zone & record identifiers.

API reference: https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record

func (*API) UpdateDevicePostureIntegration added in v0.29.3

func (api *API) UpdateDevicePostureIntegration(ctx context.Context, accountID string, integration DevicePostureIntegration) (DevicePostureIntegration, error)

UpdateDevicePostureIntegration updates a device posture integration within an account.

API reference: https://api.cloudflare.com/#device-posture-integrations-update-device-posture-integration

func (*API) UpdateDevicePostureRule added in v0.29.3

func (api *API) UpdateDevicePostureRule(ctx context.Context, accountID string, rule DevicePostureRule) (DevicePostureRule, error)

UpdateDevicePostureRule updates an existing device posture rule.

API reference: https://api.cloudflare.com/#device-posture-rules-update-device-posture-rule

func (*API) UpdateFallbackDomain added in v0.29.3

func (api *API) UpdateFallbackDomain(ctx context.Context, accountID string, domains []FallbackDomain) ([]FallbackDomain, error)

UpdateFallbackDomain updates the existing fallback domain policy.

API reference: https://api.cloudflare.com/#devices-set-local-domain-fallback-list

func (*API) UpdateFallbackOrigin added in v0.29.3

func (api *API) UpdateFallbackOrigin(ctx context.Context, zoneID string, fbo FallbackOrigin) (*FallbackOriginResponse, error)

UpdateFallbackOrigin updates the fallback origin for a given zone.

API reference: https://developers.cloudflare.com/ssl/ssl-for-saas/api-calls/#4-example-patch-to-change-fallback-origin

func (*API) UpdateFilter added in v0.29.3

func (api *API) UpdateFilter(ctx context.Context, zoneID string, filter Filter) (Filter, error)

UpdateFilter updates a single filter.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/put/#update-a-single-filter

func (*API) UpdateFilters added in v0.29.3

func (api *API) UpdateFilters(ctx context.Context, zoneID string, filters []Filter) ([]Filter, error)

UpdateFilters updates many filters at once.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/put/#update-multiple-filters

func (*API) UpdateFirewallRule added in v0.29.3

func (api *API) UpdateFirewallRule(ctx context.Context, zoneID string, firewallRule FirewallRule) (FirewallRule, error)

UpdateFirewallRule updates a single firewall rule.

API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/put/#update-a-single-rule

func (*API) UpdateFirewallRules added in v0.29.3

func (api *API) UpdateFirewallRules(ctx context.Context, zoneID string, firewallRules []FirewallRule) ([]FirewallRule, error)

UpdateFirewallRules updates a single firewall rule.

API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/put/#update-multiple-rules

func (*API) UpdateHealthcheck added in v0.29.3

func (api *API) UpdateHealthcheck(ctx context.Context, zoneID string, healthcheckID string, healthcheck Healthcheck) (Healthcheck, error)

UpdateHealthcheck updates an existing healthcheck.

API reference: https://api.cloudflare.com/#health-checks-update-health-check

func (*API) UpdateIPList added in v0.29.3

func (api *API) UpdateIPList(ctx context.Context, id string, description string) (IPList, error)

UpdateIPList updates the description of an existing IP List

API reference: https://api.cloudflare.com/#rules-lists-update-list

func (*API) UpdateKeylessSSL added in v0.29.3

func (api *API) UpdateKeylessSSL(ctx context.Context, zoneID, kelessSSLID string, keylessSSL KeylessSSLUpdateRequest) (KeylessSSL, error)

UpdateKeylessSSL updates an existing Keyless SSL configuration.

API reference: https://api.cloudflare.com/#keyless-ssl-for-a-zone-edit-keyless-ssl-configuration

func (*API) UpdateLogpushJob deprecated added in v0.29.3

func (api *API) UpdateLogpushJob(ctx context.Context, zoneID string, jobID int, job LogpushJob) error

UpdateLogpushJob lets you update a Logpush Job.

API reference: https://api.cloudflare.com/#logpush-jobs-update-logpush-job

Deprecated: Use `UpdateZoneLogpushJob` or `UpdateAccountLogpushJob` depending on the desired resource to target.

func (*API) UpdateMagicFirewallRuleset added in v0.29.3

func (api *API) UpdateMagicFirewallRuleset(ctx context.Context, id string, description string, rules []MagicFirewallRulesetRule) (MagicFirewallRuleset, error)

UpdateMagicFirewallRuleset updates a Magic Firewall ruleset

API reference: https://api.cloudflare.com/#rulesets-update-ruleset

func (*API) UpdateMagicTransitStaticRoute added in v0.29.3

func (api *API) UpdateMagicTransitStaticRoute(ctx context.Context, id string, route MagicTransitStaticRoute) (MagicTransitStaticRoute, error)

UpdateMagicTransitStaticRoute updates a static route

API reference: https://api.cloudflare.com/#magic-transit-static-routes-update-route

func (*API) UpdateNotificationPolicy added in v0.29.3

func (api *API) UpdateNotificationPolicy(ctx context.Context, accountID string, policy *NotificationPolicy) (SaveResponse, error)

UpdateNotificationPolicy updates a notification policy, given the account id and the policy id and returns the policy id.

API Reference: https://api.cloudflare.com/#notification-policies-update-notification-policy

func (*API) UpdateNotificationWebhooks added in v0.29.3

func (api *API) UpdateNotificationWebhooks(ctx context.Context, accountID, webhookID string, webhooks *NotificationUpsertWebhooks) (SaveResponse, error)

UpdateNotificationWebhooks will update a particular webhook's name, given the account and webhooks ids.

The webhook url and secret cannot be updated.

API Reference: https://api.cloudflare.com/#notification-webhooks-update-webhook

func (*API) UpdatePageRule

func (api *API) UpdatePageRule(ctx context.Context, zoneID, ruleID string, rule PageRule) error

UpdatePageRule lets you replace a Page Rule. This is in contrast to ChangePageRule which lets you change individual settings.

API reference: https://api.cloudflare.com/#page-rules-for-a-zone-update-a-page-rule

func (*API) UpdatePagesProject added in v0.29.3

func (api *API) UpdatePagesProject(ctx context.Context, accountID, projectName string, pagesProject PagesProject) (PagesProject, error)

UpdatePagesProject updates an existing Pages project.

API reference: https://api.cloudflare.com/#pages-project-update-project

func (*API) UpdatePrefixDescription added in v0.29.3

func (api *API) UpdatePrefixDescription(ctx context.Context, id string, description string) (IPPrefix, error)

UpdatePrefixDescription edits the description of the IP prefix

API reference: https://api.cloudflare.com/#ip-address-management-prefixes-update-prefix-description

func (*API) UpdateRateLimit added in v0.8.5

func (api *API) UpdateRateLimit(ctx context.Context, zoneID, limitID string, limit RateLimit) (RateLimit, error)

UpdateRateLimit lets you replace a Rate Limit for a zone.

API reference: https://api.cloudflare.com/#rate-limits-for-a-zone-update-rate-limit

func (*API) UpdateRegistrarDomain added in v0.29.3

func (api *API) UpdateRegistrarDomain(ctx context.Context, accountID, domainName string, domainConfiguration RegistrarDomainConfiguration) (RegistrarDomain, error)

UpdateRegistrarDomain updates an existing Registrar Domain configuration.

API reference: https://api.cloudflare.com/#registrar-domains-update-domain

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

domain, err := api.UpdateRegistrarDomain(context.Background(), "01a7362d577a6c3019a474fd6f485823", "cloudflare.com", cloudflare.RegistrarDomainConfiguration{
	NameServers: []string{"ns1.cloudflare.com", "ns2.cloudflare.com"},
	Locked:      false,
})
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", domain)
Output:

func (*API) UpdateSSL

func (api *API) UpdateSSL(ctx context.Context, zoneID, certificateID string, options ZoneCustomSSLOptions) (ZoneCustomSSL, error)

UpdateSSL updates (replaces) a custom SSL certificate.

API reference: https://api.cloudflare.com/#custom-ssl-for-a-zone-update-ssl-configuration

func (*API) UpdateSecondaryDNSPrimary added in v0.29.3

func (api *API) UpdateSecondaryDNSPrimary(ctx context.Context, accountID string, primary SecondaryDNSPrimary) (SecondaryDNSPrimary, error)

UpdateSecondaryDNSPrimary creates a secondary DNS primary.

API reference: https://api.cloudflare.com/#secondary-dns-primary--update-primary

func (*API) UpdateSecondaryDNSTSIG added in v0.29.3

func (api *API) UpdateSecondaryDNSTSIG(ctx context.Context, accountID string, tsig SecondaryDNSTSIG) (SecondaryDNSTSIG, error)

UpdateSecondaryDNSTSIG updates an existing secondary DNS TSIG at the account level.

API reference: https://api.cloudflare.com/#secondary-dns-tsig--update-tsig

func (*API) UpdateSecondaryDNSZone added in v0.29.3

func (api *API) UpdateSecondaryDNSZone(ctx context.Context, zoneID string, zone SecondaryDNSZone) (SecondaryDNSZone, error)

UpdateSecondaryDNSZone updates an existing secondary DNS zone.

API reference: https://api.cloudflare.com/#secondary-dns-update-secondary-zone-configuration

func (*API) UpdateSpectrumApplication added in v0.29.3

func (api *API) UpdateSpectrumApplication(ctx context.Context, zoneID, appID string, appDetails SpectrumApplication) (SpectrumApplication, error)

UpdateSpectrumApplication updates an existing Spectrum application.

API reference: https://developers.cloudflare.com/spectrum/api-reference/#update-a-spectrum-application

func (*API) UpdateSplitTunnel added in v0.29.3

func (api *API) UpdateSplitTunnel(ctx context.Context, accountID string, mode string, tunnels []SplitTunnel) ([]SplitTunnel, error)

UpdateSplitTunnel updates the existing split tunnel policy.

API reference for include: https://api.cloudflare.com/#device-policy-set-split-tunnel-include-list API reference for exclude: https://api.cloudflare.com/#device-policy-set-split-tunnel-exclude-list

func (*API) UpdateTeamsList added in v0.29.3

func (api *API) UpdateTeamsList(ctx context.Context, accountID string, teamsList TeamsList) (TeamsList, error)

UpdateTeamsList updates an existing teams list.

API reference: https://api.cloudflare.com/#teams-lists-update-teams-list

func (*API) UpdateTeamsLocation added in v0.29.3

func (api *API) UpdateTeamsLocation(ctx context.Context, accountID string, teamsLocation TeamsLocation) (TeamsLocation, error)

UpdateTeamsLocation updates an existing teams location.

API reference: https://api.cloudflare.com/#teams-locations-update-teams-location

func (*API) UpdateUniversalSSLCertificatePackValidationMethod added in v0.29.3

func (api *API) UpdateUniversalSSLCertificatePackValidationMethod(ctx context.Context, zoneID string, certPackUUID string, setting UniversalSSLCertificatePackValidationMethodSetting) (UniversalSSLCertificatePackValidationMethodSetting, error)

UpdateUniversalSSLCertificatePackValidationMethod changes the validation method for a certificate pack

API reference: https://api.cloudflare.com/#ssl-verification-ssl-verification-details

func (*API) UpdateUser

func (api *API) UpdateUser(ctx context.Context, user *User) (User, error)

UpdateUser updates the properties of the given user.

API reference: https://api.cloudflare.com/#user-update-user

func (*API) UpdateUserAccessRule added in v0.8.1

func (api *API) UpdateUserAccessRule(ctx context.Context, accessRuleID string, accessRule AccessRule) (*AccessRuleResponse, error)

UpdateUserAccessRule updates a single access rule for the logged-in user & given access rule identifier.

API reference: https://api.cloudflare.com/#user-level-firewall-access-rule-update-access-rule

func (*API) UpdateUserAgentRule added in v0.8.0

func (api *API) UpdateUserAgentRule(ctx context.Context, zoneID string, id string, ld UserAgentRule) (*UserAgentRuleResponse, error)

UpdateUserAgentRule updates a User-Agent Block rule (based on the ID) for the given zone ID.

API reference: https://api.cloudflare.com/#user-agent-blocking-rules-update-useragent-rule

func (*API) UpdateVirtualDNS deprecated

func (api *API) UpdateVirtualDNS(ctx context.Context, virtualDNSID string, vv VirtualDNS) error

UpdateVirtualDNS updates a Virtual DNS cluster.

Deprecated: Use UpdateDNSFirewallCluster instead.

func (*API) UpdateWAFGroup added in v0.29.3

func (api *API) UpdateWAFGroup(ctx context.Context, zoneID, packageID, groupID, mode string) (WAFGroup, error)

UpdateWAFGroup lets you update the mode of a WAF Group.

API Reference: https://api.cloudflare.com/#waf-rule-groups-edit-rule-group

func (*API) UpdateWAFOverride added in v0.29.3

func (api *API) UpdateWAFOverride(ctx context.Context, zoneID, overrideID string, override WAFOverride) (WAFOverride, error)

UpdateWAFOverride updates an existing WAF override.

API reference: https://api.cloudflare.com/#waf-overrides-update-uri-controlled-waf-configuration

func (*API) UpdateWAFPackage added in v0.29.3

func (api *API) UpdateWAFPackage(ctx context.Context, zoneID, packageID string, opts WAFPackageOptions) (WAFPackage, error)

UpdateWAFPackage lets you update the a WAF Package.

API Reference: https://api.cloudflare.com/#waf-rule-packages-edit-firewall-package

func (*API) UpdateWAFRule added in v0.29.3

func (api *API) UpdateWAFRule(ctx context.Context, zoneID, packageID, ruleID, mode string) (WAFRule, error)

UpdateWAFRule lets you update the mode of a WAF Rule.

API Reference: https://api.cloudflare.com/#waf-rules-edit-rule

func (*API) UpdateWaitingRoom added in v0.29.3

func (api *API) UpdateWaitingRoom(ctx context.Context, zoneID string, waitingRoom WaitingRoom) (WaitingRoom, error)

UpdateWaitingRoom lets you replace a Waiting Room. This is in contrast to ChangeWaitingRoom which lets you change individual settings.

API reference: https://api.cloudflare.com/#waiting-room-update-waiting-room

func (*API) UpdateWorkerCronTriggers added in v0.29.3

func (api *API) UpdateWorkerCronTriggers(ctx context.Context, scriptName string, crons []WorkerCronTrigger) ([]WorkerCronTrigger, error)

UpdateWorkerCronTriggers updates a single schedule for a Worker cron trigger.

API reference: https://api.cloudflare.com/#worker-cron-trigger-update-cron-triggers

func (*API) UpdateWorkerRoute added in v0.29.3

func (api *API) UpdateWorkerRoute(ctx context.Context, zoneID string, routeID string, route WorkerRoute) (WorkerRouteResponse, error)

UpdateWorkerRoute updates worker route for a zone.

API reference: https://api.cloudflare.com/#worker-filters-update-filter, https://api.cloudflare.com/#worker-routes-update-route

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}
// pull from existing list of routes to perform update on
routesResponse, err := api.ListWorkerRoutes(context.Background(), zoneID)
if err != nil {
	log.Fatal(err)
}
route := cloudflare.WorkerRoute{Pattern: "app2.example.com/*", Enabled: true}
// update first route retrieved from the listWorkerRoutes call with details above
res, err := api.UpdateWorkerRoute(context.Background(), zoneID, routesResponse.Routes[0].ID, route)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res)
Output:

func (*API) UpdateWorkersKVNamespace added in v0.29.3

func (api *API) UpdateWorkersKVNamespace(ctx context.Context, namespaceID string, req *WorkersKVNamespaceRequest) (Response, error)

UpdateWorkersKVNamespace modifies a namespace's title

API reference: https://api.cloudflare.com/#workers-kv-namespace-rename-a-namespace

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

resp, err := api.UpdateWorkersKVNamespace(context.Background(), namespace, &cloudflare.WorkersKVNamespaceRequest{Title: "test_title"})
if err != nil {
	log.Fatal(err)
}

fmt.Println(resp)
Output:

func (*API) UpdateZoneAccessMutualTLSCertificate added in v0.29.3

func (api *API) UpdateZoneAccessMutualTLSCertificate(ctx context.Context, zoneID, certificateID string, certificate AccessMutualTLSCertificate) (AccessMutualTLSCertificate, error)

UpdateZoneAccessMutualTLSCertificate updates a zone level Access TLS Mutual certificate.

API reference: https://api.cloudflare.com/#zone-level-access-mutual-tls-authentication-update-access-certificate

func (*API) UpdateZoneAccessRule added in v0.8.1

func (api *API) UpdateZoneAccessRule(ctx context.Context, zoneID, accessRuleID string, accessRule AccessRule) (*AccessRuleResponse, error)

UpdateZoneAccessRule updates a single access rule for the given zone & access rule identifiers.

API reference: https://api.cloudflare.com/#firewall-access-rule-for-a-zone-update-access-rule

func (*API) UpdateZoneDNSSEC added in v0.29.3

func (api *API) UpdateZoneDNSSEC(ctx context.Context, zoneID string, options ZoneDNSSECUpdateOptions) (ZoneDNSSEC, error)

UpdateZoneDNSSEC updates DNSSEC for a zone

API reference: https://api.cloudflare.com/#dnssec-edit-dnssec-status

func (*API) UpdateZoneLevelAccessApplication added in v0.29.3

func (api *API) UpdateZoneLevelAccessApplication(ctx context.Context, zoneID string, accessApplication AccessApplication) (AccessApplication, error)

UpdateZoneLevelAccessApplication updates an existing zone level access application.

API reference: https://api.cloudflare.com/#zone-level-access-applications-update-access-application

func (*API) UpdateZoneLevelAccessGroup added in v0.29.3

func (api *API) UpdateZoneLevelAccessGroup(ctx context.Context, zoneID string, accessGroup AccessGroup) (AccessGroup, error)

UpdateZoneLevelAccessGroup updates an existing zone level access group.

API reference: https://api.cloudflare.com/#zone-level-access-groups-update-access-group

func (*API) UpdateZoneLevelAccessIdentityProvider added in v0.29.3

func (api *API) UpdateZoneLevelAccessIdentityProvider(ctx context.Context, zoneID, identityProviderUUID string, identityProviderConfiguration AccessIdentityProvider) (AccessIdentityProvider, error)

UpdateZoneLevelAccessIdentityProvider updates an existing zone level Access Identity Provider.

API reference: https://api.cloudflare.com/#zone-level-access-identity-providers-update-access-identity-provider

func (*API) UpdateZoneLevelAccessOrganization added in v0.29.3

func (api *API) UpdateZoneLevelAccessOrganization(ctx context.Context, zoneID string, accessOrganization AccessOrganization) (AccessOrganization, error)

UpdateZoneLevelAccessOrganization updates the zone level Access organisation details.

API reference: https://api.cloudflare.com/#zone-level-access-organizations-update-access-organization

func (*API) UpdateZoneLevelAccessPolicy added in v0.29.3

func (api *API) UpdateZoneLevelAccessPolicy(ctx context.Context, zoneID, applicationID string, accessPolicy AccessPolicy) (AccessPolicy, error)

UpdateZoneLevelAccessPolicy updates an existing zone level access policy.

API reference: https://api.cloudflare.com/#zone-level-access-policy-update-access-policy

func (*API) UpdateZoneLevelAccessServiceToken added in v0.29.3

func (api *API) UpdateZoneLevelAccessServiceToken(ctx context.Context, zoneID, uuid, name string) (AccessServiceTokenUpdateResponse, error)

UpdateZoneLevelAccessServiceToken updates an existing Access Service Token for a zone.

API reference: https://api.cloudflare.com/#zone-level-access-service-tokens-update-access-service-token

func (*API) UpdateZoneLockdown added in v0.8.0

func (api *API) UpdateZoneLockdown(ctx context.Context, zoneID string, id string, ld ZoneLockdown) (*ZoneLockdownResponse, error)

UpdateZoneLockdown updates a Zone ZoneLockdown rule (based on the ID) for the given zone ID.

API reference: https://api.cloudflare.com/#zone-ZoneLockdown-update-ZoneLockdown-rule

func (*API) UpdateZoneLogpushJob added in v0.29.3

func (api *API) UpdateZoneLogpushJob(ctx context.Context, zoneID string, jobID int, job LogpushJob) error

UpdateZoneLogpushJob lets you update a Logpush Job for a zone.

API reference: https://api.cloudflare.com/#logpush-jobs-update-logpush-job

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

err = api.UpdateZoneLogpushJob(context.Background(), zoneID, 1, exampleUpdatedLogpushJob)
if err != nil {
	log.Fatal(err)
}
Output:

func (*API) UpdateZoneRuleset added in v0.29.3

func (api *API) UpdateZoneRuleset(ctx context.Context, zoneID, rulesetID, description string, rules []RulesetRule) (Ruleset, error)

UpdateZoneRuleset updates a single ruleset for a zone.

API reference: https://api.cloudflare.com/#zone-rulesets-update-a-zone-ruleset

func (*API) UpdateZoneRulesetPhase added in v0.29.3

func (api *API) UpdateZoneRulesetPhase(ctx context.Context, zoneID, rulesetPhase string, ruleset Ruleset) (Ruleset, error)

UpdateZoneRulesetPhase updates a ruleset phase for a zone.

API reference: TBA

func (*API) UpdateZoneSSLSettings added in v0.29.3

func (api *API) UpdateZoneSSLSettings(ctx context.Context, zoneID string, sslValue string) (ZoneSSLSetting, error)

UpdateZoneSSLSettings update information about SSL setting to the specified zone.

API reference: https://api.cloudflare.com/#zone-settings-change-ssl-setting

func (*API) UpdateZoneSettings added in v0.8.5

func (api *API) UpdateZoneSettings(ctx context.Context, zoneID string, settings []ZoneSetting) (*ZoneSettingResponse, error)

UpdateZoneSettings updates the settings for a given zone.

API reference: https://api.cloudflare.com/#zone-settings-edit-zone-settings-info

func (*API) UpdateZoneSingleSetting added in v0.29.3

func (api *API) UpdateZoneSingleSetting(ctx context.Context, zoneID, settingName string, setting ZoneSetting) (*ZoneSettingSingleResponse, error)

UpdateZoneSingleSetting updates the specified setting for a given zone.

API reference: https://api.cloudflare.com/#zone-settings-edit-zone-settings-info

func (*API) UploadPerHostnameAuthenticatedOriginPullsCertificate added in v0.29.3

func (api *API) UploadPerHostnameAuthenticatedOriginPullsCertificate(ctx context.Context, zoneID string, params PerHostnameAuthenticatedOriginPullsCertificateParams) (PerHostnameAuthenticatedOriginPullsCertificateDetails, error)

UploadPerHostnameAuthenticatedOriginPullsCertificate will upload the provided certificate and private key to the edge under Per Hostname AuthenticatedOriginPulls.

API reference: https://api.cloudflare.com/#per-hostname-authenticated-origin-pull-upload-a-hostname-client-certificate

func (*API) UploadPerZoneAuthenticatedOriginPullsCertificate added in v0.29.3

func (api *API) UploadPerZoneAuthenticatedOriginPullsCertificate(ctx context.Context, zoneID string, params PerZoneAuthenticatedOriginPullsCertificateParams) (PerZoneAuthenticatedOriginPullsCertificateDetails, error)

UploadPerZoneAuthenticatedOriginPullsCertificate will upload a provided client certificate and enable it to be used in all AuthenticatedOriginPulls requests for the zone.

API reference: https://api.cloudflare.com/#zone-level-authenticated-origin-pulls-upload-certificate

func (*API) UploadWorker added in v0.29.3

func (api *API) UploadWorker(ctx context.Context, requestParams *WorkerRequestParams, data string) (WorkerScriptResponse, error)

UploadWorker push raw script content for your worker.

API reference: https://api.cloudflare.com/#worker-script-upload-worker

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

res, err := api.UploadWorker(context.Background(), &cloudflare.WorkerRequestParams{ZoneID: zoneID}, workerScript)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v", res)

UploadWorkerWithName()
Output:

func (*API) UploadWorkerWithBindings added in v0.29.3

func (api *API) UploadWorkerWithBindings(ctx context.Context, requestParams *WorkerRequestParams, data *WorkerScriptParams) (WorkerScriptResponse, error)

UploadWorkerWithBindings push raw script content and bindings for your worker

API reference: https://api.cloudflare.com/#worker-script-upload-worker

func (*API) UserAccessRule added in v0.29.3

func (api *API) UserAccessRule(ctx context.Context, accessRuleID string) (*AccessRuleResponse, error)

UserAccessRule returns the details of a user's account access rule.

API reference: https://api.cloudflare.com/#user-level-firewall-access-rule-list-access-rules

func (*API) UserAgentRule added in v0.8.0

func (api *API) UserAgentRule(ctx context.Context, zoneID string, id string) (*UserAgentRuleResponse, error)

UserAgentRule retrieves a User-Agent Block rule (based on the ID) for the given zone ID.

API reference: https://api.cloudflare.com/#user-agent-blocking-rules-useragent-rule-details

func (*API) UserBillingProfile added in v0.7.3

func (api *API) UserBillingProfile(ctx context.Context) (UserBillingProfile, error)

UserBillingProfile returns the billing profile of the user.

API reference: https://api.cloudflare.com/#user-billing-profile

func (*API) UserDetails

func (api *API) UserDetails(ctx context.Context) (User, error)

UserDetails provides information about the logged-in user.

API reference: https://api.cloudflare.com/#user-user-details

func (*API) ValidateAccountLogpushOwnershipChallenge added in v0.29.3

func (api *API) ValidateAccountLogpushOwnershipChallenge(ctx context.Context, accountID, destinationConf, ownershipChallenge string) (bool, error)

ValidateAccountLogpushOwnershipChallenge returns account-level ownership challenge validation result.

API reference: https://api.cloudflare.com/#logpush-jobs-validate-ownership-challenge

func (*API) ValidateFilterExpression added in v0.29.3

func (api *API) ValidateFilterExpression(ctx context.Context, expression string) error

ValidateFilterExpression checks correctness of a filter expression.

API reference: https://developers.cloudflare.com/firewall/api/cf-filters/validation/

func (*API) ValidateLogpushOwnershipChallenge deprecated added in v0.29.3

func (api *API) ValidateLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf, ownershipChallenge string) (bool, error)

ValidateLogpushOwnershipChallenge returns zone-level ownership challenge validation result.

API reference: https://api.cloudflare.com/#logpush-jobs-validate-ownership-challenge

Deprecated: Use `ValidateZoneLogpushOwnershipChallenge` or `ValidateAccountLogpushOwnershipChallenge` depending on the desired resource to target.

func (*API) ValidateZoneLogpushOwnershipChallenge added in v0.29.3

func (api *API) ValidateZoneLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf, ownershipChallenge string) (bool, error)

ValidateZoneLogpushOwnershipChallenge returns zone-level ownership challenge validation result.

API reference: https://api.cloudflare.com/#logpush-jobs-validate-ownership-challenge

Example
api, err := cloudflare.New(apiKey, user)
if err != nil {
	log.Fatal(err)
}

zoneID, err := api.ZoneIDByName(domain)
if err != nil {
	log.Fatal(err)
}

isValid, err := api.ValidateZoneLogpushOwnershipChallenge(context.Background(), zoneID, "destination_conf", "ownership_challenge")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%+v\n", isValid)
Output:

func (*API) VerifyAPIToken added in v0.29.3

func (api *API) VerifyAPIToken(ctx context.Context) (APITokenVerifyBody, error)

VerifyAPIToken tests the validity of the token.

API reference: https://api.cloudflare.com/#user-api-tokens-verify-token

func (*API) VirtualDNS deprecated

func (api *API) VirtualDNS(ctx context.Context, virtualDNSID string) (*VirtualDNS, error)

VirtualDNS fetches a single virtual DNS cluster.

Deprecated: Use DNSFirewallCluster instead.

func (*API) VirtualDNSUserAnalytics deprecated added in v0.29.3

func (api *API) VirtualDNSUserAnalytics(ctx context.Context, virtualDNSID string, o VirtualDNSUserAnalyticsOptions) (VirtualDNSAnalytics, error)

VirtualDNSUserAnalytics retrieves analytics report for a specified dimension and time range

Deprecated: Use DNSFirewallUserAnalytics instead.

func (*API) WAFGroup added in v0.29.3

func (api *API) WAFGroup(ctx context.Context, zoneID, packageID, groupID string) (WAFGroup, error)

WAFGroup returns a WAF rule group from the given WAF package.

API Reference: https://api.cloudflare.com/#waf-rule-groups-rule-group-details

func (*API) WAFOverride added in v0.29.3

func (api *API) WAFOverride(ctx context.Context, zoneID, overrideID string) (WAFOverride, error)

WAFOverride returns a WAF override from the given override ID.

API Reference: https://api.cloudflare.com/#waf-overrides-uri-controlled-waf-configuration-details

func (*API) WAFPackage added in v0.29.3

func (api *API) WAFPackage(ctx context.Context, zoneID, packageID string) (WAFPackage, error)

WAFPackage returns a WAF package for the given zone.

API Reference: https://api.cloudflare.com/#waf-rule-packages-firewall-package-details

func (*API) WAFRule added in v0.29.3

func (api *API) WAFRule(ctx context.Context, zoneID, packageID, ruleID string) (WAFRule, error)

WAFRule returns a WAF rule from the given WAF package.

API Reference: https://api.cloudflare.com/#waf-rules-rule-details

func (*API) WaitingRoom added in v0.29.3

func (api *API) WaitingRoom(ctx context.Context, zoneID, waitingRoomID string) (WaitingRoom, error)

WaitingRoom fetches detail about one Waiting room for a zone.

API reference: https://api.cloudflare.com/#waiting-room-waiting-room-details

func (*API) WriteWorkersKV added in v0.29.3

func (api *API) WriteWorkersKV(ctx context.Context, namespaceID, key string, value []byte) (Response, error)

WriteWorkersKV writes a value identified by a key.

API reference: https://api.cloudflare.com/#workers-kv-namespace-write-key-value-pair

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

payload := []byte("test payload")
key := "test_key"

resp, err := api.WriteWorkersKV(context.Background(), namespace, key, payload)
if err != nil {
	log.Fatal(err)
}

fmt.Println(resp)
Output:

func (*API) WriteWorkersKVBulk added in v0.29.3

func (api *API) WriteWorkersKVBulk(ctx context.Context, namespaceID string, kvs WorkersKVBulkWriteRequest) (Response, error)

WriteWorkersKVBulk writes multiple KVs at once.

API reference: https://api.cloudflare.com/#workers-kv-namespace-write-multiple-key-value-pairs

Example
api, err := cloudflare.New(apiKey, user, cloudflare.UsingAccount(accountID))
if err != nil {
	log.Fatal(err)
}

payload := cloudflare.WorkersKVBulkWriteRequest{
	{
		Key:   "key1",
		Value: "value1",
	},
	{
		Key:      "key2",
		Value:    base64.StdEncoding.EncodeToString([]byte("value2")),
		Base64:   true,
		Metadata: "key2's value will be decoded in base64 before it is stored",
	},
}

resp, err := api.WriteWorkersKVBulk(context.Background(), namespace, payload)
if err != nil {
	log.Fatal(err)
}

fmt.Println(resp)
Output:

func (*API) ZoneAccessMutualTLSCertificate added in v0.29.3

func (api *API) ZoneAccessMutualTLSCertificate(ctx context.Context, zoneID, certificateID string) (AccessMutualTLSCertificate, error)

ZoneAccessMutualTLSCertificate returns a single zone level Access Mutual TLS certificate.

API reference: https://api.cloudflare.com/#zone-level-access-mutual-tls-authentication-access-certificate-details

func (*API) ZoneAccessMutualTLSCertificates added in v0.29.3

func (api *API) ZoneAccessMutualTLSCertificates(ctx context.Context, zoneID string) ([]AccessMutualTLSCertificate, error)

ZoneAccessMutualTLSCertificates returns all Access TLS certificates for the zone level.

API reference: https://api.cloudflare.com/#zone-level-access-mutual-tls-authentication-properties

func (*API) ZoneAccessRule added in v0.29.3

func (api *API) ZoneAccessRule(ctx context.Context, zoneID string, accessRuleID string) (*AccessRuleResponse, error)

ZoneAccessRule returns the details of a zone's access rule.

API reference: https://api.cloudflare.com/#firewall-access-rule-for-a-zone-list-access-rules

func (*API) ZoneActivationCheck

func (api *API) ZoneActivationCheck(ctx context.Context, zoneID string) (Response, error)

ZoneActivationCheck initiates another zone activation check for newly-created zones.

API reference: https://api.cloudflare.com/#zone-initiate-another-zone-activation-check

func (*API) ZoneAnalyticsByColocation

func (api *API) ZoneAnalyticsByColocation(ctx context.Context, zoneID string, options ZoneAnalyticsOptions) ([]ZoneAnalyticsColocation, error)

ZoneAnalyticsByColocation returns zone analytics information by datacenter.

API reference: https://api.cloudflare.com/#zone-analytics-analytics-by-co-locations

func (*API) ZoneAnalyticsDashboard

func (api *API) ZoneAnalyticsDashboard(ctx context.Context, zoneID string, options ZoneAnalyticsOptions) (ZoneAnalyticsData, error)

ZoneAnalyticsDashboard returns zone analytics information.

API reference: https://api.cloudflare.com/#zone-analytics-dashboard

func (*API) ZoneDNSSECSetting added in v0.29.3

func (api *API) ZoneDNSSECSetting(ctx context.Context, zoneID string) (ZoneDNSSEC, error)

ZoneDNSSECSetting returns the DNSSEC details of a zone

API reference: https://api.cloudflare.com/#dnssec-dnssec-details

func (*API) ZoneDetails

func (api *API) ZoneDetails(ctx context.Context, zoneID string) (Zone, error)

ZoneDetails fetches information about a zone.

API reference: https://api.cloudflare.com/#zone-zone-details

func (*API) ZoneExport added in v0.29.3

func (api *API) ZoneExport(ctx context.Context, zoneID string) (string, error)

ZoneExport returns the text BIND config for the given zone

API reference: https://api.cloudflare.com/#dns-records-for-a-zone-export-dns-records

func (*API) ZoneIDByName

func (api *API) ZoneIDByName(zoneName string) (string, error)

ZoneIDByName retrieves a zone's ID from the name.

func (*API) ZoneLevelAccessApplication added in v0.29.3

func (api *API) ZoneLevelAccessApplication(ctx context.Context, zoneID, applicationID string) (AccessApplication, error)

ZoneLevelAccessApplication returns a single zone level application based on the application ID.

API reference: https://api.cloudflare.com/#zone-level-access-applications-access-applications-details

func (*API) ZoneLevelAccessApplications added in v0.29.3

func (api *API) ZoneLevelAccessApplications(ctx context.Context, zoneID string, pageOpts PaginationOptions) ([]AccessApplication, ResultInfo, error)

ZoneLevelAccessApplications returns all applications within a zone.

API reference: https://api.cloudflare.com/#zone-level-access-applications-list-access-applications

func (*API) ZoneLevelAccessCACertificate added in v0.29.3

func (api *API) ZoneLevelAccessCACertificate(ctx context.Context, zoneID, applicationID string) (AccessCACertificate, error)

ZoneLevelAccessCACertificate returns a single zone level CA certificate associated with an Access Application.

API reference: https://api.cloudflare.com/#zone-level-access-short-lived-certificates-short-lived-certificate-details

func (*API) ZoneLevelAccessCACertificates added in v0.29.3

func (api *API) ZoneLevelAccessCACertificates(ctx context.Context, zoneID string) ([]AccessCACertificate, error)

ZoneLevelAccessCACertificates returns all zone level CA certificates within Access.

API reference: https://api.cloudflare.com/#zone-level-access-short-lived-certificates-list-short-lived-certificates

func (*API) ZoneLevelAccessGroup added in v0.29.3

func (api *API) ZoneLevelAccessGroup(ctx context.Context, zoneID, groupID string) (AccessGroup, error)

ZoneLevelAccessGroup returns a single zone level group based on the group ID.

API reference: https://api.cloudflare.com/#zone-level-access-groups-access-group-details

func (*API) ZoneLevelAccessGroups added in v0.29.3

func (api *API) ZoneLevelAccessGroups(ctx context.Context, zoneID string, pageOpts PaginationOptions) ([]AccessGroup, ResultInfo, error)

ZoneLevelAccessGroups returns all zone level access groups for an access application.

API reference: https://api.cloudflare.com/#zone-level-access-groups-list-access-groups

func (*API) ZoneLevelAccessIdentityProviderDetails added in v0.29.3

func (api *API) ZoneLevelAccessIdentityProviderDetails(ctx context.Context, zoneID, identityProviderID string) (AccessIdentityProvider, error)

ZoneLevelAccessIdentityProviderDetails returns a single zone level Access Identity Provider for an account.

API reference: https://api.cloudflare.com/#zone-level-access-identity-providers-access-identity-providers-details

func (*API) ZoneLevelAccessIdentityProviders added in v0.29.3

func (api *API) ZoneLevelAccessIdentityProviders(ctx context.Context, zoneID string) ([]AccessIdentityProvider, error)

ZoneLevelAccessIdentityProviders returns all Access Identity Providers for an account.

API reference: https://api.cloudflare.com/#zone-level-access-identity-providers-list-access-identity-providers

func (*API) ZoneLevelAccessOrganization added in v0.29.3

func (api *API) ZoneLevelAccessOrganization(ctx context.Context, zoneID string) (AccessOrganization, ResultInfo, error)

ZoneLevelAccessOrganization returns the zone level Access organisation details.

API reference: https://api.cloudflare.com/#zone-level-access-organizations-access-organization-details

func (*API) ZoneLevelAccessPolicies added in v0.29.3

func (api *API) ZoneLevelAccessPolicies(ctx context.Context, zoneID, applicationID string, pageOpts PaginationOptions) ([]AccessPolicy, ResultInfo, error)

ZoneLevelAccessPolicies returns all zone level access policies for an access application.

API reference: https://api.cloudflare.com/#zone-level-access-policy-list-access-policies

func (*API) ZoneLevelAccessPolicy added in v0.29.3

func (api *API) ZoneLevelAccessPolicy(ctx context.Context, zoneID, applicationID, policyID string) (AccessPolicy, error)

ZoneLevelAccessPolicy returns a single zone level policy based on the policy ID.

API reference: https://api.cloudflare.com/#zone-level-access-policy-access-policy-details

func (*API) ZoneLevelAccessServiceTokens added in v0.29.3

func (api *API) ZoneLevelAccessServiceTokens(ctx context.Context, zoneID string) ([]AccessServiceToken, ResultInfo, error)

ZoneLevelAccessServiceTokens returns all Access Service Tokens for a zone.

API reference: https://api.cloudflare.com/#zone-level-access-service-tokens-list-access-service-tokens

func (*API) ZoneLockdown added in v0.8.0

func (api *API) ZoneLockdown(ctx context.Context, zoneID string, id string) (*ZoneLockdownResponse, error)

ZoneLockdown retrieves a Zone ZoneLockdown rule (based on the ID) for the given zone ID.

API reference: https://api.cloudflare.com/#zone-ZoneLockdown-ZoneLockdown-rule-details

func (*API) ZoneRailgunDetails

func (api *API) ZoneRailgunDetails(ctx context.Context, zoneID, railgunID string) (ZoneRailgun, error)

ZoneRailgunDetails returns the configuration for a given Railgun.

API reference: https://api.cloudflare.com/#railguns-for-a-zone-get-railgun-details

func (*API) ZoneRailguns

func (api *API) ZoneRailguns(ctx context.Context, zoneID string) ([]ZoneRailgun, error)

ZoneRailguns returns the available Railguns for a zone.

API reference: https://api.cloudflare.com/#railguns-for-a-zone-get-available-railguns

func (*API) ZoneSSLSettings added in v0.7.4

func (api *API) ZoneSSLSettings(ctx context.Context, zoneID string) (ZoneSSLSetting, error)

ZoneSSLSettings returns information about SSL setting to the specified zone.

API reference: https://api.cloudflare.com/#zone-settings-get-ssl-setting

func (*API) ZoneSetPaused

func (api *API) ZoneSetPaused(ctx context.Context, zoneID string, paused bool) (Zone, error)

ZoneSetPaused pauses Cloudflare service for the entire zone, sending all traffic direct to the origin.

func (*API) ZoneSetPlan

func (api *API) ZoneSetPlan(ctx context.Context, zoneID string, planType string) error

ZoneSetPlan sets the rate plan of an existing zone.

Valid values for `planType` are "CF_FREE", "CF_PRO", "CF_BIZ" and "CF_ENT".

API reference: https://api.cloudflare.com/#zone-subscription-create-zone-subscription

func (*API) ZoneSetType added in v0.29.3

func (api *API) ZoneSetType(ctx context.Context, zoneID string, zoneType string) (Zone, error)

ZoneSetType toggles the type for an existing zone.

Valid values for `type` are "full" and "partial"

API reference: https://api.cloudflare.com/#zone-edit-zone

func (*API) ZoneSetVanityNS

func (api *API) ZoneSetVanityNS(ctx context.Context, zoneID string, ns []string) (Zone, error)

ZoneSetVanityNS sets custom nameservers for the zone. These names must be within the same zone.

func (*API) ZoneSettings added in v0.8.5

func (api *API) ZoneSettings(ctx context.Context, zoneID string) (*ZoneSettingResponse, error)

ZoneSettings returns all of the settings for a given zone.

API reference: https://api.cloudflare.com/#zone-settings-get-all-zone-settings

func (*API) ZoneSingleSetting added in v0.29.3

func (api *API) ZoneSingleSetting(ctx context.Context, zoneID, settingName string) (ZoneSetting, error)

ZoneSingleSetting returns information about specified setting to the specified zone.

API reference: https://api.cloudflare.com/#zone-settings-get-all-zone-settings

func (*API) ZoneUpdatePlan added in v0.29.3

func (api *API) ZoneUpdatePlan(ctx context.Context, zoneID string, planType string) error

ZoneUpdatePlan updates the rate plan of an existing zone.

Valid values for `planType` are "CF_FREE", "CF_PRO", "CF_BIZ" and "CF_ENT".

API reference: https://api.cloudflare.com/#zone-subscription-update-zone-subscription

type APIRequestError added in v0.29.3

type APIRequestError struct {
	StatusCode int
	Errors     []ResponseInfo
}

APIRequestError is a type of error raised by API calls made by this library.

func (*APIRequestError) ClientError added in v0.29.3

func (e *APIRequestError) ClientError() bool

ClientError returns a boolean whether or not the raised error was caused by something client side.

func (*APIRequestError) ClientRateLimited added in v0.29.3

func (e *APIRequestError) ClientRateLimited() bool

ClientRateLimited returns a boolean whether or not the raised error was caused by too many requests from the client.

func (APIRequestError) Error added in v0.29.3

func (e APIRequestError) Error() string

func (*APIRequestError) ErrorMessageContains added in v0.29.3

func (e *APIRequestError) ErrorMessageContains(s string) bool

ErrorMessageContains returns a boolean whether or not a substring exists in any of the `e.ErrorMessages` slice entries.

func (*APIRequestError) ErrorMessages added in v0.29.3

func (e *APIRequestError) ErrorMessages() []string

ErrorMessages exposes the error messages as a slice of strings from the error response encountered.

func (APIRequestError) HTTPStatusCode added in v0.29.3

func (e APIRequestError) HTTPStatusCode() int

HTTPStatusCode exposes the HTTP status from the error response encountered.

func (*APIRequestError) InternalErrorCodeIs added in v0.29.3

func (e *APIRequestError) InternalErrorCodeIs(code int) bool

InternalErrorCodeIs returns a boolean whether or not the desired internal error code is present in `e.InternalErrorCodes`.

func (*APIRequestError) InternalErrorCodes added in v0.29.3

func (e *APIRequestError) InternalErrorCodes() []int

InternalErrorCodes exposes the internal error codes as a slice of int from the error response encountered.

func (*APIRequestError) ServiceError added in v0.29.3

func (e *APIRequestError) ServiceError() bool

ServiceError returns a boolean whether or not the raised error was caused by an internal service.

type APIToken added in v0.29.3

type APIToken struct {
	ID         string             `json:"id,omitempty"`
	Name       string             `json:"name"`
	Status     string             `json:"status,omitempty"`
	IssuedOn   *time.Time         `json:"issued_on,omitempty"`
	ModifiedOn *time.Time         `json:"modified_on,omitempty"`
	NotBefore  *time.Time         `json:"not_before,omitempty"`
	ExpiresOn  *time.Time         `json:"expires_on,omitempty"`
	Policies   []APITokenPolicies `json:"policies"`
	Condition  *APITokenCondition `json:"condition,omitempty"`
	Value      string             `json:"value,omitempty"`
}

APIToken is the full API token.

type APITokenCondition added in v0.29.3

type APITokenCondition struct {
	RequestIP *APITokenRequestIPCondition `json:"request.ip,omitempty"`
}

APITokenCondition is the outer structure for request conditions (currently only IPs).

type APITokenListResponse added in v0.29.3

type APITokenListResponse struct {
	Response
	Result []APIToken `json:"result"`
}

APITokenListResponse is the API response for multiple API tokens.

type APITokenPermissionGroups added in v0.29.3

type APITokenPermissionGroups struct {
	ID     string   `json:"id"`
	Name   string   `json:"name,omitempty"`
	Scopes []string `json:"scopes,omitempty"`
}

APITokenPermissionGroups is the permission groups associated with API tokens.

type APITokenPermissionGroupsResponse added in v0.29.3

type APITokenPermissionGroupsResponse struct {
	Response
	Result []APITokenPermissionGroups `json:"result"`
}

APITokenPermissionGroupsResponse is the API response for the available permission groups.

type APITokenPolicies added in v0.29.3

type APITokenPolicies struct {
	ID               string                     `json:"id,omitempty"`
	Effect           string                     `json:"effect"`
	Resources        map[string]interface{}     `json:"resources"`
	PermissionGroups []APITokenPermissionGroups `json:"permission_groups"`
}

APITokenPolicies are policies attached to an API token.

type APITokenRequestIPCondition added in v0.29.3

type APITokenRequestIPCondition struct {
	In    []string `json:"in,omitempty"`
	NotIn []string `json:"not_in,omitempty"`
}

APITokenRequestIPCondition is the struct for adding an IP restriction to an API token.

type APITokenResponse added in v0.29.3

type APITokenResponse struct {
	Response
	Result APIToken `json:"result"`
}

APITokenResponse is the API response for a single API token.

type APITokenRollResponse added in v0.29.3

type APITokenRollResponse struct {
	Response
	Result string `json:"result"`
}

APITokenRollResponse is the API response when rolling the token.

type APITokenVerifyBody added in v0.29.3

type APITokenVerifyBody struct {
	ID        string    `json:"id"`
	Status    string    `json:"status"`
	NotBefore time.Time `json:"not_before"`
	ExpiresOn time.Time `json:"expires_on"`
}

APITokenVerifyBody is the API body for verifying a token.

type APITokenVerifyResponse added in v0.29.3

type APITokenVerifyResponse struct {
	Response
	Result APITokenVerifyBody `json:"result"`
}

APITokenVerifyResponse is the API response for verifying a token.

type AccessApplication added in v0.29.3

type AccessApplication struct {
	ID                      string                        `json:"id,omitempty"`
	CreatedAt               *time.Time                    `json:"created_at,omitempty"`
	UpdatedAt               *time.Time                    `json:"updated_at,omitempty"`
	AUD                     string                        `json:"aud,omitempty"`
	Name                    string                        `json:"name"`
	Domain                  string                        `json:"domain"`
	Type                    AccessApplicationType         `json:"type,omitempty"`
	SessionDuration         string                        `json:"session_duration,omitempty"`
	AutoRedirectToIdentity  bool                          `json:"auto_redirect_to_identity,omitempty"`
	EnableBindingCookie     bool                          `json:"enable_binding_cookie,omitempty"`
	AllowedIdps             []string                      `json:"allowed_idps,omitempty"`
	CorsHeaders             *AccessApplicationCorsHeaders `json:"cors_headers,omitempty"`
	CustomDenyMessage       string                        `json:"custom_deny_message,omitempty"`
	CustomDenyURL           string                        `json:"custom_deny_url,omitempty"`
	HttpOnlyCookieAttribute bool                          `json:"http_only_cookie_attribute,omitempty"`
	SameSiteCookieAttribute string                        `json:"same_site_cookie_attribute,omitempty"`
	LogoURL                 string                        `json:"logo_url,omitempty"`
	SkipInterstitial        bool                          `json:"skip_interstitial,omitempty"`
	AppLauncherVisible      bool                          `json:"app_launcher_visible,omitempty"`
}

AccessApplication represents an Access application.

type AccessApplicationCorsHeaders added in v0.29.3

type AccessApplicationCorsHeaders struct {
	AllowedMethods   []string `json:"allowed_methods,omitempty"`
	AllowedOrigins   []string `json:"allowed_origins,omitempty"`
	AllowedHeaders   []string `json:"allowed_headers,omitempty"`
	AllowAllMethods  bool     `json:"allow_all_methods,omitempty"`
	AllowAllHeaders  bool     `json:"allow_all_headers,omitempty"`
	AllowAllOrigins  bool     `json:"allow_all_origins,omitempty"`
	AllowCredentials bool     `json:"allow_credentials,omitempty"`
	MaxAge           int      `json:"max_age,omitempty"`
}

AccessApplicationCorsHeaders represents the CORS HTTP headers for an Access Application.

type AccessApplicationDetailResponse added in v0.29.3

type AccessApplicationDetailResponse struct {
	Success  bool              `json:"success"`
	Errors   []string          `json:"errors"`
	Messages []string          `json:"messages"`
	Result   AccessApplication `json:"result"`
}

AccessApplicationDetailResponse is the API response, containing a single access application.

type AccessApplicationListResponse added in v0.29.3

type AccessApplicationListResponse struct {
	Result []AccessApplication `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessApplicationListResponse represents the response from the list access applications endpoint.

type AccessApplicationType added in v0.29.3

type AccessApplicationType string

AccessApplicationType represents the application type.

const (
	SelfHosted AccessApplicationType = "self_hosted"
	SSH        AccessApplicationType = "ssh"
	VNC        AccessApplicationType = "vnc"
	File       AccessApplicationType = "file"
	Bookmark   AccessApplicationType = "bookmark"
)

These constants represent all valid application types.

type AccessApprovalGroup added in v0.29.3

type AccessApprovalGroup struct {
	EmailListUuid   string   `json:"email_list_uuid,omitempty"`
	EmailAddresses  []string `json:"email_addresses,omitempty"`
	ApprovalsNeeded int      `json:"approvals_needed,omitempty"`
}

type AccessAuditLogFilterOptions added in v0.29.3

type AccessAuditLogFilterOptions struct {
	Direction string
	Since     *time.Time
	Until     *time.Time
	Limit     int
}

AccessAuditLogFilterOptions provides the structure of available audit log filters.

func (AccessAuditLogFilterOptions) Encode added in v0.29.3

Encode is a custom method for encoding the filter options into a usable HTTP query parameter string.

type AccessAuditLogListResponse added in v0.29.3

type AccessAuditLogListResponse struct {
	Result []AccessAuditLogRecord `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessAuditLogListResponse represents the response from the list access applications endpoint.

type AccessAuditLogRecord added in v0.29.3

type AccessAuditLogRecord struct {
	UserEmail  string     `json:"user_email"`
	IPAddress  string     `json:"ip_address"`
	AppUID     string     `json:"app_uid"`
	AppDomain  string     `json:"app_domain"`
	Action     string     `json:"action"`
	Connection string     `json:"connection"`
	Allowed    bool       `json:"allowed"`
	CreatedAt  *time.Time `json:"created_at"`
	RayID      string     `json:"ray_id"`
}

AccessAuditLogRecord is the structure of a single Access Audit Log entry.

type AccessCACertificate added in v0.29.3

type AccessCACertificate struct {
	ID        string `json:"id"`
	Aud       string `json:"aud"`
	PublicKey string `json:"public_key"`
}

AccessCACertificate is the structure of the CA certificate used for short lived certificates.

type AccessCACertificateListResponse added in v0.29.3

type AccessCACertificateListResponse struct {
	Response
	Result []AccessCACertificate `json:"result"`
}

AccessCACertificateListResponse represents the response of all CA certificates within Access.

type AccessCACertificateResponse added in v0.29.3

type AccessCACertificateResponse struct {
	Response
	Result AccessCACertificate `json:"result"`
}

AccessCACertificateResponse represents the response of a single CA certificate.

type AccessGroup added in v0.29.3

type AccessGroup struct {
	ID        string     `json:"id,omitempty"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
	Name      string     `json:"name"`

	// The include group works like an OR logical operator. The user must
	// satisfy one of the rules.
	Include []interface{} `json:"include"`

	// The exclude group works like a NOT logical operator. The user must
	// not satisfy all of the rules in exclude.
	Exclude []interface{} `json:"exclude"`

	// The require group works like a AND logical operator. The user must
	// satisfy all of the rules in require.
	Require []interface{} `json:"require"`
}

AccessGroup defines a group for allowing or disallowing access to one or more Access applications.

type AccessGroupAccessGroup added in v0.29.3

type AccessGroupAccessGroup struct {
	Group struct {
		ID string `json:"id"`
	} `json:"group"`
}

AccessGroupAccessGroup is used for managing access based on an access group.

type AccessGroupAnyValidServiceToken added in v0.29.3

type AccessGroupAnyValidServiceToken struct {
	AnyValidServiceToken struct{} `json:"any_valid_service_token"`
}

AccessGroupAnyValidServiceToken is used for managing access for all valid service tokens (not restricted).

type AccessGroupAuthMethod added in v0.29.3

type AccessGroupAuthMethod struct {
	AuthMethod struct {
		AuthMethod string `json:"auth_method"`
	} `json:"auth_method"`
}

AccessGroupAuthMethod is used for managing access by the "amr" (Authentication Methods References) identifier. For example, an application may want to require that users authenticate using a hardware key by setting the "auth_method" to "swk". A list of values are listed here: https://tools.ietf.org/html/rfc8176#section-2. Custom values are supported as well.

type AccessGroupAzure added in v0.29.3

type AccessGroupAzure struct {
	AzureAD struct {
		ID                 string `json:"id"`
		IdentityProviderID string `json:"identity_provider_id"`
	} `json:"azureAD"`
}

AccessGroupAzure is used to configure access based on a Azure group.

type AccessGroupCertificate added in v0.29.3

type AccessGroupCertificate struct {
	Certificate struct{} `json:"certificate"`
}

AccessGroupCertificate is used for managing access to based on a valid mTLS certificate being presented.

type AccessGroupCertificateCommonName added in v0.29.3

type AccessGroupCertificateCommonName struct {
	CommonName struct {
		CommonName string `json:"common_name"`
	} `json:"common_name"`
}

AccessGroupCertificateCommonName is used for managing access based on a common name within a certificate.

type AccessGroupDetailResponse added in v0.29.3

type AccessGroupDetailResponse struct {
	Success  bool        `json:"success"`
	Errors   []string    `json:"errors"`
	Messages []string    `json:"messages"`
	Result   AccessGroup `json:"result"`
}

AccessGroupDetailResponse is the API response, containing a single access group.

type AccessGroupDevicePosture added in v0.29.3

type AccessGroupDevicePosture struct {
	DevicePosture struct {
		ID string `json:"integration_uid"`
	} `json:"device_posture"`
}

AccessGroupDevicePosture restricts the application to specific devices

type AccessGroupEmail added in v0.29.3

type AccessGroupEmail struct {
	Email struct {
		Email string `json:"email"`
	} `json:"email"`
}

AccessGroupEmail is used for managing access based on the email. For example, restrict access to users with the email addresses `test@example.com` or `someone@example.com`.

type AccessGroupEmailDomain added in v0.29.3

type AccessGroupEmailDomain struct {
	EmailDomain struct {
		Domain string `json:"domain"`
	} `json:"email_domain"`
}

AccessGroupEmailDomain is used for managing access based on an email domain domain such as `example.com` instead of individual addresses.

type AccessGroupEveryone added in v0.29.3

type AccessGroupEveryone struct {
	Everyone struct{} `json:"everyone"`
}

AccessGroupEveryone is used for managing access to everyone.

type AccessGroupGSuite added in v0.29.3

type AccessGroupGSuite struct {
	Gsuite struct {
		Email              string `json:"email"`
		IdentityProviderID string `json:"identity_provider_id"`
	} `json:"gsuite"`
}

AccessGroupGSuite is used to configure access based on GSuite group.

type AccessGroupGeo added in v0.29.3

type AccessGroupGeo struct {
	Geo struct {
		CountryCode string `json:"country_code"`
	} `json:"geo"`
}

AccessGroupGeo is used for managing access based on the country code.

type AccessGroupGitHub added in v0.29.3

type AccessGroupGitHub struct {
	GitHubOrganization struct {
		Name               string `json:"name"`
		Team               string `json:"team,omitempty"`
		IdentityProviderID string `json:"identity_provider_id"`
	} `json:"github-organization"`
}

AccessGroupGitHub is used to configure access based on a GitHub organisation.

type AccessGroupIP added in v0.29.3

type AccessGroupIP struct {
	IP struct {
		IP string `json:"ip"`
	} `json:"ip"`
}

AccessGroupIP is used for managing access based in the IP. It accepts individual IPs or CIDRs.

type AccessGroupListResponse added in v0.29.3

type AccessGroupListResponse struct {
	Result []AccessGroup `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessGroupListResponse represents the response from the list access group endpoint.

type AccessGroupLoginMethod added in v0.29.3

type AccessGroupLoginMethod struct {
	LoginMethod struct {
		ID string `json:"id"`
	} `json:"login_method"`
}

AccessGroupLoginMethod restricts the application to specific IdP instances.

type AccessGroupOkta added in v0.29.3

type AccessGroupOkta struct {
	Okta struct {
		Name               string `json:"name"`
		IdentityProviderID string `json:"identity_provider_id"`
	} `json:"okta"`
}

AccessGroupOkta is used to configure access based on a Okta group.

type AccessGroupSAML added in v0.29.3

type AccessGroupSAML struct {
	Saml struct {
		AttributeName      string `json:"attribute_name"`
		AttributeValue     string `json:"attribute_value"`
		IdentityProviderID string `json:"identity_provider_id"`
	} `json:"saml"`
}

AccessGroupSAML is used to allow SAML users with a specific attribute configuration.

type AccessGroupServiceToken added in v0.29.3

type AccessGroupServiceToken struct {
	ServiceToken struct {
		ID string `json:"token_id"`
	} `json:"service_token"`
}

AccessGroupServiceToken is used for managing access based on a specific service token.

type AccessIdentityProvider added in v0.29.3

type AccessIdentityProvider struct {
	ID     string                              `json:"id,omitempty"`
	Name   string                              `json:"name"`
	Type   string                              `json:"type"`
	Config AccessIdentityProviderConfiguration `json:"config"`
}

AccessIdentityProvider is the structure of the provider object.

type AccessIdentityProviderConfiguration added in v0.29.3

type AccessIdentityProviderConfiguration struct {
	APIToken           string   `json:"api_token,omitempty"`
	AppsDomain         string   `json:"apps_domain,omitempty"`
	Attributes         []string `json:"attributes,omitempty"`
	AuthURL            string   `json:"auth_url,omitempty"`
	CentrifyAccount    string   `json:"centrify_account,omitempty"`
	CentrifyAppID      string   `json:"centrify_app_id,omitempty"`
	CertsURL           string   `json:"certs_url,omitempty"`
	ClientID           string   `json:"client_id,omitempty"`
	ClientSecret       string   `json:"client_secret,omitempty"`
	DirectoryID        string   `json:"directory_id,omitempty"`
	EmailAttributeName string   `json:"email_attribute_name,omitempty"`
	IdpPublicCert      string   `json:"idp_public_cert,omitempty"`
	IssuerURL          string   `json:"issuer_url,omitempty"`
	OktaAccount        string   `json:"okta_account,omitempty"`
	OneloginAccount    string   `json:"onelogin_account,omitempty"`
	RedirectURL        string   `json:"redirect_url,omitempty"`
	SignRequest        bool     `json:"sign_request,omitempty"`
	SsoTargetURL       string   `json:"sso_target_url,omitempty"`
	SupportGroups      bool     `json:"support_groups,omitempty"`
	TokenURL           string   `json:"token_url,omitempty"`
}

AccessIdentityProviderConfiguration is the combined structure of *all* identity provider configuration fields. This is done to simplify the use of Access products and their relationship to each other.

API reference: https://developers.cloudflare.com/access/configuring-identity-providers/

type AccessIdentityProviderListResponse added in v0.29.3

type AccessIdentityProviderListResponse struct {
	Response
	Result AccessIdentityProvider `json:"result"`
}

AccessIdentityProviderListResponse is the API response for a single Access Identity Provider.

type AccessIdentityProvidersListResponse added in v0.29.3

type AccessIdentityProvidersListResponse struct {
	Response
	Result []AccessIdentityProvider `json:"result"`
}

AccessIdentityProvidersListResponse is the API response for multiple Access Identity Providers.

type AccessKeysConfig added in v0.29.3

type AccessKeysConfig struct {
	KeyRotationIntervalDays int       `json:"key_rotation_interval_days"`
	LastKeyRotationAt       time.Time `json:"last_key_rotation_at"`
	DaysUntilNextRotation   int       `json:"days_until_next_rotation"`
}

type AccessKeysConfigUpdateRequest added in v0.29.3

type AccessKeysConfigUpdateRequest struct {
	KeyRotationIntervalDays int `json:"key_rotation_interval_days"`
}

type AccessMutualTLSCertificate added in v0.29.3

type AccessMutualTLSCertificate struct {
	ID                  string    `json:"id,omitempty"`
	CreatedAt           time.Time `json:"created_at,omitempty"`
	UpdatedAt           time.Time `json:"updated_at,omitempty"`
	ExpiresOn           time.Time `json:"expires_on,omitempty"`
	Name                string    `json:"name,omitempty"`
	Fingerprint         string    `json:"fingerprint,omitempty"`
	Certificate         string    `json:"certificate,omitempty"`
	AssociatedHostnames []string  `json:"associated_hostnames,omitempty"`
}

AccessMutualTLSCertificate is the structure of a single Access Mutual TLS certificate.

type AccessMutualTLSCertificateDetailResponse added in v0.29.3

type AccessMutualTLSCertificateDetailResponse struct {
	Response
	Result AccessMutualTLSCertificate `json:"result"`
}

AccessMutualTLSCertificateDetailResponse is the API response for a single Access Mutual TLS certificate.

type AccessMutualTLSCertificateListResponse added in v0.29.3

type AccessMutualTLSCertificateListResponse struct {
	Response
	Result []AccessMutualTLSCertificate `json:"result"`
}

AccessMutualTLSCertificateListResponse is the API response for all Access Mutual TLS certificates.

type AccessOrganization added in v0.29.3

type AccessOrganization struct {
	CreatedAt   *time.Time                    `json:"created_at"`
	UpdatedAt   *time.Time                    `json:"updated_at"`
	Name        string                        `json:"name"`
	AuthDomain  string                        `json:"auth_domain"`
	LoginDesign AccessOrganizationLoginDesign `json:"login_design"`
}

AccessOrganization represents an Access organization.

type AccessOrganizationDetailResponse added in v0.29.3

type AccessOrganizationDetailResponse struct {
	Success  bool               `json:"success"`
	Errors   []string           `json:"errors"`
	Messages []string           `json:"messages"`
	Result   AccessOrganization `json:"result"`
}

AccessOrganizationDetailResponse is the API response, containing a single access organization.

type AccessOrganizationListResponse added in v0.29.3

type AccessOrganizationListResponse struct {
	Result AccessOrganization `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessOrganizationListResponse represents the response from the list access organization endpoint.

type AccessOrganizationLoginDesign added in v0.29.3

type AccessOrganizationLoginDesign struct {
	BackgroundColor string `json:"background_color"`
	TextColor       string `json:"text_color"`
	LogoPath        string `json:"logo_path"`
}

AccessOrganizationLoginDesign represents the login design options.

type AccessPolicy added in v0.29.3

type AccessPolicy struct {
	ID         string     `json:"id,omitempty"`
	Precedence int        `json:"precedence"`
	Decision   string     `json:"decision"`
	CreatedAt  *time.Time `json:"created_at"`
	UpdatedAt  *time.Time `json:"updated_at"`
	Name       string     `json:"name"`

	PurposeJustificationRequired *bool                 `json:"purpose_justification_required,omitempty"`
	PurposeJustificationPrompt   *string               `json:"purpose_justification_prompt,omitempty"`
	ApprovalRequired             *bool                 `json:"approval_required,omitempty"`
	ApprovalGroups               []AccessApprovalGroup `json:"approval_groups"`

	// The include policy works like an OR logical operator. The user must
	// satisfy one of the rules.
	Include []interface{} `json:"include"`

	// The exclude policy works like a NOT logical operator. The user must
	// not satisfy all of the rules in exclude.
	Exclude []interface{} `json:"exclude"`

	// The require policy works like a AND logical operator. The user must
	// satisfy all of the rules in require.
	Require []interface{} `json:"require"`
}

AccessPolicy defines a policy for allowing or disallowing access to one or more Access applications.

type AccessPolicyDetailResponse added in v0.29.3

type AccessPolicyDetailResponse struct {
	Success  bool         `json:"success"`
	Errors   []string     `json:"errors"`
	Messages []string     `json:"messages"`
	Result   AccessPolicy `json:"result"`
}

AccessPolicyDetailResponse is the API response, containing a single access policy.

type AccessPolicyListResponse added in v0.29.3

type AccessPolicyListResponse struct {
	Result []AccessPolicy `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessPolicyListResponse represents the response from the list access policies endpoint.

type AccessRule added in v0.8.1

type AccessRule struct {
	ID            string                  `json:"id,omitempty"`
	Notes         string                  `json:"notes,omitempty"`
	AllowedModes  []string                `json:"allowed_modes,omitempty"`
	Mode          string                  `json:"mode,omitempty"`
	Configuration AccessRuleConfiguration `json:"configuration,omitempty"`
	Scope         AccessRuleScope         `json:"scope,omitempty"`
	CreatedOn     time.Time               `json:"created_on,omitempty"`
	ModifiedOn    time.Time               `json:"modified_on,omitempty"`
}

AccessRule represents a firewall access rule.

type AccessRuleConfiguration added in v0.8.1

type AccessRuleConfiguration struct {
	Target string `json:"target,omitempty"`
	Value  string `json:"value,omitempty"`
}

AccessRuleConfiguration represents the configuration of a firewall access rule.

type AccessRuleListResponse added in v0.8.1

type AccessRuleListResponse struct {
	Result []AccessRule `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessRuleListResponse represents the response from the list access rules endpoint.

type AccessRuleResponse added in v0.8.1

type AccessRuleResponse struct {
	Result AccessRule `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessRuleResponse represents the response from the firewall access rule endpoint.

type AccessRuleScope added in v0.8.1

type AccessRuleScope struct {
	ID    string `json:"id,omitempty"`
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
	Type  string `json:"type,omitempty"`
}

AccessRuleScope represents the scope of a firewall access rule.

type AccessServiceToken added in v0.29.3

type AccessServiceToken struct {
	ClientID  string     `json:"client_id"`
	CreatedAt *time.Time `json:"created_at"`
	ExpiresAt *time.Time `json:"expires_at"`
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	UpdatedAt *time.Time `json:"updated_at"`
}

AccessServiceToken represents an Access Service Token.

type AccessServiceTokenCreateResponse added in v0.29.3

type AccessServiceTokenCreateResponse struct {
	CreatedAt    *time.Time `json:"created_at"`
	UpdatedAt    *time.Time `json:"updated_at"`
	ExpiresAt    *time.Time `json:"expires_at"`
	ID           string     `json:"id"`
	Name         string     `json:"name"`
	ClientID     string     `json:"client_id"`
	ClientSecret string     `json:"client_secret"`
}

AccessServiceTokenCreateResponse is the same API response as the Update operation with the exception that the `ClientSecret` is present in a Create operation.

type AccessServiceTokenUpdateResponse added in v0.29.3

type AccessServiceTokenUpdateResponse struct {
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
	ExpiresAt *time.Time `json:"expires_at"`
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	ClientID  string     `json:"client_id"`
}

AccessServiceTokenUpdateResponse represents the response from the API when a new Service Token is updated. This base struct is also used in the Create as they are very similar responses.

type AccessServiceTokensCreationDetailResponse added in v0.29.3

type AccessServiceTokensCreationDetailResponse struct {
	Success  bool                             `json:"success"`
	Errors   []string                         `json:"errors"`
	Messages []string                         `json:"messages"`
	Result   AccessServiceTokenCreateResponse `json:"result"`
}

AccessServiceTokensCreationDetailResponse is the API response, containing a single Access Service Token.

type AccessServiceTokensDetailResponse added in v0.29.3

type AccessServiceTokensDetailResponse struct {
	Success  bool               `json:"success"`
	Errors   []string           `json:"errors"`
	Messages []string           `json:"messages"`
	Result   AccessServiceToken `json:"result"`
}

AccessServiceTokensDetailResponse is the API response, containing a single Access Service Token.

type AccessServiceTokensListResponse added in v0.29.3

type AccessServiceTokensListResponse struct {
	Result []AccessServiceToken `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccessServiceTokensListResponse represents the response from the list Access Service Tokens endpoint.

type AccessServiceTokensUpdateDetailResponse added in v0.29.3

type AccessServiceTokensUpdateDetailResponse struct {
	Success  bool                             `json:"success"`
	Errors   []string                         `json:"errors"`
	Messages []string                         `json:"messages"`
	Result   AccessServiceTokenUpdateResponse `json:"result"`
}

AccessServiceTokensUpdateDetailResponse is the API response, containing a single Access Service Token.

type Account added in v0.29.3

type Account struct {
	ID       string           `json:"id,omitempty"`
	Name     string           `json:"name,omitempty"`
	Type     string           `json:"type,omitempty"`
	Settings *AccountSettings `json:"settings,omitempty"`
}

Account represents the root object that owns resources.

type AccountDetailResponse added in v0.29.3

type AccountDetailResponse struct {
	Success  bool     `json:"success"`
	Errors   []string `json:"errors"`
	Messages []string `json:"messages"`
	Result   Account  `json:"result"`
}

AccountDetailResponse is the API response, containing a single Account.

type AccountListResponse added in v0.29.3

type AccountListResponse struct {
	Result []Account `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccountListResponse represents the response from the list accounts endpoint.

type AccountMember added in v0.29.3

type AccountMember struct {
	ID     string                   `json:"id"`
	Code   string                   `json:"code"`
	User   AccountMemberUserDetails `json:"user"`
	Status string                   `json:"status"`
	Roles  []AccountRole            `json:"roles"`
}

AccountMember is the definition of a member of an account.

type AccountMemberDetailResponse added in v0.29.3

type AccountMemberDetailResponse struct {
	Success  bool          `json:"success"`
	Errors   []string      `json:"errors"`
	Messages []string      `json:"messages"`
	Result   AccountMember `json:"result"`
}

AccountMemberDetailResponse is the API response, containing a single account member.

type AccountMemberInvitation added in v0.29.3

type AccountMemberInvitation struct {
	Email  string   `json:"email"`
	Roles  []string `json:"roles"`
	Status string   `json:"status,omitempty"`
}

AccountMemberInvitation represents the invitation for a new member to the account.

type AccountMemberUserDetails added in v0.29.3

type AccountMemberUserDetails struct {
	ID                             string `json:"id"`
	FirstName                      string `json:"first_name"`
	LastName                       string `json:"last_name"`
	Email                          string `json:"email"`
	TwoFactorAuthenticationEnabled bool   `json:"two_factor_authentication_enabled"`
}

AccountMemberUserDetails outlines all the personal information about a member.

type AccountMembersListResponse added in v0.29.3

type AccountMembersListResponse struct {
	Result []AccountMember `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccountMembersListResponse represents the response from the list account members endpoint.

type AccountResponse added in v0.29.3

type AccountResponse struct {
	Result Account `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccountResponse represents the response from the accounts endpoint for a single account ID.

type AccountRole added in v0.29.3

type AccountRole struct {
	ID          string                           `json:"id"`
	Name        string                           `json:"name"`
	Description string                           `json:"description"`
	Permissions map[string]AccountRolePermission `json:"permissions"`
}

AccountRole defines the roles that a member can have attached.

type AccountRoleDetailResponse added in v0.29.3

type AccountRoleDetailResponse struct {
	Success  bool        `json:"success"`
	Errors   []string    `json:"errors"`
	Messages []string    `json:"messages"`
	Result   AccountRole `json:"result"`
}

AccountRoleDetailResponse is the API response, containing a single account role.

type AccountRolePermission added in v0.29.3

type AccountRolePermission struct {
	Read bool `json:"read"`
	Edit bool `json:"edit"`
}

AccountRolePermission is the shared structure for all permissions that can be assigned to a member.

type AccountRolesListResponse added in v0.29.3

type AccountRolesListResponse struct {
	Result []AccountRole `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

AccountRolesListResponse represents the list response from the account roles.

type AccountSettings added in v0.29.3

type AccountSettings struct {
	EnforceTwoFactor bool `json:"enforce_twofactor"`
}

AccountSettings outlines the available options for an account.

type AdvertisementStatus added in v0.29.3

type AdvertisementStatus struct {
	Advertised           bool       `json:"advertised"`
	AdvertisedModifiedAt *time.Time `json:"advertised_modified_at"`
}

AdvertisementStatus contains information about the BGP status of an IP prefix

type AdvertisementStatusUpdateRequest added in v0.29.3

type AdvertisementStatusUpdateRequest struct {
	Advertised bool `json:"advertised"`
}

AdvertisementStatusUpdateRequest contains information about bgp status updates

type ArgoDetailsResponse added in v0.29.3

type ArgoDetailsResponse struct {
	Result ArgoFeatureSetting `json:"result"`
	Response
}

ArgoDetailsResponse is the API response for the argo smart routing and tiered caching response.

type ArgoFeatureSetting added in v0.29.3

type ArgoFeatureSetting struct {
	Editable   bool      `json:"editable,omitempty"`
	ID         string    `json:"id,omitempty"`
	ModifiedOn time.Time `json:"modified_on,omitempty"`
	Value      string    `json:"value"`
}

ArgoFeatureSetting is the structure of the API object for the argo smart routing and tiered caching settings.

type ArgoTunnel added in v0.29.3

type ArgoTunnel struct {
	ID          string                 `json:"id,omitempty"`
	Name        string                 `json:"name,omitempty"`
	Secret      string                 `json:"tunnel_secret,omitempty"`
	CreatedAt   *time.Time             `json:"created_at,omitempty"`
	DeletedAt   *time.Time             `json:"deleted_at,omitempty"`
	Connections []ArgoTunnelConnection `json:"connections,omitempty"`
}

ArgoTunnel is the struct definition of a tunnel.

type ArgoTunnelConnection added in v0.29.3

type ArgoTunnelConnection struct {
	ColoName           string `json:"colo_name"`
	UUID               string `json:"uuid"`
	IsPendingReconnect bool   `json:"is_pending_reconnect"`
}

ArgoTunnelConnection represents the connections associated with a tunnel.

type ArgoTunnelDetailResponse added in v0.29.3

type ArgoTunnelDetailResponse struct {
	Result ArgoTunnel `json:"result"`
	Response
}

ArgoTunnelDetailResponse is used for representing the API response payload for a single tunnel.

type ArgoTunnelsDetailResponse added in v0.29.3

type ArgoTunnelsDetailResponse struct {
	Result []ArgoTunnel `json:"result"`
	Response
}

ArgoTunnelsDetailResponse is used for representing the API response payload for multiple tunnels.

type AuditLog added in v0.29.3

type AuditLog struct {
	Action       AuditLogAction         `json:"action"`
	Actor        AuditLogActor          `json:"actor"`
	ID           string                 `json:"id"`
	Metadata     map[string]interface{} `json:"metadata"`
	NewValue     string                 `json:"newValue"`
	NewValueJSON map[string]interface{} `json:"newValueJson"`
	OldValue     string                 `json:"oldValue"`
	OldValueJSON map[string]interface{} `json:"oldValueJson"`
	Owner        AuditLogOwner          `json:"owner"`
	Resource     AuditLogResource       `json:"resource"`
	When         time.Time              `json:"when"`
}

AuditLog is an resource that represents an update in the cloudflare dash

type AuditLogAction added in v0.29.3

type AuditLogAction struct {
	Result bool   `json:"result"`
	Type   string `json:"type"`
}

AuditLogAction is a member of AuditLog, the action that was taken.

type AuditLogActor added in v0.29.3

type AuditLogActor struct {
	Email string `json:"email"`
	ID    string `json:"id"`
	IP    string `json:"ip"`
	Type  string `json:"type"`
}

AuditLogActor is a member of AuditLog, who performed the action.

type AuditLogFilter added in v0.29.3

type AuditLogFilter struct {
	ID         string
	ActorIP    string
	ActorEmail string
	Direction  string
	ZoneName   string
	Since      string
	Before     string
	PerPage    int
	Page       int
}

AuditLogFilter is an object for filtering the audit log response from the api.

func (AuditLogFilter) ToQuery added in v0.29.3

func (a AuditLogFilter) ToQuery() url.Values

ToQuery turns an audit log filter in to an HTTP Query Param list, suitable for use in a url.URL.RawQuery. It will not include empty members of the struct in the query parameters.

type AuditLogOwner added in v0.29.3

type AuditLogOwner struct {
	ID string `json:"id"`
}

AuditLogOwner is a member of AuditLog, who owns this audit log.

type AuditLogResource added in v0.29.3

type AuditLogResource struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

AuditLogResource is a member of AuditLog, what was the action performed on.

type AuditLogResponse added in v0.29.3

type AuditLogResponse struct {
	Response   Response
	Result     []AuditLog `json:"result"`
	ResultInfo `json:"result_info"`
}

AuditLogResponse is the response returned from the cloudflare v4 api

type AuthenticatedOriginPulls added in v0.29.3

type AuthenticatedOriginPulls struct {
	ID         string    `json:"id"`
	Value      string    `json:"value"`
	Editable   bool      `json:"editable"`
	ModifiedOn time.Time `json:"modified_on"`
}

AuthenticatedOriginPulls represents global AuthenticatedOriginPulls (tls_client_auth) metadata.

type AuthenticatedOriginPullsResponse added in v0.29.3

type AuthenticatedOriginPullsResponse struct {
	Response
	Result AuthenticatedOriginPulls `json:"result"`
}

AuthenticatedOriginPullsResponse represents the response from the global AuthenticatedOriginPulls (tls_client_auth) details endpoint.

type AvailableZonePlansResponse

type AvailableZonePlansResponse struct {
	Response
	Result []ZonePlan `json:"result"`
	ResultInfo
}

AvailableZonePlansResponse represents the response from the Available Plans endpoint.

type AvailableZoneRatePlansResponse added in v0.7.4

type AvailableZoneRatePlansResponse struct {
	Response
	Result     []ZoneRatePlan `json:"result"`
	ResultInfo `json:"result_info"`
}

AvailableZoneRatePlansResponse represents the response from the Available Rate Plans endpoint.

type CertificatePack added in v0.29.3

type CertificatePack struct {
	ID                 string                       `json:"id"`
	Type               string                       `json:"type"`
	Hosts              []string                     `json:"hosts"`
	Certificates       []CertificatePackCertificate `json:"certificates"`
	PrimaryCertificate string                       `json:"primary_certificate"`
}

CertificatePack is the overarching structure of a certificate pack response.

type CertificatePackAdvancedCertificate added in v0.29.3

type CertificatePackAdvancedCertificate struct {
	ID                   string   `json:"id"`
	Type                 string   `json:"type"`
	Hosts                []string `json:"hosts"`
	ValidationMethod     string   `json:"validation_method"`
	ValidityDays         int      `json:"validity_days"`
	CertificateAuthority string   `json:"certificate_authority"`
	CloudflareBranding   bool     `json:"cloudflare_branding"`
}

CertificatePackAdvancedCertificate is the structure of the advanced certificate pack certificate.

type CertificatePackCertificate added in v0.29.3

type CertificatePackCertificate struct {
	ID              string                         `json:"id"`
	Hosts           []string                       `json:"hosts"`
	Issuer          string                         `json:"issuer"`
	Signature       string                         `json:"signature"`
	Status          string                         `json:"status"`
	BundleMethod    string                         `json:"bundle_method"`
	GeoRestrictions CertificatePackGeoRestrictions `json:"geo_restrictions"`
	ZoneID          string                         `json:"zone_id"`
	UploadedOn      time.Time                      `json:"uploaded_on"`
	ModifiedOn      time.Time                      `json:"modified_on"`
	ExpiresOn       time.Time                      `json:"expires_on"`
	Priority        int                            `json:"priority"`
}

CertificatePackCertificate is the base structure of a TLS certificate that is contained within a certificate pack.

type CertificatePackGeoRestrictions added in v0.29.3

type CertificatePackGeoRestrictions struct {
	Label string `json:"label"`
}

CertificatePackGeoRestrictions is for the structure of the geographic restrictions for a TLS certificate.

type CertificatePackRequest added in v0.29.3

type CertificatePackRequest struct {
	Type  string   `json:"type"`
	Hosts []string `json:"hosts"`
}

CertificatePackRequest is used for requesting a new certificate.

type CertificatePacksAdvancedDetailResponse added in v0.29.3

type CertificatePacksAdvancedDetailResponse struct {
	Response
	Result CertificatePackAdvancedCertificate `json:"result"`
}

CertificatePacksAdvancedDetailResponse contains a single advanced certificate pack in the response.

type CertificatePacksDetailResponse added in v0.29.3

type CertificatePacksDetailResponse struct {
	Response
	Result CertificatePack `json:"result"`
}

CertificatePacksDetailResponse contains a single certificate pack in the response.

type CertificatePacksResponse added in v0.29.3

type CertificatePacksResponse struct {
	Response
	Result []CertificatePack `json:"result"`
}

CertificatePacksResponse is for responses where multiple certificates are expected.

type CreateMagicFirewallRulesetRequest added in v0.29.3

type CreateMagicFirewallRulesetRequest struct {
	Name        string                     `json:"name"`
	Description string                     `json:"description"`
	Kind        string                     `json:"kind"`
	Phase       string                     `json:"phase"`
	Rules       []MagicFirewallRulesetRule `json:"rules"`
}

CreateMagicFirewallRulesetRequest contains data for a new Firewall ruleset

type CreateMagicFirewallRulesetResponse added in v0.29.3

type CreateMagicFirewallRulesetResponse struct {
	Response
	Result MagicFirewallRuleset `json:"result"`
}

CreateMagicFirewallRulesetResponse contains response data when creating a new Magic Firewall ruleset

type CreateMagicTransitStaticRoutesRequest added in v0.29.3

type CreateMagicTransitStaticRoutesRequest struct {
	Routes []MagicTransitStaticRoute `json:"routes"`
}

CreateMagicTransitStaticRoutesRequest is an array of static routes to create

type CreateRulesetResponse added in v0.29.3

type CreateRulesetResponse struct {
	Response
	Result Ruleset `json:"result"`
}

CreateRulesetResponse contains response data when creating a new Ruleset.

type CustomHostname added in v0.7.4

type CustomHostname struct {
	ID                        string                                  `json:"id,omitempty"`
	Hostname                  string                                  `json:"hostname,omitempty"`
	CustomOriginServer        string                                  `json:"custom_origin_server,omitempty"`
	CustomOriginSNI           string                                  `json:"custom_origin_sni,omitempty"`
	SSL                       *CustomHostnameSSL                      `json:"ssl,omitempty"`
	CustomMetadata            CustomMetadata                          `json:"custom_metadata,omitempty"`
	Status                    CustomHostnameStatus                    `json:"status,omitempty"`
	VerificationErrors        []string                                `json:"verification_errors,omitempty"`
	OwnershipVerification     CustomHostnameOwnershipVerification     `json:"ownership_verification,omitempty"`
	OwnershipVerificationHTTP CustomHostnameOwnershipVerificationHTTP `json:"ownership_verification_http,omitempty"`
	CreatedAt                 *time.Time                              `json:"created_at,omitempty"`
}

CustomHostname represents a custom hostname in a zone.

type CustomHostnameFallbackOrigin added in v0.29.3

type CustomHostnameFallbackOrigin struct {
	Origin string   `json:"origin,omitempty"`
	Status string   `json:"status,omitempty"`
	Errors []string `json:"errors,omitempty"`
}

CustomHostnameFallbackOrigin represents a Custom Hostnames Fallback Origin

type CustomHostnameFallbackOriginResponse added in v0.29.3

type CustomHostnameFallbackOriginResponse struct {
	Result CustomHostnameFallbackOrigin `json:"result"`
	Response
}

CustomHostnameFallbackOriginResponse represents a response from the Custom Hostnames Fallback Origin endpoint.

type CustomHostnameListResponse added in v0.7.4

type CustomHostnameListResponse struct {
	Result []CustomHostname `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

CustomHostnameListResponse represents a response from the Custom Hostnames endpoints.

type CustomHostnameOwnershipVerification added in v0.29.3

type CustomHostnameOwnershipVerification struct {
	Type  string `json:"type,omitempty"`
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

CustomHostnameOwnershipVerification represents ownership verification status of a given custom hostname.

type CustomHostnameOwnershipVerificationHTTP added in v0.29.3

type CustomHostnameOwnershipVerificationHTTP struct {
	HTTPUrl  string `json:"http_url,omitempty"`
	HTTPBody string `json:"http_body,omitempty"`
}

CustomHostnameOwnershipVerificationHTTP represents a response from the Custom Hostnames endpoints.

type CustomHostnameResponse added in v0.7.4

type CustomHostnameResponse struct {
	Result CustomHostname `json:"result"`
	Response
}

CustomHostnameResponse represents a response from the Custom Hostnames endpoints.

type CustomHostnameSSL added in v0.7.4

type CustomHostnameSSL struct {
	ID                   string                              `json:"id,omitempty"`
	Status               string                              `json:"status,omitempty"`
	Method               string                              `json:"method,omitempty"`
	Type                 string                              `json:"type,omitempty"`
	CnameTarget          string                              `json:"cname_target,omitempty"`
	CnameName            string                              `json:"cname,omitempty"`
	TxtName              string                              `json:"txt_name,omitempty"`
	TxtValue             string                              `json:"txt_value,omitempty"`
	Wildcard             *bool                               `json:"wildcard,omitempty"`
	CustomCertificate    string                              `json:"custom_certificate,omitempty"`
	CustomKey            string                              `json:"custom_key,omitempty"`
	CertificateAuthority string                              `json:"certificate_authority,omitempty"`
	Issuer               string                              `json:"issuer,omitempty"`
	SerialNumber         string                              `json:"serial_number,omitempty"`
	Settings             CustomHostnameSSLSettings           `json:"settings,omitempty"`
	ValidationErrors     []CustomHostnameSSLValidationErrors `json:"validation_errors,omitempty"`
	HTTPUrl              string                              `json:"http_url,omitempty"`
	HTTPBody             string                              `json:"http_body,omitempty"`
}

CustomHostnameSSL represents the SSL section in a given custom hostname.

type CustomHostnameSSLSettings added in v0.29.3

type CustomHostnameSSLSettings struct {
	HTTP2         string   `json:"http2,omitempty"`
	HTTP3         string   `json:"http3,omitempty"`
	TLS13         string   `json:"tls_1_3,omitempty"`
	MinTLSVersion string   `json:"min_tls_version,omitempty"`
	Ciphers       []string `json:"ciphers,omitempty"`
	EarlyHints    string   `json:"early_hints,omitempty"`
}

CustomHostnameSSLSettings represents the SSL settings for a custom hostname.

type CustomHostnameSSLValidationErrors added in v0.29.3

type CustomHostnameSSLValidationErrors struct {
	Message string `json:"message,omitempty"`
}

CustomHostnameSSLValidationErrors represents errors that occurred during SSL validation.

type CustomHostnameStatus added in v0.29.3

type CustomHostnameStatus string

CustomHostnameStatus is the enumeration of valid state values in the CustomHostnameSSL

const (
	// PENDING status represents state of CustomHostname is pending.
	PENDING CustomHostnameStatus = "pending"
	// ACTIVE status represents state of CustomHostname is active.
	ACTIVE CustomHostnameStatus = "active"
	// MOVED status represents state of CustomHostname is moved.
	MOVED CustomHostnameStatus = "moved"
	// DELETED status represents state of CustomHostname is removed.
	DELETED CustomHostnameStatus = "deleted"
)

type CustomMetadata added in v0.7.4

type CustomMetadata map[string]interface{}

CustomMetadata defines custom metadata for the hostname. This requires logic to be implemented by Cloudflare to act on the data provided.

type CustomPage

type CustomPage struct {
	CreatedOn      time.Time   `json:"created_on"`
	ModifiedOn     time.Time   `json:"modified_on"`
	URL            interface{} `json:"url"`
	State          string      `json:"state"`
	RequiredTokens []string    `json:"required_tokens"`
	PreviewTarget  string      `json:"preview_target"`
	Description    string      `json:"description"`
	ID             string      `json:"id"`
}

CustomPage represents a custom page configuration.

type CustomPageDetailResponse added in v0.29.3

type CustomPageDetailResponse struct {
	Response
	Result CustomPage `json:"result"`
}

CustomPageDetailResponse represents the response from the custom page endpoint.

type CustomPageOptions added in v0.29.3

type CustomPageOptions struct {
	AccountID string
	ZoneID    string
}

CustomPageOptions is used to determine whether or not the operation should take place on an account or zone level based on which is provided to the function.

A non-empty value denotes desired use.

type CustomPageParameters added in v0.29.3

type CustomPageParameters struct {
	URL   interface{} `json:"url"`
	State string      `json:"state"`
}

CustomPageParameters is used to update a particular custom page with the values provided.

type CustomPageResponse

type CustomPageResponse struct {
	Response
	Result []CustomPage `json:"result"`
}

CustomPageResponse represents the response from the custom pages endpoint.

type DNSFirewallAnalytics added in v0.29.3

type DNSFirewallAnalytics struct {
	Totals DNSFirewallAnalyticsMetrics `json:"totals"`
	Min    DNSFirewallAnalyticsMetrics `json:"min"`
	Max    DNSFirewallAnalyticsMetrics `json:"max"`
}

DNSFirewallAnalytics represents a set of aggregated DNS Firewall metrics. TODO: Add the queried data and not only the aggregated values.

type DNSFirewallAnalyticsMetrics added in v0.29.3

type DNSFirewallAnalyticsMetrics struct {
	QueryCount         *int64   `json:"queryCount"`
	UncachedCount      *int64   `json:"uncachedCount"`
	StaleCount         *int64   `json:"staleCount"`
	ResponseTimeAvg    *float64 `json:"responseTimeAvg"`
	ResponseTimeMedian *float64 `json:"responseTimeMedian"`
	ResponseTime90th   *float64 `json:"responseTime90th"`
	ResponseTime99th   *float64 `json:"responseTime99th"`
}

DNSFirewallAnalyticsMetrics represents a group of aggregated DNS Firewall metrics.

type DNSFirewallCluster added in v0.29.3

type DNSFirewallCluster struct {
	ID                   string   `json:"id,omitempty"`
	Name                 string   `json:"name"`
	OriginIPs            []string `json:"origin_ips"`
	DNSFirewallIPs       []string `json:"dns_firewall_ips,omitempty"`
	MinimumCacheTTL      uint     `json:"minimum_cache_ttl,omitempty"`
	MaximumCacheTTL      uint     `json:"maximum_cache_ttl,omitempty"`
	DeprecateAnyRequests bool     `json:"deprecate_any_requests"`
	ModifiedOn           string   `json:"modified_on,omitempty"`
}

DNSFirewallCluster represents a DNS Firewall configuration.

type DNSFirewallUserAnalyticsOptions added in v0.29.3

type DNSFirewallUserAnalyticsOptions struct {
	Metrics []string
	Since   *time.Time
	Until   *time.Time
}

DNSFirewallUserAnalyticsOptions represents range and dimension selection on analytics endpoint

type DNSListResponse

type DNSListResponse struct {
	Result []DNSRecord `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

DNSListResponse represents the response from the list DNS records endpoint.

type DNSRecord

type DNSRecord struct {
	ID         string      `json:"id,omitempty"`
	Type       string      `json:"type,omitempty"`
	Name       string      `json:"name,omitempty"`
	Content    string      `json:"content,omitempty"`
	Proxiable  bool        `json:"proxiable,omitempty"`
	Proxied    *bool       `json:"proxied,omitempty"`
	TTL        int         `json:"ttl,omitempty"`
	Locked     bool        `json:"locked,omitempty"`
	ZoneID     string      `json:"zone_id,omitempty"`
	ZoneName   string      `json:"zone_name,omitempty"`
	CreatedOn  time.Time   `json:"created_on,omitempty"`
	ModifiedOn time.Time   `json:"modified_on,omitempty"`
	Data       interface{} `json:"data,omitempty"` // data returned by: SRV, LOC
	Meta       interface{} `json:"meta,omitempty"`
	Priority   *uint16     `json:"priority,omitempty"`
}

DNSRecord represents a DNS record in a zone.

type DNSRecordResponse

type DNSRecordResponse struct {
	Result DNSRecord `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

DNSRecordResponse represents the response from the DNS endpoint.

type DeleteMagicTransitStaticRouteResponse added in v0.29.3

type DeleteMagicTransitStaticRouteResponse struct {
	Response
	Result struct {
		Deleted      bool                    `json:"deleted"`
		DeletedRoute MagicTransitStaticRoute `json:"deleted_route"`
	} `json:"result"`
}

DeleteMagicTransitStaticRouteResponse contains a static route deletion response

type DevicePostureIntegration added in v0.29.3

type DevicePostureIntegration struct {
	IntegrationID string                         `json:"id,omitempty"`
	Name          string                         `json:"name,omitempty"`
	Type          string                         `json:"type,omitempty"`
	Interval      string                         `json:"interval,omitempty"`
	Config        DevicePostureIntegrationConfig `json:"config,omitempty"`
}

DevicePosturIntegration represents a device posture integration.

type DevicePostureIntegrationConfig added in v0.29.3

type DevicePostureIntegrationConfig struct {
	ClientID     string `json:"client_id,omitempty"`
	ClientSecret string `json:"client_secret,omitempty"`
	AuthUrl      string `json:"auth_url,omitempty"`
	ApiUrl       string `json:"api_url,omitempty"`
}

DevicePostureIntegrationConfig contains authentication information for a device posture integration.

type DevicePostureIntegrationListResponse added in v0.29.3

type DevicePostureIntegrationListResponse struct {
	Result []DevicePostureIntegration `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

DevicePostureIntegrationListResponse represents the response from the list device posture integrations endpoint.

type DevicePostureIntegrationResponse added in v0.29.3

type DevicePostureIntegrationResponse struct {
	Result DevicePostureIntegration `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

DevicePostureIntegrationResponse represents the response from the get device posture integrations endpoint.

type DevicePostureRule added in v0.29.3

type DevicePostureRule struct {
	ID          string                   `json:"id,omitempty"`
	Type        string                   `json:"type"`
	Name        string                   `json:"name"`
	Description string                   `json:"description,omitempty"`
	Schedule    string                   `json:"schedule,omitempty"`
	Match       []DevicePostureRuleMatch `json:"match,omitempty"`
	Input       DevicePostureRuleInput   `json:"input,omitempty"`
}

DevicePostureRule represents a device posture rule.

type DevicePostureRuleDetailResponse added in v0.29.3

type DevicePostureRuleDetailResponse struct {
	Response
	Result DevicePostureRule `json:"result"`
}

DevicePostureRuleDetailResponse is the API response, containing a single device posture rule.

type DevicePostureRuleInput added in v0.29.3

type DevicePostureRuleInput struct {
	ID               string `json:"id,omitempty"`
	Path             string `json:"path,omitempty"`
	Exists           bool   `json:"exists,omitempty"`
	Thumbprint       string `json:"thumbprint,omitempty"`
	Sha256           string `json:"sha256,omitempty"`
	Running          bool   `json:"running,omitempty"`
	RequireAll       bool   `json:"requireAll,omitempty"`
	Enabled          bool   `json:"enabled,omitempty"`
	Version          string `json:"version,omitempty"`
	Operator         string `json:"operator,omitempty"`
	Domain           string `json:"domain,omitempty"`
	ComplianceStatus string `json:"compliance_status,omitempty"`
	ConnectionID     string `json:"connection_id,omitempty"`
}

DevicePostureRuleInput represents the value to be checked against.

type DevicePostureRuleListResponse added in v0.29.3

type DevicePostureRuleListResponse struct {
	Result []DevicePostureRule `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

DevicePostureRuleListResponse represents the response from the list device posture rules endpoint.

type DevicePostureRuleMatch added in v0.29.3

type DevicePostureRuleMatch struct {
	Platform string `json:"platform,omitempty"`
}

DevicePostureRuleMatch represents the conditions that the client must match to run the rule.

type DiagnosticsTracerouteConfiguration added in v0.29.3

type DiagnosticsTracerouteConfiguration struct {
	Targets []string                                  `json:"targets"`
	Colos   []string                                  `json:"colos,omitempty"`
	Options DiagnosticsTracerouteConfigurationOptions `json:"options,omitempty"`
}

DiagnosticsTracerouteConfiguration is the overarching structure of the diagnostics traceroute requests.

type DiagnosticsTracerouteConfigurationOptions added in v0.29.3

type DiagnosticsTracerouteConfigurationOptions struct {
	PacketsPerTTL int    `json:"packets_per_ttl"`
	PacketType    string `json:"packet_type"`
	MaxTTL        int    `json:"max_ttl"`
	WaitTime      int    `json:"wait_time"`
}

DiagnosticsTracerouteConfigurationOptions contains the options for performing traceroutes.

type DiagnosticsTracerouteResponse added in v0.29.3

type DiagnosticsTracerouteResponse struct {
	Response
	Result []DiagnosticsTracerouteResponseResult `json:"result"`
}

DiagnosticsTracerouteResponse is the outer response of the API response.

type DiagnosticsTracerouteResponseColo added in v0.29.3

type DiagnosticsTracerouteResponseColo struct {
	Name string `json:"name"`
	City string `json:"city"`
}

DiagnosticsTracerouteResponseColo contains the Name and City of a colocation.

type DiagnosticsTracerouteResponseColos added in v0.29.3

type DiagnosticsTracerouteResponseColos struct {
	Error            string                              `json:"error"`
	Colo             DiagnosticsTracerouteResponseColo   `json:"colo"`
	TracerouteTimeMs int                                 `json:"traceroute_time_ms"`
	TargetSummary    DiagnosticsTracerouteResponseNodes  `json:"target_summary"`
	Hops             []DiagnosticsTracerouteResponseHops `json:"hops"`
}

DiagnosticsTracerouteResponseColos is the summary struct of a colocation test.

type DiagnosticsTracerouteResponseHops added in v0.29.3

type DiagnosticsTracerouteResponseHops struct {
	PacketsTTL  int                                  `json:"packets_ttl"`
	PacketsSent int                                  `json:"packets_sent"`
	PacketsLost int                                  `json:"packets_lost"`
	Nodes       []DiagnosticsTracerouteResponseNodes `json:"nodes"`
}

DiagnosticsTracerouteResponseHops holds packet and node information of the hops.

type DiagnosticsTracerouteResponseNodes added in v0.29.3

type DiagnosticsTracerouteResponseNodes struct {
	Asn         string  `json:"asn"`
	IP          string  `json:"ip"`
	Name        string  `json:"name"`
	PacketCount int     `json:"packet_count"`
	MeanRttMs   float64 `json:"mean_rtt_ms"`
	StdDevRttMs float64 `json:"std_dev_rtt_ms"`
	MinRttMs    float64 `json:"min_rtt_ms"`
	MaxRttMs    float64 `json:"max_rtt_ms"`
}

DiagnosticsTracerouteResponseNodes holds a summary of nodes contacted in the traceroute.

type DiagnosticsTracerouteResponseResult added in v0.29.3

type DiagnosticsTracerouteResponseResult struct {
	Target string                               `json:"target"`
	Colos  []DiagnosticsTracerouteResponseColos `json:"colos"`
}

DiagnosticsTracerouteResponseResult is the inner API response for the traceroute request.

type Duration added in v0.29.3

type Duration struct {
	time.Duration
}

Duration implements json.Marshaler and json.Unmarshaler for time.Duration using the fmt.Stringer interface of time.Duration and time.ParseDuration.

Example
d := Duration{1 * time.Second}
fmt.Println(d)

buf, err := json.Marshal(d)
fmt.Println(string(buf), err)

err = json.Unmarshal([]byte(`"5s"`), &d)
fmt.Println(d, err)

d.Duration += time.Second
fmt.Println(d, err)
Output:

1s
"1s" <nil>
5s <nil>
6s <nil>

func (Duration) MarshalJSON added in v0.29.3

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON encodes a Duration as a JSON string formatted using String.

func (*Duration) UnmarshalJSON added in v0.29.3

func (d *Duration) UnmarshalJSON(buf []byte) error

UnmarshalJSON decodes a Duration from a JSON string parsed using time.ParseDuration.

type FallbackDomain added in v0.29.3

type FallbackDomain struct {
	Suffix      string   `json:"suffix,omitempty"`
	Description string   `json:"description,omitempty"`
	DNSServer   []string `json:"dns_server,omitempty"`
}

FallbackDomain represents the individual domain struct.

type FallbackDomainResponse added in v0.29.3

type FallbackDomainResponse struct {
	Response
	Result []FallbackDomain `json:"result"`
}

FallbackDomainResponse represents the response from the get fallback domain endpoints.

type FallbackOrigin added in v0.29.3

type FallbackOrigin struct {
	Value string `json:"value"`
	ID    string `json:"id,omitempty"`
}

FallbackOrigin describes a fallback origin

type FallbackOriginResponse added in v0.29.3

type FallbackOriginResponse struct {
	Response
	Result FallbackOrigin `json:"result"`
}

FallbackOriginResponse represents the response from the fallback_origin endpoint

type Filter added in v0.29.3

type Filter struct {
	ID          string `json:"id,omitempty"`
	Expression  string `json:"expression"`
	Paused      bool   `json:"paused"`
	Description string `json:"description"`

	// Property is mentioned in documentation however isn't populated in
	// any of the API requests. For now, let's just omit it unless it's
	// provided.
	Ref string `json:"ref,omitempty"`
}

Filter holds the structure of the filter type.

type FilterDetailResponse added in v0.29.3

type FilterDetailResponse struct {
	Result     Filter `json:"result"`
	ResultInfo `json:"result_info"`
	Response
}

FilterDetailResponse is the API response that is returned for requesting a single filter on a zone.

type FilterValidateExpression added in v0.29.3

type FilterValidateExpression struct {
	Expression string `json:"expression"`
}

FilterValidateExpression represents the JSON payload for checking an expression.

type FilterValidateExpressionResponse added in v0.29.3

type FilterValidateExpressionResponse struct {
	Success bool                                `json:"success"`
	Errors  []FilterValidationExpressionMessage `json:"errors"`
}

FilterValidateExpressionResponse represents the API response for checking the expression. It conforms to the JSON API approach however we don't need all of the fields exposed.

type FilterValidationExpressionMessage added in v0.29.3

type FilterValidationExpressionMessage struct {
	Message string `json:"message"`
}

FilterValidationExpressionMessage represents the API error message.

type FiltersDetailResponse added in v0.29.3

type FiltersDetailResponse struct {
	Result     []Filter `json:"result"`
	ResultInfo `json:"result_info"`
	Response
}

FiltersDetailResponse is the API response that is returned for requesting all filters on a zone.

type FirewallRule added in v0.29.3

type FirewallRule struct {
	ID          string      `json:"id,omitempty"`
	Paused      bool        `json:"paused"`
	Description string      `json:"description"`
	Action      string      `json:"action"`
	Priority    interface{} `json:"priority"`
	Filter      Filter      `json:"filter"`
	Products    []string    `json:"products,omitempty"`
	CreatedOn   time.Time   `json:"created_on,omitempty"`
	ModifiedOn  time.Time   `json:"modified_on,omitempty"`
}

FirewallRule is the struct of the firewall rule.

type FirewallRuleResponse added in v0.29.3

type FirewallRuleResponse struct {
	Result     FirewallRule `json:"result"`
	ResultInfo `json:"result_info"`
	Response
}

FirewallRuleResponse is the API response that is returned for requesting a single firewall rule on a zone.

type FirewallRulesDetailResponse added in v0.29.3

type FirewallRulesDetailResponse struct {
	Result     []FirewallRule `json:"result"`
	ResultInfo `json:"result_info"`
	Response
}

FirewallRulesDetailResponse is the API response for the firewall rules.

type GetAdvertisementStatusResponse added in v0.29.3

type GetAdvertisementStatusResponse struct {
	Response
	Result AdvertisementStatus `json:"result"`
}

GetAdvertisementStatusResponse contains an API Response for the BGP status of the IP Prefix

type GetIPPrefixResponse added in v0.29.3

type GetIPPrefixResponse struct {
	Response
	Result IPPrefix `json:"result"`
}

GetIPPrefixResponse contains a specific IP prefix's API Response

type GetMagicFirewallRulesetResponse added in v0.29.3

type GetMagicFirewallRulesetResponse struct {
	Response
	Result MagicFirewallRuleset `json:"result"`
}

GetMagicFirewallRulesetResponse contains a single Magic Firewall Ruleset

type GetMagicTransitStaticRouteResponse added in v0.29.3

type GetMagicTransitStaticRouteResponse struct {
	Response
	Result struct {
		Route MagicTransitStaticRoute `json:"route"`
	} `json:"result"`
}

GetMagicTransitStaticRouteResponse contains a response including exactly one static route

type GetRulesetResponse added in v0.29.3

type GetRulesetResponse struct {
	Response
	Result Ruleset `json:"result"`
}

GetRulesetResponse contains a single Ruleset.

type Healthcheck added in v0.29.3

type Healthcheck struct {
	ID                   string                  `json:"id,omitempty"`
	CreatedOn            *time.Time              `json:"created_on,omitempty"`
	ModifiedOn           *time.Time              `json:"modified_on,omitempty"`
	Name                 string                  `json:"name"`
	Description          string                  `json:"description"`
	Suspended            bool                    `json:"suspended"`
	Address              string                  `json:"address"`
	Retries              int                     `json:"retries,omitempty"`
	Timeout              int                     `json:"timeout,omitempty"`
	Interval             int                     `json:"interval,omitempty"`
	ConsecutiveSuccesses int                     `json:"consecutive_successes,omitempty"`
	ConsecutiveFails     int                     `json:"consecutive_fails,omitempty"`
	Type                 string                  `json:"type,omitempty"`
	CheckRegions         []string                `json:"check_regions"`
	HTTPConfig           *HealthcheckHTTPConfig  `json:"http_config,omitempty"`
	TCPConfig            *HealthcheckTCPConfig   `json:"tcp_config,omitempty"`
	Notification         HealthcheckNotification `json:"notification,omitempty"`
	Status               string                  `json:"status"`
	FailureReason        string                  `json:"failure_reason"`
}

Healthcheck describes a Healthcheck object.

type HealthcheckHTTPConfig added in v0.29.3

type HealthcheckHTTPConfig struct {
	Method          string              `json:"method"`
	Port            uint16              `json:"port,omitempty"`
	Path            string              `json:"path"`
	ExpectedCodes   []string            `json:"expected_codes"`
	ExpectedBody    string              `json:"expected_body"`
	FollowRedirects bool                `json:"follow_redirects"`
	AllowInsecure   bool                `json:"allow_insecure"`
	Header          map[string][]string `json:"header"`
}

HealthcheckHTTPConfig describes configuration for a HTTP healthcheck.

type HealthcheckListResponse added in v0.29.3

type HealthcheckListResponse struct {
	Response
	Result     []Healthcheck `json:"result"`
	ResultInfo `json:"result_info"`
}

HealthcheckListResponse is the API response, containing an array of healthchecks.

type HealthcheckNotification added in v0.29.3

type HealthcheckNotification struct {
	Suspended      bool     `json:"suspended,omitempty"`
	EmailAddresses []string `json:"email_addresses,omitempty"`
}

HealthcheckNotification describes notification configuration for a healthcheck.

type HealthcheckResponse added in v0.29.3

type HealthcheckResponse struct {
	Response
	Result Healthcheck `json:"result"`
}

HealthcheckResponse is the API response, containing a single healthcheck.

type HealthcheckTCPConfig added in v0.29.3

type HealthcheckTCPConfig struct {
	Method string `json:"method"`
	Port   uint16 `json:"port,omitempty"`
}

HealthcheckTCPConfig describes configuration for a TCP healthcheck.

type IPList added in v0.29.3

type IPList struct {
	ID                    string     `json:"id"`
	Name                  string     `json:"name"`
	Description           string     `json:"description"`
	Kind                  string     `json:"kind"`
	NumItems              int        `json:"num_items"`
	NumReferencingFilters int        `json:"num_referencing_filters"`
	CreatedOn             *time.Time `json:"created_on"`
	ModifiedOn            *time.Time `json:"modified_on"`
}

IPList contains information about an IP List

type IPListBulkOperation added in v0.29.3

type IPListBulkOperation struct {
	ID        string     `json:"id"`
	Status    string     `json:"status"`
	Error     string     `json:"error"`
	Completed *time.Time `json:"completed"`
}

IPListBulkOperation contains information about a Bulk Operation

type IPListBulkOperationResponse added in v0.29.3

type IPListBulkOperationResponse struct {
	Response
	Result IPListBulkOperation `json:"result"`
}

IPListBulkOperationResponse contains information about a Bulk Operation

type IPListCreateRequest added in v0.29.3

type IPListCreateRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Kind        string `json:"kind"`
}

IPListCreateRequest contains data for a new IP List

type IPListDeleteResponse added in v0.29.3

type IPListDeleteResponse struct {
	Response
	Result struct {
		ID string `json:"id"`
	} `json:"result"`
}

IPListDeleteResponse contains information about the deletion of an IP List

type IPListItem added in v0.29.3

type IPListItem struct {
	ID         string     `json:"id"`
	IP         string     `json:"ip"`
	Comment    string     `json:"comment"`
	CreatedOn  *time.Time `json:"created_on"`
	ModifiedOn *time.Time `json:"modified_on"`
}

IPListItem contains information about a single IP List Item

type IPListItemCreateRequest added in v0.29.3

type IPListItemCreateRequest struct {
	IP      string `json:"ip"`
	Comment string `json:"comment"`
}

IPListItemCreateRequest contains data for a new IP List Item

type IPListItemCreateResponse added in v0.29.3

type IPListItemCreateResponse struct {
	Response
	Result struct {
		OperationID string `json:"operation_id"`
	} `json:"result"`
}

IPListItemCreateResponse contains information about the creation of an IP List Item

type IPListItemDeleteItemRequest added in v0.29.3

type IPListItemDeleteItemRequest struct {
	ID string `json:"id"`
}

IPListItemDeleteItemRequest contains single IP List Items that shall be deleted

type IPListItemDeleteRequest added in v0.29.3

type IPListItemDeleteRequest struct {
	Items []IPListItemDeleteItemRequest `json:"items"`
}

IPListItemDeleteRequest wraps IP List Items that shall be deleted

type IPListItemDeleteResponse added in v0.29.3

type IPListItemDeleteResponse struct {
	Response
	Result struct {
		OperationID string `json:"operation_id"`
	} `json:"result"`
}

IPListItemDeleteResponse contains information about the deletion of an IP List Item

type IPListItemsGetResponse added in v0.29.3

type IPListItemsGetResponse struct {
	Response
	Result IPListItem `json:"result"`
}

IPListItemsGetResponse contains information about a single IP List Item

type IPListItemsListResponse added in v0.29.3

type IPListItemsListResponse struct {
	Response
	ResultInfo `json:"result_info"`
	Result     []IPListItem `json:"result"`
}

IPListItemsListResponse contains information about IP List Items

type IPListListResponse added in v0.29.3

type IPListListResponse struct {
	Response
	Result []IPList `json:"result"`
}

IPListListResponse contains a slice of IP Lists

type IPListResponse added in v0.29.3

type IPListResponse struct {
	Response
	Result IPList `json:"result"`
}

IPListResponse contains a single IP List

type IPListUpdateRequest added in v0.29.3

type IPListUpdateRequest struct {
	Description string `json:"description"`
}

IPListUpdateRequest contains data for an IP List update

type IPPrefix added in v0.29.3

type IPPrefix struct {
	ID                   string     `json:"id"`
	CreatedAt            *time.Time `json:"created_at"`
	ModifiedAt           *time.Time `json:"modified_at"`
	CIDR                 string     `json:"cidr"`
	AccountID            string     `json:"account_id"`
	Description          string     `json:"description"`
	Approved             string     `json:"approved"`
	OnDemandEnabled      bool       `json:"on_demand_enabled"`
	OnDemandLocked       bool       `json:"on_demand_locked"`
	Advertised           bool       `json:"advertised"`
	AdvertisedModifiedAt *time.Time `json:"advertised_modified_at"`
}

IPPrefix contains information about an IP prefix

type IPPrefixUpdateRequest added in v0.29.3

type IPPrefixUpdateRequest struct {
	Description string `json:"description"`
}

IPPrefixUpdateRequest contains information about prefix updates

type IPRanges

type IPRanges struct {
	IPv4CIDRs      []string `json:"ipv4_cidrs"`
	IPv6CIDRs      []string `json:"ipv6_cidrs"`
	ChinaIPv4CIDRs []string `json:"china_ipv4_cidrs"`
	ChinaIPv6CIDRs []string `json:"china_ipv6_cidrs"`
}

IPRanges contains lists of IPv4 and IPv6 CIDRs.

func IPs

func IPs() (IPRanges, error)

IPs gets a list of Cloudflare's IP ranges.

This does not require logging in to the API.

API reference: https://api.cloudflare.com/#cloudflare-ips

type IPRangesResponse added in v0.29.3

type IPRangesResponse struct {
	IPv4CIDRs  []string `json:"ipv4_cidrs"`
	IPv6CIDRs  []string `json:"ipv6_cidrs"`
	ChinaColos []string `json:"china_colos"`
}

IPRangesResponse contains the structure for the API response, not modified.

type IPsResponse

type IPsResponse struct {
	Response
	Result IPRangesResponse `json:"result"`
}

IPsResponse is the API response containing a list of IPs.

type KeylessSSL

type KeylessSSL struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Host        string    `json:"host"`
	Port        int       `json:"port"`
	Status      string    `json:"status"`
	Enabled     bool      `json:"enabled"`
	Permissions []string  `json:"permissions"`
	CreatedOn   time.Time `json:"created_on"`
	ModifiedOn  time.Time `json:"modified_on"`
}

KeylessSSL represents Keyless SSL configuration.

type KeylessSSLCreateRequest added in v0.29.3

type KeylessSSLCreateRequest struct {
	Host         string `json:"host"`
	Port         int    `json:"port"`
	Certificate  string `json:"certificate"`
	Name         string `json:"name,omitempty"`
	BundleMethod string `json:"bundle_method,omitempty"`
}

KeylessSSLCreateRequest represents the request format made for creating KeylessSSL.

type KeylessSSLDetailResponse added in v0.29.3

type KeylessSSLDetailResponse struct {
	Response
	Result KeylessSSL `json:"result"`
}

KeylessSSLDetailResponse is the API response, containing a single Keyless SSL.

type KeylessSSLListResponse added in v0.29.3

type KeylessSSLListResponse struct {
	Response
	Result []KeylessSSL `json:"result"`
}

KeylessSSLListResponse represents the response from the Keyless SSL list endpoint.

type KeylessSSLUpdateRequest added in v0.29.3

type KeylessSSLUpdateRequest struct {
	Host    string `json:"host,omitempty"`
	Name    string `json:"name,omitempty"`
	Port    int    `json:"port,omitempty"`
	Enabled *bool  `json:"enabled,omitempty"`
}

KeylessSSLUpdateRequest represents the request for updating KeylessSSL.

type ListIPPrefixResponse added in v0.29.3

type ListIPPrefixResponse struct {
	Response
	Result []IPPrefix `json:"result"`
}

ListIPPrefixResponse contains a slice of IP prefixes

type ListMagicFirewallRulesetResponse added in v0.29.3

type ListMagicFirewallRulesetResponse struct {
	Response
	Result []MagicFirewallRuleset `json:"result"`
}

ListMagicFirewallRulesetResponse contains a list of Magic Firewall rulesets

type ListMagicTransitStaticRoutesResponse added in v0.29.3

type ListMagicTransitStaticRoutesResponse struct {
	Response
	Result struct {
		Routes []MagicTransitStaticRoute `json:"routes"`
	} `json:"result"`
}

ListMagicTransitStaticRoutesResponse contains a response including Magic Transit static routes

type ListRulesetResponse added in v0.29.3

type ListRulesetResponse struct {
	Response
	Result []Ruleset `json:"result"`
}

ListRulesetResponse contains all Rulesets.

type ListStorageKeysResponse added in v0.29.3

type ListStorageKeysResponse struct {
	Response
	Result     []StorageKey `json:"result"`
	ResultInfo `json:"result_info"`
}

ListStorageKeysResponse contains a slice of keys belonging to a storage namespace, pagination information, and an embedded response struct

type ListWorkersKVNamespacesResponse added in v0.29.3

type ListWorkersKVNamespacesResponse struct {
	Response
	Result     []WorkersKVNamespace `json:"result"`
	ResultInfo `json:"result_info"`
}

ListWorkersKVNamespacesResponse contains a slice of storage namespaces associated with an account, pagination information, and an embedded response struct

type ListWorkersKVsOptions added in v0.29.3

type ListWorkersKVsOptions struct {
	Limit  *int
	Cursor *string
	Prefix *string
}

ListWorkersKVsOptions contains optional parameters for listing a namespace's keys

type LoadBalancer added in v0.8.0

type LoadBalancer struct {
	ID                        string                     `json:"id,omitempty"`
	CreatedOn                 *time.Time                 `json:"created_on,omitempty"`
	ModifiedOn                *time.Time                 `json:"modified_on,omitempty"`
	Description               string                     `json:"description"`
	Name                      string                     `json:"name"`
	TTL                       int                        `json:"ttl,omitempty"`
	FallbackPool              string                     `json:"fallback_pool"`
	DefaultPools              []string                   `json:"default_pools"`
	RegionPools               map[string][]string        `json:"region_pools"`
	PopPools                  map[string][]string        `json:"pop_pools"`
	Proxied                   bool                       `json:"proxied"`
	Enabled                   *bool                      `json:"enabled,omitempty"`
	Persistence               string                     `json:"session_affinity,omitempty"`
	PersistenceTTL            int                        `json:"session_affinity_ttl,omitempty"`
	SessionAffinityAttributes *SessionAffinityAttributes `json:"session_affinity_attributes,omitempty"`
	Rules                     []*LoadBalancerRule        `json:"rules,omitempty"`

	// SteeringPolicy controls pool selection logic.
	// "off" select pools in DefaultPools order
	// "geo" select pools based on RegionPools/PopPools
	// "dynamic_latency" select pools based on RTT (requires health checks)
	// "random" selects pools in a random order
	// "proximity" select pools based on 'distance' from request
	// "" maps to "geo" if RegionPools or PopPools have entries otherwise "off"
	SteeringPolicy string `json:"steering_policy,omitempty"`
}

LoadBalancer represents a load balancer's properties.

type LoadBalancerFixedResponseData added in v0.29.3

type LoadBalancerFixedResponseData struct {
	// MessageBody data to write into the http body
	MessageBody string `json:"message_body,omitempty"`
	// StatusCode the http status code to response with
	StatusCode int `json:"status_code,omitempty"`
	// ContentType value of the http 'content-type' header
	ContentType string `json:"content_type,omitempty"`
	// Location value of the http 'location' header
	Location string `json:"location,omitempty"`
}

LoadBalancerFixedResponseData contains all the data needed to generate a fixed response from a Load Balancer. This behavior can be enabled via Rules.

type LoadBalancerLoadShedding added in v0.29.3

type LoadBalancerLoadShedding struct {
	DefaultPercent float32 `json:"default_percent,omitempty"`
	DefaultPolicy  string  `json:"default_policy,omitempty"`
	SessionPercent float32 `json:"session_percent,omitempty"`
	SessionPolicy  string  `json:"session_policy,omitempty"`
}

LoadBalancerLoadShedding contains the settings for controlling load shedding

type LoadBalancerMonitor added in v0.8.0

type LoadBalancerMonitor struct {
	ID              string              `json:"id,omitempty"`
	CreatedOn       *time.Time          `json:"created_on,omitempty"`
	ModifiedOn      *time.Time          `json:"modified_on,omitempty"`
	Type            string              `json:"type"`
	Description     string              `json:"description"`
	Method          string              `json:"method"`
	Path            string              `json:"path"`
	Header          map[string][]string `json:"header"`
	Timeout         int                 `json:"timeout"`
	Retries         int                 `json:"retries"`
	Interval        int                 `json:"interval"`
	Port            uint16              `json:"port,omitempty"`
	ExpectedBody    string              `json:"expected_body"`
	ExpectedCodes   string              `json:"expected_codes"`
	FollowRedirects bool                `json:"follow_redirects"`
	AllowInsecure   bool                `json:"allow_insecure"`
	ProbeZone       string              `json:"probe_zone"`
}

LoadBalancerMonitor represents a load balancer monitor's properties.

type LoadBalancerOrigin added in v0.8.0

type LoadBalancerOrigin struct {
	Name    string              `json:"name"`
	Address string              `json:"address"`
	Enabled bool                `json:"enabled"`
	Weight  float64             `json:"weight"`
	Header  map[string][]string `json:"header"`
}

LoadBalancerOrigin represents a Load Balancer origin's properties.

type LoadBalancerOriginHealth added in v0.29.3

type LoadBalancerOriginHealth struct {
	Healthy       bool     `json:"healthy,omitempty"`
	RTT           Duration `json:"rtt,omitempty"`
	FailureReason string   `json:"failure_reason,omitempty"`
	ResponseCode  int      `json:"response_code,omitempty"`
}

LoadBalancerOriginHealth represents the health of the origin.

type LoadBalancerOriginSteering added in v0.29.3

type LoadBalancerOriginSteering struct {
	// Policy defaults to "random" (weighted) when empty or unspecified.
	Policy string `json:"policy,omitempty"`
}

LoadBalancerOriginSteering controls origin selection for new sessions and traffic without session affinity.

type LoadBalancerPool added in v0.8.0

type LoadBalancerPool struct {
	ID                string                      `json:"id,omitempty"`
	CreatedOn         *time.Time                  `json:"created_on,omitempty"`
	ModifiedOn        *time.Time                  `json:"modified_on,omitempty"`
	Description       string                      `json:"description"`
	Name              string                      `json:"name"`
	Enabled           bool                        `json:"enabled"`
	MinimumOrigins    int                         `json:"minimum_origins,omitempty"`
	Monitor           string                      `json:"monitor,omitempty"`
	Origins           []LoadBalancerOrigin        `json:"origins"`
	NotificationEmail string                      `json:"notification_email,omitempty"`
	Latitude          *float32                    `json:"latitude,omitempty"`
	Longitude         *float32                    `json:"longitude,omitempty"`
	LoadShedding      *LoadBalancerLoadShedding   `json:"load_shedding,omitempty"`
	OriginSteering    *LoadBalancerOriginSteering `json:"origin_steering,omitempty"`

	// CheckRegions defines the geographic region(s) from where to run health-checks from - e.g. "WNAM", "WEU", "SAF", "SAM".
	// Providing a null/empty value means "all regions", which may not be available to all plan types.
	CheckRegions []string `json:"check_regions"`
}

LoadBalancerPool represents a load balancer pool's properties.

type LoadBalancerPoolHealth added in v0.29.3

type LoadBalancerPoolHealth struct {
	ID        string                               `json:"pool_id,omitempty"`
	PopHealth map[string]LoadBalancerPoolPopHealth `json:"pop_health,omitempty"`
}

LoadBalancerPoolHealth represents the healthchecks from different PoPs for a pool.

type LoadBalancerPoolPopHealth added in v0.29.3

type LoadBalancerPoolPopHealth struct {
	Healthy bool                                  `json:"healthy,omitempty"`
	Origins []map[string]LoadBalancerOriginHealth `json:"origins,omitempty"`
}

LoadBalancerPoolPopHealth represents the health of the pool for given PoP.

type LoadBalancerRule added in v0.29.3

type LoadBalancerRule struct {
	// Name is required but is only used for human readability
	Name string `json:"name"`
	// Priority controls the order of rule execution the lowest value will be invoked first
	Priority int  `json:"priority"`
	Disabled bool `json:"disabled"`

	Condition string                    `json:"condition"`
	Overrides LoadBalancerRuleOverrides `json:"overrides"`

	// Terminates flag this rule as 'terminating'. No further rules will
	// be executed after this one.
	Terminates bool `json:"terminates,omitempty"`

	// FixedResponse if set and the condition is true we will not run
	// routing logic but rather directly respond with the provided fields.
	// FixedResponse implies terminates.
	FixedResponse *LoadBalancerFixedResponseData `json:"fixed_response,omitempty"`
}

LoadBalancerRule represents a single rule entry for a Load Balancer. Each rules is run one after the other in priority order. Disabled rules are skipped.

type LoadBalancerRuleOverrides added in v0.29.3

type LoadBalancerRuleOverrides struct {
	// session affinity
	Persistence    string `json:"session_affinity,omitempty"`
	PersistenceTTL *uint  `json:"session_affinity_ttl,omitempty"`

	SessionAffinityAttrs *LoadBalancerRuleOverridesSessionAffinityAttrs `json:"session_affinity_attributes,omitempty"`

	TTL uint `json:"ttl,omitempty"`

	SteeringPolicy string `json:"steering_policy,omitempty"`
	FallbackPool   string `json:"fallback_pool,omitempty"`

	DefaultPools []string            `json:"default_pools,omitempty"`
	PoPPools     map[string][]string `json:"pop_pools,omitempty"`
	RegionPools  map[string][]string `json:"region_pools,omitempty"`
}

LoadBalancerRuleOverrides are the set of field overridable by the rules system.

type LoadBalancerRuleOverridesSessionAffinityAttrs added in v0.29.3

type LoadBalancerRuleOverridesSessionAffinityAttrs struct {
	SameSite string `json:"samesite,omitempty"`
	Secure   string `json:"secure,omitempty"`
}

LoadBalancerRuleOverridesSessionAffinityAttrs mimics SessionAffinityAttributes without the DrainDuration field as that field can not be overwritten via rules.

type Logger added in v0.8.5

type Logger interface {
	Printf(format string, v ...interface{})
}

Logger defines the interface this library needs to use logging This is a subset of the methods implemented in the log package

type LogpullRetentionConfiguration added in v0.29.3

type LogpullRetentionConfiguration struct {
	Flag bool `json:"flag"`
}

LogpullRetentionConfiguration describes a the structure of a Logpull Retention payload.

type LogpullRetentionConfigurationResponse added in v0.29.3

type LogpullRetentionConfigurationResponse struct {
	Response
	Result LogpullRetentionConfiguration `json:"result"`
}

LogpullRetentionConfigurationResponse is the API response, containing the Logpull retention result.

type LogpushDestinationExistsRequest added in v0.29.3

type LogpushDestinationExistsRequest struct {
	DestinationConf string `json:"destination_conf"`
}

LogpushDestinationExistsRequest is the API request for check destination exists.

type LogpushDestinationExistsResponse added in v0.29.3

type LogpushDestinationExistsResponse struct {
	Response
	Result struct {
		Exists bool `json:"exists"`
	}
}

LogpushDestinationExistsResponse is the API response, containing a destination exists check result.

type LogpushFields added in v0.29.3

type LogpushFields map[string]string

LogpushFields is a map of available Logpush field names & descriptions

type LogpushFieldsResponse added in v0.29.3

type LogpushFieldsResponse struct {
	Response
	Result LogpushFields `json:"result"`
}

LogpushFieldsResponse is the API response for a datasets fields

type LogpushGetOwnershipChallenge added in v0.29.3

type LogpushGetOwnershipChallenge struct {
	Filename string `json:"filename"`
	Valid    bool   `json:"valid"`
	Message  string `json:"message"`
}

LogpushGetOwnershipChallenge describes a ownership validation.

type LogpushGetOwnershipChallengeRequest added in v0.29.3

type LogpushGetOwnershipChallengeRequest struct {
	DestinationConf string `json:"destination_conf"`
}

LogpushGetOwnershipChallengeRequest is the API request for get ownership challenge.

type LogpushGetOwnershipChallengeResponse added in v0.29.3

type LogpushGetOwnershipChallengeResponse struct {
	Response
	Result LogpushGetOwnershipChallenge `json:"result"`
}

LogpushGetOwnershipChallengeResponse is the API response, containing a ownership challenge.

type LogpushJob added in v0.29.3

type LogpushJob struct {
	ID                 int        `json:"id,omitempty"`
	Dataset            string     `json:"dataset"`
	Enabled            bool       `json:"enabled"`
	Name               string     `json:"name"`
	LogpullOptions     string     `json:"logpull_options"`
	DestinationConf    string     `json:"destination_conf"`
	OwnershipChallenge string     `json:"ownership_challenge,omitempty"`
	LastComplete       *time.Time `json:"last_complete,omitempty"`
	LastError          *time.Time `json:"last_error,omitempty"`
	ErrorMessage       string     `json:"error_message,omitempty"`
}

LogpushJob describes a Logpush job.

type LogpushJobDetailsResponse added in v0.29.3

type LogpushJobDetailsResponse struct {
	Response
	Result LogpushJob `json:"result"`
}

LogpushJobDetailsResponse is the API response, containing a single Logpush Job.

type LogpushJobsResponse added in v0.29.3

type LogpushJobsResponse struct {
	Response
	Result []LogpushJob `json:"result"`
}

LogpushJobsResponse is the API response, containing an array of Logpush Jobs.

type LogpushOwnershipChallengeValidationResponse added in v0.29.3

type LogpushOwnershipChallengeValidationResponse struct {
	Response
	Result struct {
		Valid bool `json:"valid"`
	}
}

LogpushOwnershipChallengeValidationResponse is the API response, containing a ownership challenge validation result.

type LogpushValidateOwnershipChallengeRequest added in v0.29.3

type LogpushValidateOwnershipChallengeRequest struct {
	DestinationConf    string `json:"destination_conf"`
	OwnershipChallenge string `json:"ownership_challenge"`
}

LogpushValidateOwnershipChallengeRequest is the API request for validate ownership challenge.

type MagicFirewallRuleset added in v0.29.3

type MagicFirewallRuleset struct {
	ID          string                     `json:"id"`
	Name        string                     `json:"name"`
	Description string                     `json:"description"`
	Kind        string                     `json:"kind"`
	Version     string                     `json:"version,omitempty"`
	LastUpdated *time.Time                 `json:"last_updated,omitempty"`
	Phase       string                     `json:"phase"`
	Rules       []MagicFirewallRulesetRule `json:"rules"`
}

MagicFirewallRuleset contains information about a Firewall Ruleset

type MagicFirewallRulesetRule added in v0.29.3

type MagicFirewallRulesetRule struct {
	ID               string                                    `json:"id,omitempty"`
	Version          string                                    `json:"version,omitempty"`
	Action           MagicFirewallRulesetRuleAction            `json:"action"`
	ActionParameters *MagicFirewallRulesetRuleActionParameters `json:"action_parameters,omitempty"`
	Expression       string                                    `json:"expression"`
	Description      string                                    `json:"description"`
	LastUpdated      *time.Time                                `json:"last_updated,omitempty"`
	Ref              string                                    `json:"ref,omitempty"`
	Enabled          bool                                      `json:"enabled"`
}

MagicFirewallRulesetRule contains information about a single Magic Firewall rule

type MagicFirewallRulesetRuleAction added in v0.29.3

type MagicFirewallRulesetRuleAction string

MagicFirewallRulesetRuleAction specifies the action for a Firewall rule

type MagicFirewallRulesetRuleActionParameters added in v0.29.3

type MagicFirewallRulesetRuleActionParameters struct {
	Ruleset string `json:"ruleset,omitempty"`
}

MagicFirewallRulesetRuleActionParameters specifies the action parameters for a Firewall rule

type MagicTransitStaticRoute added in v0.29.3

type MagicTransitStaticRoute struct {
	ID          string                       `json:"id,omitempty"`
	Prefix      string                       `json:"prefix"`
	CreatedOn   *time.Time                   `json:"created_on,omitempty"`
	ModifiedOn  *time.Time                   `json:"modified_on,omitempty"`
	Nexthop     string                       `json:"nexthop"`
	Priority    int                          `json:"priority,omitempty"`
	Description string                       `json:"description,omitempty"`
	Weight      int                          `json:"weight,omitempty"`
	Scope       MagicTransitStaticRouteScope `json:"scope,omitempty"`
}

MagicTransitStaticRoute contains information about a static route

type MagicTransitStaticRouteScope added in v0.29.3

type MagicTransitStaticRouteScope struct {
	ColoRegions []string `json:"colo_regions,omitempty"`
	ColoNames   []string `json:"colo_names,omitempty"`
}

MagicTransitStaticRouteScope contains information about a static route's scope

type NotificationAlertWithDescription added in v0.29.3

type NotificationAlertWithDescription struct {
	DisplayName string `json:"display_name"`
	Type        string `json:"type"`
	Description string `json:"description"`
}

NotificationAlertWithDescription represents the alert/notification available.

type NotificationAvailableAlertsResponse added in v0.29.3

type NotificationAvailableAlertsResponse struct {
	Response
	Result NotificationsGroupedByProduct
}

NotificationAvailableAlertsResponse describes the available alerts/notifications grouped by products.

type NotificationEligibilityResponse added in v0.29.3

type NotificationEligibilityResponse struct {
	Response
	Result NotificationMechanisms
}

NotificationEligibilityResponse describes the eligible mechanisms that can be configured for a notification.

type NotificationHistory added in v0.29.3

type NotificationHistory struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	Description   string    `json:"description"`
	AlertBody     string    `json:"alert_body"`
	AlertType     string    `json:"alert_type"`
	Mechanism     string    `json:"mechanism"`
	MechanismType string    `json:"mechanism_type"`
	Sent          time.Time `json:"sent"`
}

NotificationHistory describes the history of notifications sent for an account.

type NotificationHistoryResponse added in v0.29.3

type NotificationHistoryResponse struct {
	Response
	ResultInfo `json:"result_info"`
	Result     []NotificationHistory
}

NotificationHistoryResponse describes the notification history response for an account for a specific time period.

type NotificationMechanismData added in v0.29.3

type NotificationMechanismData struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

NotificationMechanismData holds a single public facing mechanism data integation.

type NotificationMechanismIntegrations added in v0.29.3

type NotificationMechanismIntegrations []NotificationMechanismData

NotificationMechanismIntegrations is a list of all the integrations of a certain mechanism type e.g. all email integrations

type NotificationMechanismMetaData added in v0.29.3

type NotificationMechanismMetaData struct {
	Eligible bool   `json:"eligible"`
	Ready    bool   `json:"ready"`
	Type     string `json:"type"`
}

NotificationMechanismMetaData represents the state of the delivery mechanism.

type NotificationMechanisms added in v0.29.3

type NotificationMechanisms struct {
	Email     NotificationMechanismMetaData `json:"email"`
	PagerDuty NotificationMechanismMetaData `json:"pagerduty"`
	Webhooks  NotificationMechanismMetaData `json:"webhooks,omitempty"`
}

NotificationMechanisms are the different possible delivery mechanisms.

type NotificationPagerDutyResource added in v0.29.3

type NotificationPagerDutyResource struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

NotificationPagerDutyResource describes a PagerDuty integration.

type NotificationPagerDutyResponse added in v0.29.3

type NotificationPagerDutyResponse struct {
	Response
	ResultInfo
	Result NotificationPagerDutyResource
}

NotificationPagerDutyResponse describes the PagerDuty integration retrieved.

type NotificationPoliciesResponse added in v0.29.3

type NotificationPoliciesResponse struct {
	Response
	ResultInfo
	Result []NotificationPolicy
}

NotificationPoliciesResponse holds the response for listing all notification policies for an account.

type NotificationPolicy added in v0.29.3

type NotificationPolicy struct {
	ID          string                                       `json:"id"`
	Name        string                                       `json:"name"`
	Description string                                       `json:"description"`
	Enabled     bool                                         `json:"enabled"`
	AlertType   string                                       `json:"alert_type"`
	Mechanisms  map[string]NotificationMechanismIntegrations `json:"mechanisms"`
	Created     time.Time                                    `json:"created"`
	Modified    time.Time                                    `json:"modified"`
	Conditions  map[string]interface{}                       `json:"conditions"`
	Filters     map[string][]string                          `json:"filters"`
}

NotificationPolicy represents the notification policy created along with the destinations.

type NotificationPolicyResponse added in v0.29.3

type NotificationPolicyResponse struct {
	Response
	Result NotificationPolicy
}

NotificationPolicyResponse holds the response type when a single policy is retrieved.

type NotificationResource added in v0.29.3

type NotificationResource struct {
	ID string
}

NotificationResource describes the id of an inserted/updated/deleted resource.

type NotificationUpsertWebhooks added in v0.29.3

type NotificationUpsertWebhooks struct {
	Name   string `json:"name"`
	URL    string `json:"url"`
	Secret string `json:"secret"`
}

NotificationUpsertWebhooks describes a valid webhook request.

type NotificationWebhookIntegration added in v0.29.3

type NotificationWebhookIntegration struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Type        string     `json:"type"`
	URL         string     `json:"url"`
	CreatedAt   time.Time  `json:"created_at"`
	LastSuccess *time.Time `json:"last_success"`
	LastFailure *time.Time `json:"last_failure"`
}

NotificationWebhookIntegration describes the webhook information along with its status.

type NotificationWebhookResponse added in v0.29.3

type NotificationWebhookResponse struct {
	Response
	ResultInfo
	Result NotificationWebhookIntegration
}

NotificationWebhookResponse describes a single webhook retrieved.

type NotificationWebhooksResponse added in v0.29.3

type NotificationWebhooksResponse struct {
	Response
	ResultInfo
	Result []NotificationWebhookIntegration
}

NotificationWebhooksResponse describes a list of webhooks retrieved.

type NotificationsGroupedByProduct added in v0.29.3

type NotificationsGroupedByProduct map[string][]NotificationAlertWithDescription

NotificationsGroupedByProduct are grouped by products.

type Option

type Option func(*API) error

Option is a functional option for configuring the API client.

func BaseURL added in v0.29.3

func BaseURL(baseURL string) Option

BaseURL allows you to override the default HTTP base URL used for API calls.

func HTTPClient

func HTTPClient(client *http.Client) Option

HTTPClient accepts a custom *http.Client for making API calls.

func Headers

func Headers(headers http.Header) Option

Headers allows you to set custom HTTP headers when making API calls (e.g. for satisfying HTTP proxies, or for debugging).

func UserAgent added in v0.29.3

func UserAgent(userAgent string) Option

UserAgent can be set if you want to send a software name and version for HTTP access logs. It is recommended to set it in order to help future Customer Support diagnostics and prevent collateral damage by sharing generic User-Agent string with abusive users. E.g. "my-software/1.2.3". By default generic Go User-Agent is used.

func UsingAccount added in v0.29.3

func UsingAccount(accountID string) Option

UsingAccount allows you to apply account-level changes (Load Balancing, Railguns) to an account instead.

func UsingLogger added in v0.8.5

func UsingLogger(logger Logger) Option

UsingLogger can be set if you want to get log output from this API instance By default no log output is emitted

func UsingRateLimit added in v0.8.5

func UsingRateLimit(rps float64) Option

UsingRateLimit applies a non-default rate limit to client API requests If not specified the default of 4rps will be applied

func UsingRetryPolicy added in v0.8.5

func UsingRetryPolicy(maxRetries int, minRetryDelaySecs int, maxRetryDelaySecs int) Option

UsingRetryPolicy applies a non-default number of retries and min/max retry delays This will be used when the client exponentially backs off after errored requests

type OriginCACertificate added in v0.7.4

type OriginCACertificate struct {
	ID              string    `json:"id"`
	Certificate     string    `json:"certificate"`
	Hostnames       []string  `json:"hostnames"`
	ExpiresOn       time.Time `json:"expires_on"`
	RequestType     string    `json:"request_type"`
	RequestValidity int       `json:"requested_validity"`
	RevokedAt       time.Time `json:"revoked_at,omitempty"`
	CSR             string    `json:"csr"`
}

OriginCACertificate represents a Cloudflare-issued certificate.

API reference: https://api.cloudflare.com/#cloudflare-ca

func (*OriginCACertificate) UnmarshalJSON added in v0.29.3

func (c *OriginCACertificate) UnmarshalJSON(data []byte) error

UnmarshalJSON handles custom parsing from an API response to an OriginCACertificate http://choly.ca/post/go-json-marshalling/

type OriginCACertificateID added in v0.7.4

type OriginCACertificateID struct {
	ID string `json:"id"`
}

OriginCACertificateID represents the ID of the revoked certificate from the Revoke Certificate endpoint.

type OriginCACertificateListOptions added in v0.7.4

type OriginCACertificateListOptions struct {
	ZoneID string
}

OriginCACertificateListOptions represents the parameters used to list Cloudflare-issued certificates.

type Owner

type Owner struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	Name      string `json:"name"`
	OwnerType string `json:"type"`
}

Owner describes the resource owner.

type PageRule

type PageRule struct {
	ID         string           `json:"id,omitempty"`
	Targets    []PageRuleTarget `json:"targets"`
	Actions    []PageRuleAction `json:"actions"`
	Priority   int              `json:"priority"`
	Status     string           `json:"status"`
	ModifiedOn time.Time        `json:"modified_on,omitempty"`
	CreatedOn  time.Time        `json:"created_on,omitempty"`
}

PageRule describes a Page Rule.

type PageRuleAction

type PageRuleAction struct {
	ID    string      `json:"id"`
	Value interface{} `json:"value"`
}

PageRuleAction is the action to take when the target is matched.

Valid IDs are:

always_online
always_use_https
automatic_https_rewrites
browser_cache_ttl
browser_check
bypass_cache_on_cookie
cache_by_device_type
cache_deception_armor
cache_level
cache_key_fields
cache_on_cookie
disable_apps
disable_performance
disable_railgun
disable_security
edge_cache_ttl
email_obfuscation
explicit_cache_control
forwarding_url
host_header_override
ip_geolocation
minify
mirage
opportunistic_encryption
origin_error_page_pass_thru
polish
resolve_override
respect_strong_etag
response_buffering
rocket_loader
security_level
server_side_exclude
sort_query_string_for_cache
ssl
true_client_ip_header
waf

type PageRuleDetailResponse

type PageRuleDetailResponse struct {
	Success  bool     `json:"success"`
	Errors   []string `json:"errors"`
	Messages []string `json:"messages"`
	Result   PageRule `json:"result"`
}

PageRuleDetailResponse is the API response, containing a single PageRule.

type PageRuleTarget

type PageRuleTarget struct {
	Target     string `json:"target"`
	Constraint struct {
		Operator string `json:"operator"`
		Value    string `json:"value"`
	} `json:"constraint"`
}

PageRuleTarget is the target to evaluate on a request.

Currently Target must always be "url" and Operator must be "matches". Value is the URL pattern to match against.

type PageRulesResponse

type PageRulesResponse struct {
	Success  bool       `json:"success"`
	Errors   []string   `json:"errors"`
	Messages []string   `json:"messages"`
	Result   []PageRule `json:"result"`
}

PageRulesResponse is the API response, containing an array of PageRules.

type PagesProject added in v0.29.3

type PagesProject struct {
	Name                string                        `json:"name"`
	ID                  string                        `json:"id"`
	CreatedOn           *time.Time                    `json:"created_on"`
	SubDomain           string                        `json:"subdomain"`
	Domains             []string                      `json:"domains,omitempty"`
	Source              PagesProjectSource            `json:"source"`
	BuildConfig         PagesProjectBuildConfig       `json:"build_config"`
	DeploymentConfigs   PagesProjectDeploymentConfigs `json:"deployment_configs"`
	LatestDeployment    PagesProjectDeployment        `json:"latest_deployment"`
	CanonicalDeployment PagesProjectDeployment        `json:"canonical_deployment"`
}

PagesProject represents a Pages project.

type PagesProjectBuildConfig added in v0.29.3

type PagesProjectBuildConfig struct {
	BuildCommand      string `json:"build_command"`
	DestinationDir    string `json:"destination_dir"`
	RootDir           string `json:"root_dir"`
	WebAnalyticsTag   string `json:"web_analytics_tag"`
	WebAnalyticsToken string `json:"web_analytics_token"`
}

PagesProjectBuildConfig represents the configuration of a Pages project build process.

type PagesProjectDeployment added in v0.29.3

type PagesProjectDeployment struct {
	ID                string                        `json:"id"`
	ShortID           string                        `json:"short_id"`
	ProjectID         string                        `json:"project_id"`
	ProjectName       string                        `json:"project_name"`
	Environment       string                        `json:"environment"`
	URL               string                        `json:"url"`
	CreatedOn         *time.Time                    `json:"created_on"`
	ModifiedOn        *time.Time                    `json:"modified_on"`
	Aliases           []string                      `json:"aliases,omitempty"`
	LatestStage       PagesProjectDeploymentStage   `json:"latest_stage"`
	EnvVars           map[string]map[string]string  `json:"env_vars"`
	DeploymentTrigger PagesProjectDeploymentTrigger `json:"deployment_trigger"`
	Stages            []PagesProjectDeploymentStage `json:"stages"`
	BuildConfig       PagesProjectBuildConfig       `json:"build_config"`
	Source            PagesProjectSource            `json:"source"`
}

PagesProjectDeployment represents a deployment to a Pages project.

type PagesProjectDeploymentConfigBuildVersion added in v0.29.3

type PagesProjectDeploymentConfigBuildVersion struct {
	Value string `json:"value"`
}

PagesProjectDeploymentConfigBuildVersion represents a value for a BUILD_VERSION.

type PagesProjectDeploymentConfigEnvVars added in v0.29.3

type PagesProjectDeploymentConfigEnvVars struct {
	BuildVersion PagesProjectDeploymentConfigBuildVersion `json:"BUILD_VERSION"`
}

PagesProjectDeploymentConfigEnvVars represents the BUILD_VERSION environment variables for a specific build config.

type PagesProjectDeploymentConfigEnvironment added in v0.29.3

type PagesProjectDeploymentConfigEnvironment struct {
	EnvVars PagesProjectDeploymentConfigEnvVars `json:"env_vars"`
}

PagesProjectDeploymentConfigEnvironment represents the configuration for preview or production deploys.

type PagesProjectDeploymentConfigs added in v0.29.3

type PagesProjectDeploymentConfigs struct {
	Preview    PagesProjectDeploymentConfigEnvironment `json:"preview"`
	Production PagesProjectDeploymentConfigEnvironment `json:"production"`
}

PagesProjectDeploymentConfigs represents the configuration for deployments in a Pages project.

type PagesProjectDeploymentStage added in v0.29.3

type PagesProjectDeploymentStage struct {
	Name      string     `json:"name"`
	StartedOn *time.Time `json:"started_on,omitempty"`
	EndedOn   *time.Time `json:"ended_on,omitempty"`
	Status    string     `json:"status"`
}

PagesProjectDeploymentStage represents an individual stage in a Pages project deployment.

type PagesProjectDeploymentTrigger added in v0.29.3

type PagesProjectDeploymentTrigger struct {
	Type     string                                 `json:"type"`
	Metadata *PagesProjectDeploymentTriggerMetadata `json:"metadata"`
}

PagesProjectDeploymentTrigger represents information about what caused a deployment.

type PagesProjectDeploymentTriggerMetadata added in v0.29.3

type PagesProjectDeploymentTriggerMetadata struct {
	Branch        string `json:"branch"`
	CommitHash    string `json:"commit_hash"`
	CommitMessage string `json:"commit_message"`
}

PagesProjectDeploymentTriggerMetadata represents additional information about the cause of a deployment.

type PagesProjectSource added in v0.29.3

type PagesProjectSource struct {
	Type   string                    `json:"type"`
	Config *PagesProjectSourceConfig `json:"config"`
}

PagesProjectSource represents the configuration of a Pages project source.

type PagesProjectSourceConfig added in v0.29.3

type PagesProjectSourceConfig struct {
	Owner              string `json:"owner"`
	RepoName           string `json:"repo_name"`
	ProductionBranch   string `json:"production_branch"`
	PRCommentsEnabled  bool   `json:"pr_comments_enabled"`
	DeploymentsEnabled bool   `json:"deployments_enabled"`
}

PagesProjectSourceConfig represents the properties use to configure a Pages project source.

type PaginationOptions added in v0.8.5

type PaginationOptions struct {
	Page    int `json:"page,omitempty"`
	PerPage int `json:"per_page,omitempty"`
}

PaginationOptions can be passed to a list request to configure paging These values will be defaulted if omitted, and PerPage has min/max limits set by resource

type PatchTeamsList added in v0.29.3

type PatchTeamsList struct {
	ID     string          `json:"id"`
	Append []TeamsListItem `json:"append"`
	Remove []string        `json:"remove"`
}

PatchTeamsList represents a patch request for appending/removing list items.

type PerHostnameAuthenticatedOriginPullsCertificateDetails added in v0.29.3

type PerHostnameAuthenticatedOriginPullsCertificateDetails struct {
	ID           string    `json:"id"`
	Certificate  string    `json:"certificate"`
	Issuer       string    `json:"issuer"`
	Signature    string    `json:"signature"`
	SerialNumber string    `json:"serial_number"`
	ExpiresOn    time.Time `json:"expires_on"`
	Status       string    `json:"status"`
	UploadedOn   time.Time `json:"uploaded_on"`
}

PerHostnameAuthenticatedOriginPullsCertificateDetails represents the metadata for a Per Hostname AuthenticatedOriginPulls certificate.

type PerHostnameAuthenticatedOriginPullsCertificateParams added in v0.29.3

type PerHostnameAuthenticatedOriginPullsCertificateParams struct {
	Certificate string `json:"certificate"`
	PrivateKey  string `json:"private_key"`
}

PerHostnameAuthenticatedOriginPullsCertificateParams represents the required data related to the client certificate being uploaded to be used in Per Hostname AuthenticatedOriginPulls.

type PerHostnameAuthenticatedOriginPullsCertificateResponse added in v0.29.3

type PerHostnameAuthenticatedOriginPullsCertificateResponse struct {
	Response
	Result PerHostnameAuthenticatedOriginPullsCertificateDetails `json:"result"`
}

PerHostnameAuthenticatedOriginPullsCertificateResponse represents the response from endpoints relating to creating and deleting a Per Hostname AuthenticatedOriginPulls certificate.

type PerHostnameAuthenticatedOriginPullsConfig added in v0.29.3

type PerHostnameAuthenticatedOriginPullsConfig struct {
	Hostname string `json:"hostname"`
	CertID   string `json:"cert_id"`
	Enabled  bool   `json:"enabled"`
}

PerHostnameAuthenticatedOriginPullsConfig represents the config state for Per Hostname AuthenticatedOriginPulls applied on a hostname.

type PerHostnameAuthenticatedOriginPullsConfigParams added in v0.29.3

type PerHostnameAuthenticatedOriginPullsConfigParams struct {
	Config []PerHostnameAuthenticatedOriginPullsConfig `json:"config"`
}

PerHostnameAuthenticatedOriginPullsConfigParams represents the expected config param format for Per Hostname AuthenticatedOriginPulls applied on a hostname.

type PerHostnameAuthenticatedOriginPullsDetails added in v0.29.3

type PerHostnameAuthenticatedOriginPullsDetails struct {
	Hostname       string    `json:"hostname"`
	CertID         string    `json:"cert_id"`
	Enabled        bool      `json:"enabled"`
	Status         string    `json:"status"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	CertStatus     string    `json:"cert_status"`
	Issuer         string    `json:"issuer"`
	Signature      string    `json:"signature"`
	SerialNumber   string    `json:"serial_number"`
	Certificate    string    `json:"certificate"`
	CertUploadedOn time.Time `json:"cert_uploaded_on"`
	CertUpdatedAt  time.Time `json:"cert_updated_at"`
	ExpiresOn      time.Time `json:"expires_on"`
}

PerHostnameAuthenticatedOriginPullsDetails contains metadata about the Per Hostname AuthenticatedOriginPulls configuration on a hostname.

type PerHostnameAuthenticatedOriginPullsDetailsResponse added in v0.29.3

type PerHostnameAuthenticatedOriginPullsDetailsResponse struct {
	Response
	Result PerHostnameAuthenticatedOriginPullsDetails `json:"result"`
}

PerHostnameAuthenticatedOriginPullsDetailsResponse represents Per Hostname AuthenticatedOriginPulls configuration metadata for a single hostname.

type PerHostnamesAuthenticatedOriginPullsDetailsResponse added in v0.29.3

type PerHostnamesAuthenticatedOriginPullsDetailsResponse struct {
	Response
	Result []PerHostnameAuthenticatedOriginPullsDetails `json:"result"`
}

PerHostnamesAuthenticatedOriginPullsDetailsResponse represents Per Hostname AuthenticatedOriginPulls configuration metadata for multiple hostnames.

type PerZoneAuthenticatedOriginPullsCertificateDetails added in v0.29.3

type PerZoneAuthenticatedOriginPullsCertificateDetails struct {
	ID          string    `json:"id"`
	Certificate string    `json:"certificate"`
	Issuer      string    `json:"issuer"`
	Signature   string    `json:"signature"`
	ExpiresOn   time.Time `json:"expires_on"`
	Status      string    `json:"status"`
	UploadedOn  time.Time `json:"uploaded_on"`
}

PerZoneAuthenticatedOriginPullsCertificateDetails represents the metadata for a Per Zone AuthenticatedOriginPulls client certificate.

type PerZoneAuthenticatedOriginPullsCertificateParams added in v0.29.3

type PerZoneAuthenticatedOriginPullsCertificateParams struct {
	Certificate string `json:"certificate"`
	PrivateKey  string `json:"private_key"`
}

PerZoneAuthenticatedOriginPullsCertificateParams represents the required data related to the client certificate being uploaded to be used in Per Zone AuthenticatedOriginPulls.

type PerZoneAuthenticatedOriginPullsCertificateResponse added in v0.29.3

type PerZoneAuthenticatedOriginPullsCertificateResponse struct {
	Response
	Result PerZoneAuthenticatedOriginPullsCertificateDetails `json:"result"`
}

PerZoneAuthenticatedOriginPullsCertificateResponse represents the response from endpoints relating to creating and deleting a per zone AuthenticatedOriginPulls certificate.

type PerZoneAuthenticatedOriginPullsCertificatesResponse added in v0.29.3

type PerZoneAuthenticatedOriginPullsCertificatesResponse struct {
	Response
	Result []PerZoneAuthenticatedOriginPullsCertificateDetails `json:"result"`
}

PerZoneAuthenticatedOriginPullsCertificatesResponse represents the response from the per zone AuthenticatedOriginPulls certificate list endpoint.

type PerZoneAuthenticatedOriginPullsSettings added in v0.29.3

type PerZoneAuthenticatedOriginPullsSettings struct {
	Enabled bool `json:"enabled"`
}

PerZoneAuthenticatedOriginPullsSettings represents the settings for Per Zone AuthenticatedOriginPulls.

type PerZoneAuthenticatedOriginPullsSettingsResponse added in v0.29.3

type PerZoneAuthenticatedOriginPullsSettingsResponse struct {
	Response
	Result PerZoneAuthenticatedOriginPullsSettings `json:"result"`
}

PerZoneAuthenticatedOriginPullsSettingsResponse represents the response from the Per Zone AuthenticatedOriginPulls settings endpoint.

type ProxyProtocol added in v0.29.3

type ProxyProtocol string

ProxyProtocol implements json.Unmarshaler in order to support deserializing of the deprecated boolean value for `proxy_protocol`

func (*ProxyProtocol) UnmarshalJSON added in v0.29.3

func (p *ProxyProtocol) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserializing of both the deprecated boolean value and the current string value for the `proxy_protocol` field.

type PurgeCacheRequest

type PurgeCacheRequest struct {
	Everything bool `json:"purge_everything,omitempty"`
	// Purge by filepath (exact match). Limit of 30
	Files []string `json:"files,omitempty"`
	// Purge by Tag (Enterprise only):
	// https://support.cloudflare.com/hc/en-us/articles/206596608-How-to-Purge-Cache-Using-Cache-Tags-Enterprise-only-
	Tags []string `json:"tags,omitempty"`
	// Purge by hostname - e.g. "assets.example.com"
	Hosts []string `json:"hosts,omitempty"`
	// Purge by prefix - e.g. "example.com/css"
	Prefixes []string `json:"prefixes,omitempty"`
}

PurgeCacheRequest represents the request format made to the purge endpoint.

type PurgeCacheResponse

type PurgeCacheResponse struct {
	Response
	Result struct {
		ID string `json:"id"`
	} `json:"result"`
}

PurgeCacheResponse represents the response from the purge endpoint.

type Railgun

type Railgun struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Status         string    `json:"status"`
	Enabled        bool      `json:"enabled"`
	ZonesConnected int       `json:"zones_connected"`
	Build          string    `json:"build"`
	Version        string    `json:"version"`
	Revision       string    `json:"revision"`
	ActivationKey  string    `json:"activation_key"`
	ActivatedOn    time.Time `json:"activated_on"`
	CreatedOn      time.Time `json:"created_on"`
	ModifiedOn     time.Time `json:"modified_on"`
	UpgradeInfo    struct {
		LatestVersion string `json:"latest_version"`
		DownloadLink  string `json:"download_link"`
	} `json:"upgrade_info"`
}

Railgun represents a Railgun's properties.

type RailgunDiagnosis

type RailgunDiagnosis struct {
	Method          string `json:"method"`
	HostName        string `json:"host_name"`
	HTTPStatus      int    `json:"http_status"`
	Railgun         string `json:"railgun"`
	URL             string `json:"url"`
	ResponseStatus  string `json:"response_status"`
	Protocol        string `json:"protocol"`
	ElapsedTime     string `json:"elapsed_time"`
	BodySize        string `json:"body_size"`
	BodyHash        string `json:"body_hash"`
	MissingHeaders  string `json:"missing_headers"`
	ConnectionClose bool   `json:"connection_close"`
	Cloudflare      string `json:"cloudflare"`
	CFRay           string `json:"cf-ray"`
	// NOTE: Cloudflare's online API documentation does not yet have definitions
	// for the following fields. See: https://api.cloudflare.com/#railgun-connections-for-a-zone-test-railgun-connection/
	CFWANError    string `json:"cf-wan-error"`
	CFCacheStatus string `json:"cf-cache-status"`
}

RailgunDiagnosis represents the test results from testing railgun connections to a zone.

type RailgunListOptions

type RailgunListOptions struct {
	Direction string
}

RailgunListOptions represents the parameters used to list railguns.

type RateLimit added in v0.8.5

type RateLimit struct {
	ID          string                  `json:"id,omitempty"`
	Disabled    bool                    `json:"disabled,omitempty"`
	Description string                  `json:"description,omitempty"`
	Match       RateLimitTrafficMatcher `json:"match"`
	Bypass      []RateLimitKeyValue     `json:"bypass,omitempty"`
	Threshold   int                     `json:"threshold"`
	Period      int                     `json:"period"`
	Action      RateLimitAction         `json:"action"`
	Correlate   *RateLimitCorrelate     `json:"correlate,omitempty"`
}

RateLimit is a policy than can be applied to limit traffic within a customer domain

type RateLimitAction added in v0.8.5

type RateLimitAction struct {
	Mode     string                   `json:"mode"`
	Timeout  int                      `json:"timeout"`
	Response *RateLimitActionResponse `json:"response"`
}

RateLimitAction is the action that will be taken when the rate limit threshold is reached

type RateLimitActionResponse added in v0.8.5

type RateLimitActionResponse struct {
	ContentType string `json:"content_type"`
	Body        string `json:"body"`
}

RateLimitActionResponse is the response that will be returned when rate limit action is triggered

type RateLimitCorrelate added in v0.29.3

type RateLimitCorrelate struct {
	By string `json:"by"`
}

RateLimitCorrelate pertainings to NAT support

type RateLimitKeyValue added in v0.8.5

type RateLimitKeyValue struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

RateLimitKeyValue is k-v formatted as expected in the rate limit description

type RateLimitRequestMatcher added in v0.8.5

type RateLimitRequestMatcher struct {
	Methods    []string `json:"methods,omitempty"`
	Schemes    []string `json:"schemes,omitempty"`
	URLPattern string   `json:"url,omitempty"`
}

RateLimitRequestMatcher contains the matching rules pertaining to requests

type RateLimitResponseMatcher added in v0.8.5

type RateLimitResponseMatcher struct {
	Statuses      []int                            `json:"status,omitempty"`
	OriginTraffic *bool                            `json:"origin_traffic,omitempty"` // api defaults to true so we need an explicit empty value
	Headers       []RateLimitResponseMatcherHeader `json:"headers,omitempty"`
}

RateLimitResponseMatcher contains the matching rules pertaining to responses

type RateLimitResponseMatcherHeader added in v0.29.3

type RateLimitResponseMatcherHeader struct {
	Name  string `json:"name"`
	Op    string `json:"op"`
	Value string `json:"value"`
}

RateLimitResponseMatcherHeader contains the structure of the origin HTTP headers used in request matcher checks.

type RateLimitTrafficMatcher added in v0.8.5

type RateLimitTrafficMatcher struct {
	Request  RateLimitRequestMatcher  `json:"request"`
	Response RateLimitResponseMatcher `json:"response"`
}

RateLimitTrafficMatcher contains the rules that will be used to apply a rate limit to traffic

type RawResponse added in v0.8.0

type RawResponse struct {
	Response
	Result json.RawMessage `json:"result"`
}

RawResponse keeps the result as JSON form

type RegistrantContact added in v0.29.3

type RegistrantContact struct {
	ID           string `json:"id"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
	Organization string `json:"organization"`
	Address      string `json:"address"`
	Address2     string `json:"address2"`
	City         string `json:"city"`
	State        string `json:"state"`
	Zip          string `json:"zip"`
	Country      string `json:"country"`
	Phone        string `json:"phone"`
	Email        string `json:"email"`
	Fax          string `json:"fax"`
}

RegistrantContact is the contact details for the domain registration.

type RegistrarDomain added in v0.29.3

type RegistrarDomain struct {
	ID                string              `json:"id"`
	Available         bool                `json:"available"`
	SupportedTLD      bool                `json:"supported_tld"`
	CanRegister       bool                `json:"can_register"`
	TransferIn        RegistrarTransferIn `json:"transfer_in"`
	CurrentRegistrar  string              `json:"current_registrar"`
	ExpiresAt         time.Time           `json:"expires_at"`
	RegistryStatuses  string              `json:"registry_statuses"`
	Locked            bool                `json:"locked"`
	CreatedAt         time.Time           `json:"created_at"`
	UpdatedAt         time.Time           `json:"updated_at"`
	RegistrantContact RegistrantContact   `json:"registrant_contact"`
}

RegistrarDomain is the structure of the API response for a new Cloudflare Registrar domain.

type RegistrarDomainConfiguration added in v0.29.3

type RegistrarDomainConfiguration struct {
	NameServers []string `json:"name_servers"`
	Privacy     bool     `json:"privacy"`
	Locked      bool     `json:"locked"`
	AutoRenew   bool     `json:"auto_renew"`
}

RegistrarDomainConfiguration is the structure for making updates to and existing domain.

type RegistrarDomainDetailResponse added in v0.29.3

type RegistrarDomainDetailResponse struct {
	Response
	Result RegistrarDomain `json:"result"`
}

RegistrarDomainDetailResponse is the structure of the detailed response from the API for a single domain.

type RegistrarDomainsDetailResponse added in v0.29.3

type RegistrarDomainsDetailResponse struct {
	Response
	Result []RegistrarDomain `json:"result"`
}

RegistrarDomainsDetailResponse is the structure of the detailed response from the API.

type RegistrarTransferIn added in v0.29.3

type RegistrarTransferIn struct {
	UnlockDomain      string `json:"unlock_domain"`
	DisablePrivacy    string `json:"disable_privacy"`
	EnterAuthCode     string `json:"enter_auth_code"`
	ApproveTransfer   string `json:"approve_transfer"`
	AcceptFoa         string `json:"accept_foa"`
	CanCancelTransfer bool   `json:"can_cancel_transfer"`
}

RegistrarTransferIn contains the structure for a domain transfer in request.

type ReqOption added in v0.29.3

type ReqOption func(opt *reqOption)

ReqOption is a functional option for configuring API requests

func WithPagination added in v0.29.3

func WithPagination(opts PaginationOptions) ReqOption

WithPagination configures the pagination for a response.

func WithZoneFilters added in v0.29.3

func WithZoneFilters(zoneName, accountID, status string) ReqOption

WithZoneFilters applies a filter based on zone properties.

type Response

type Response struct {
	Success  bool           `json:"success"`
	Errors   []ResponseInfo `json:"errors"`
	Messages []ResponseInfo `json:"messages"`
}

Response is a template. There will also be a result struct. There will be a unique response type for each response, which will include this type.

type ResponseInfo

type ResponseInfo struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ResponseInfo contains a code and message returned by the API as errors or informational messages inside the response.

type ResultInfo

type ResultInfo struct {
	Page       int               `json:"page"`
	PerPage    int               `json:"per_page"`
	TotalPages int               `json:"total_pages"`
	Count      int               `json:"count"`
	Total      int               `json:"total_count"`
	Cursor     string            `json:"cursor"`
	Cursors    ResultInfoCursors `json:"cursors"`
}

ResultInfo contains metadata about the Response.

type ResultInfoCursors added in v0.29.3

type ResultInfoCursors struct {
	Before string `json:"before"`
	After  string `json:"after"`
}

ResultInfoCursors contains information about cursors.

type RetryPolicy added in v0.8.5

type RetryPolicy struct {
	MaxRetries    int
	MinRetryDelay time.Duration
	MaxRetryDelay time.Duration
}

RetryPolicy specifies number of retries and min/max retry delays This config is used when the client exponentially backs off after errored requests

type RouteRoot added in v0.29.3

type RouteRoot string

RouteRoot represents the name of the route namespace

const (
	// AccountRouteRoot is the accounts route namespace
	AccountRouteRoot RouteRoot = "accounts"

	// ZoneRouteRoot is the zones route namespace
	ZoneRouteRoot RouteRoot = "zones"
)

type Ruleset added in v0.29.3

type Ruleset struct {
	ID                       string        `json:"id,omitempty"`
	Name                     string        `json:"name,omitempty"`
	Description              string        `json:"description,omitempty"`
	Kind                     string        `json:"kind,omitempty"`
	Version                  string        `json:"version,omitempty"`
	LastUpdated              *time.Time    `json:"last_updated,omitempty"`
	Phase                    string        `json:"phase,omitempty"`
	Rules                    []RulesetRule `json:"rules"`
	ShareableEntitlementName string        `json:"shareable_entitlement_name,omitempty"`
}

Ruleset contains the structure of a Ruleset. Using `string` for Kind and Phase is a developer nicety to support downstream clients like Terraform who don't really have a strong and expansive type system. As always, the recommendation is to use the types provided where possible to avoid surprises.

type RulesetActionParameterProduct added in v0.29.3

type RulesetActionParameterProduct string

RulesetActionParameterProduct is the custom type for defining what products can be used within the action parameters of a ruleset.

type RulesetKind added in v0.29.3

type RulesetKind string

RulesetKind is the custom type for allowed variances of rulesets.

type RulesetPhase added in v0.29.3

type RulesetPhase string

RulesetPhase is the custom type for defining at what point the ruleset will be applied in the request pipeline.

type RulesetRule added in v0.29.3

type RulesetRule struct {
	ID                     string                             `json:"id,omitempty"`
	Version                string                             `json:"version,omitempty"`
	Action                 string                             `json:"action"`
	ActionParameters       *RulesetRuleActionParameters       `json:"action_parameters,omitempty"`
	Expression             string                             `json:"expression"`
	Description            string                             `json:"description"`
	LastUpdated            *time.Time                         `json:"last_updated,omitempty"`
	Ref                    string                             `json:"ref,omitempty"`
	Enabled                bool                               `json:"enabled"`
	ScoreThreshold         int                                `json:"score_threshold,omitempty"`
	RateLimit              *RulesetRuleRateLimit              `json:"ratelimit,omitempty"`
	ExposedCredentialCheck *RulesetRuleExposedCredentialCheck `json:"exposed_credential_check,omitempty"`
}

RulesetRule contains information about a single Ruleset Rule.

type RulesetRuleAction added in v0.29.3

type RulesetRuleAction string

RulesetRuleAction defines a custom type that is used to express allowed values for the rule action.

type RulesetRuleActionParameters added in v0.29.3

type RulesetRuleActionParameters struct {
	ID          string                                           `json:"id,omitempty"`
	Ruleset     string                                           `json:"ruleset,omitempty"`
	Rulesets    []string                                         `json:"rulesets,omitempty"`
	Rules       map[string][]string                              `json:"rules,omitempty"`
	Increment   int                                              `json:"increment,omitempty"`
	URI         *RulesetRuleActionParametersURI                  `json:"uri,omitempty"`
	Headers     map[string]RulesetRuleActionParametersHTTPHeader `json:"headers,omitempty"`
	Products    []string                                         `json:"products,omitempty"`
	Overrides   *RulesetRuleActionParametersOverrides            `json:"overrides,omitempty"`
	MatchedData *RulesetRuleActionParametersMatchedData          `json:"matched_data,omitempty"`
	Version     string                                           `json:"version,omitempty"`
}

RulesetRuleActionParameters specifies the action parameters for a Ruleset rule.

type RulesetRuleActionParametersCategories added in v0.29.3

type RulesetRuleActionParametersCategories struct {
	Category string `json:"category"`
	Action   string `json:"action,omitempty"`
	Enabled  bool   `json:"enabled"`
}

type RulesetRuleActionParametersHTTPHeader added in v0.29.3

type RulesetRuleActionParametersHTTPHeader struct {
	Operation  string `json:"operation,omitempty"`
	Value      string `json:"value,omitempty"`
	Expression string `json:"expression,omitempty"`
}

RulesetRuleActionParametersHTTPHeader is the definition for define action parameters that involve HTTP headers.

type RulesetRuleActionParametersHTTPHeaderOperation added in v0.29.3

type RulesetRuleActionParametersHTTPHeaderOperation string

RulesetRuleActionParametersHTTPHeaderOperation defines available options for HTTP header operations in actions.

type RulesetRuleActionParametersMatchedData added in v0.29.3

type RulesetRuleActionParametersMatchedData struct {
	PublicKey string `json:"public_key,omitempty"`
}

RulesetRuleActionParametersMatchedData holds the structure for WAF based payload logging.

type RulesetRuleActionParametersOverrides added in v0.29.3

type RulesetRuleActionParametersOverrides struct {
	Enabled    *bool                                   `json:"enabled,omitempty"`
	Action     string                                  `json:"action,omitempty"`
	Categories []RulesetRuleActionParametersCategories `json:"categories,omitempty"`
	Rules      []RulesetRuleActionParametersRules      `json:"rules,omitempty"`
}

type RulesetRuleActionParametersRules added in v0.29.3

type RulesetRuleActionParametersRules struct {
	ID               string `json:"id"`
	Action           string `json:"action,omitempty"`
	Enabled          *bool  `json:"enabled,omitempty"`
	ScoreThreshold   int    `json:"score_threshold,omitempty"`
	SensitivityLevel string `json:"sensitivity_level,omitempty"`
}

type RulesetRuleActionParametersURI added in v0.29.3

type RulesetRuleActionParametersURI struct {
	Path   *RulesetRuleActionParametersURIPath  `json:"path,omitempty"`
	Query  *RulesetRuleActionParametersURIQuery `json:"query,omitempty"`
	Origin bool                                 `json:"origin,omitempty"`
}

RulesetRuleActionParametersURI holds the URI struct for an action parameter.

type RulesetRuleActionParametersURIPath added in v0.29.3

type RulesetRuleActionParametersURIPath struct {
	Value      string `json:"value,omitempty"`
	Expression string `json:"expression,omitempty"`
}

RulesetRuleActionParametersURIPath holds the path specific portion of a URI action parameter.

type RulesetRuleActionParametersURIQuery added in v0.29.3

type RulesetRuleActionParametersURIQuery struct {
	Value      string `json:"value,omitempty"`
	Expression string `json:"expression,omitempty"`
}

RulesetRuleActionParametersURIQuery holds the query specific portion of a URI action parameter.

type RulesetRuleExposedCredentialCheck added in v0.29.3

type RulesetRuleExposedCredentialCheck struct {
	UsernameExpression string `json:"username_expression,omitempty"`
	PasswordExpression string `json:"password_expression,omitempty"`
}

RulesetRuleExposedCredentialCheck contains the structure of an exposed credential check Ruleset Rule.

type RulesetRuleRateLimit added in v0.29.3

type RulesetRuleRateLimit struct {
	Characteristics   []string `json:"characteristics,omitempty"`
	RequestsPerPeriod int      `json:"requests_per_period,omitempty"`
	Period            int      `json:"period,omitempty"`
	MitigationTimeout int      `json:"mitigation_timeout,omitempty"`

	// Should always be sent as "" will trigger the service to use the Ruleset
	// expression instead.
	MitigationExpression string `json:"mitigation_expression"`
}

RulesetRuleRateLimit contains the structure of a HTTP rate limit Ruleset Rule.

type SaveResponse added in v0.29.3

type SaveResponse struct {
	Response
	Result NotificationResource
}

SaveResponse is returned when a resource is inserted/updated/deleted.

type SecondaryDNSPrimary added in v0.29.3

type SecondaryDNSPrimary struct {
	ID         string `json:"id,omitempty"`
	IP         string `json:"ip"`
	Port       int    `json:"port"`
	IxfrEnable bool   `json:"ixfr_enable"`
	TsigID     string `json:"tsig_id"`
	Name       string `json:"name"`
}

SecondaryDNSPrimary is the representation of the DNS Primary.

type SecondaryDNSPrimaryDetailResponse added in v0.29.3

type SecondaryDNSPrimaryDetailResponse struct {
	Response
	Result SecondaryDNSPrimary `json:"result"`
}

SecondaryDNSPrimaryDetailResponse is the API representation of a single secondary DNS primary response.

type SecondaryDNSPrimaryListResponse added in v0.29.3

type SecondaryDNSPrimaryListResponse struct {
	Response
	Result []SecondaryDNSPrimary `json:"result"`
}

SecondaryDNSPrimaryListResponse is the API representation of all secondary DNS primaries.

type SecondaryDNSTSIG added in v0.29.3

type SecondaryDNSTSIG struct {
	ID     string `json:"id,omitempty"`
	Name   string `json:"name"`
	Secret string `json:"secret"`
	Algo   string `json:"algo"`
}

SecondaryDNSTSIG contains the structure for a secondary DNS TSIG.

type SecondaryDNSTSIGDetailResponse added in v0.29.3

type SecondaryDNSTSIGDetailResponse struct {
	Response
	Result SecondaryDNSTSIG `json:"result"`
}

SecondaryDNSTSIGDetailResponse is the API response for a single secondary DNS TSIG.

type SecondaryDNSTSIGListResponse added in v0.29.3

type SecondaryDNSTSIGListResponse struct {
	Response
	Result []SecondaryDNSTSIG `json:"result"`
}

SecondaryDNSTSIGListResponse is the API response for all secondary DNS TSIGs.

type SecondaryDNSZone added in v0.29.3

type SecondaryDNSZone struct {
	ID                 string    `json:"id,omitempty"`
	Name               string    `json:"name,omitempty"`
	Primaries          []string  `json:"primaries,omitempty"`
	AutoRefreshSeconds int       `json:"auto_refresh_seconds,omitempty"`
	SoaSerial          int       `json:"soa_serial,omitempty"`
	CreatedTime        time.Time `json:"created_time,omitempty"`
	CheckedTime        time.Time `json:"checked_time,omitempty"`
	ModifiedTime       time.Time `json:"modified_time,omitempty"`
}

SecondaryDNSZone contains the high level structure of a secondary DNS zone.

type SecondaryDNSZoneAXFRResponse added in v0.29.3

type SecondaryDNSZoneAXFRResponse struct {
	Response
	Result string `json:"result"`
}

SecondaryDNSZoneAXFRResponse is the API response for a single secondary DNS AXFR response.

type SecondaryDNSZoneDetailResponse added in v0.29.3

type SecondaryDNSZoneDetailResponse struct {
	Response
	Result SecondaryDNSZone `json:"result"`
}

SecondaryDNSZoneDetailResponse is the API response for a single secondary DNS zone.

type SessionAffinityAttributes added in v0.29.3

type SessionAffinityAttributes struct {
	SameSite      string `json:"samesite,omitempty"`
	Secure        string `json:"secure,omitempty"`
	DrainDuration int    `json:"drain_duration,omitempty"`
}

SessionAffinityAttributes represents the fields used to set attributes in a load balancer session affinity cookie.

type SpectrumApplication added in v0.29.3

type SpectrumApplication struct {
	ID               string                         `json:"id,omitempty"`
	Protocol         string                         `json:"protocol,omitempty"`
	IPv4             bool                           `json:"ipv4,omitempty"`
	DNS              SpectrumApplicationDNS         `json:"dns,omitempty"`
	OriginDirect     []string                       `json:"origin_direct,omitempty"`
	OriginPort       *SpectrumApplicationOriginPort `json:"origin_port,omitempty"`
	OriginDNS        *SpectrumApplicationOriginDNS  `json:"origin_dns,omitempty"`
	IPFirewall       bool                           `json:"ip_firewall,omitempty"`
	ProxyProtocol    ProxyProtocol                  `json:"proxy_protocol,omitempty"`
	TLS              string                         `json:"tls,omitempty"`
	TrafficType      string                         `json:"traffic_type,omitempty"`
	EdgeIPs          *SpectrumApplicationEdgeIPs    `json:"edge_ips,omitempty"`
	ArgoSmartRouting bool                           `json:"argo_smart_routing,omitempty"`
	CreatedOn        *time.Time                     `json:"created_on,omitempty"`
	ModifiedOn       *time.Time                     `json:"modified_on,omitempty"`
}

SpectrumApplication defines a single Spectrum Application.

func (*SpectrumApplication) UnmarshalJSON added in v0.29.3

func (a *SpectrumApplication) UnmarshalJSON(data []byte) error

UnmarshalJSON handles setting the `ProxyProtocol` field based on the value of the deprecated `spp` field.

type SpectrumApplicationConnectivity added in v0.29.3

type SpectrumApplicationConnectivity string

SpectrumApplicationConnectivity specifies IP address type on the edge configuration

const (
	// SpectrumConnectivityAll specifies IPv4/6 edge IP
	SpectrumConnectivityAll SpectrumApplicationConnectivity = "all"
	// SpectrumConnectivityIPv4 specifies IPv4 edge IP
	SpectrumConnectivityIPv4 SpectrumApplicationConnectivity = "ipv4"
	// SpectrumConnectivityIPv6 specifies IPv6 edge IP
	SpectrumConnectivityIPv6 SpectrumApplicationConnectivity = "ipv6"
	// SpectrumConnectivityStatic specifies static edge IP configuration
	SpectrumConnectivityStatic SpectrumApplicationConnectivity = "static"
)

func (SpectrumApplicationConnectivity) Dynamic added in v0.29.3

Dynamic checks if address family is specified as dynamic config

func (SpectrumApplicationConnectivity) Static added in v0.29.3

Static checks if address family is specified as static config

func (SpectrumApplicationConnectivity) String added in v0.29.3

func (*SpectrumApplicationConnectivity) UnmarshalJSON added in v0.29.3

func (c *SpectrumApplicationConnectivity) UnmarshalJSON(b []byte) error

UnmarshalJSON function for SpectrumApplicationConnectivity enum

type SpectrumApplicationDNS added in v0.29.3

type SpectrumApplicationDNS struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

SpectrumApplicationDNS holds the external DNS configuration for a Spectrum Application.

type SpectrumApplicationDetailResponse added in v0.29.3

type SpectrumApplicationDetailResponse struct {
	Response
	Result SpectrumApplication `json:"result"`
}

SpectrumApplicationDetailResponse is the structure of the detailed response from the API.

type SpectrumApplicationEdgeIPs added in v0.29.3

type SpectrumApplicationEdgeIPs struct {
	Type         SpectrumApplicationEdgeType      `json:"type"`
	Connectivity *SpectrumApplicationConnectivity `json:"connectivity,omitempty"`
	IPs          []net.IP                         `json:"ips,omitempty"`
}

SpectrumApplicationEdgeIPs represents configuration for Bring-Your-Own-IP https://developers.cloudflare.com/spectrum/getting-started/byoip/

type SpectrumApplicationEdgeType added in v0.29.3

type SpectrumApplicationEdgeType string

SpectrumApplicationEdgeType for possible Edge configurations

const (
	// SpectrumEdgeTypeDynamic IP config
	SpectrumEdgeTypeDynamic SpectrumApplicationEdgeType = "dynamic"
	// SpectrumEdgeTypeStatic IP config
	SpectrumEdgeTypeStatic SpectrumApplicationEdgeType = "static"
)

func (SpectrumApplicationEdgeType) String added in v0.29.3

func (*SpectrumApplicationEdgeType) UnmarshalJSON added in v0.29.3

func (t *SpectrumApplicationEdgeType) UnmarshalJSON(b []byte) error

UnmarshalJSON function for SpectrumApplicationEdgeType enum

type SpectrumApplicationOriginDNS added in v0.29.3

type SpectrumApplicationOriginDNS struct {
	Name string `json:"name"`
}

SpectrumApplicationOriginDNS holds the origin DNS configuration for a Spectrum Application.

type SpectrumApplicationOriginPort added in v0.29.3

type SpectrumApplicationOriginPort struct {
	Port, Start, End uint16
}

SpectrumApplicationOriginPort defines a union of a single port or range of ports

func (*SpectrumApplicationOriginPort) MarshalJSON added in v0.29.3

func (p *SpectrumApplicationOriginPort) MarshalJSON() ([]byte, error)

MarshalJSON converts a single port or port range to a suitable byte slice

func (*SpectrumApplicationOriginPort) UnmarshalJSON added in v0.29.3

func (p *SpectrumApplicationOriginPort) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a byte slice into a single port or port range

type SpectrumApplicationsDetailResponse added in v0.29.3

type SpectrumApplicationsDetailResponse struct {
	Response
	Result []SpectrumApplication `json:"result"`
}

SpectrumApplicationsDetailResponse is the structure of the detailed response from the API.

type SplitTunnel added in v0.29.3

type SplitTunnel struct {
	Address     string `json:"address,omitempty"`
	Host        string `json:"host,omitempty"`
	Description string `json:"description,omitempty"`
}

SplitTunnel represents the individual tunnel struct.

type SplitTunnelResponse added in v0.29.3

type SplitTunnelResponse struct {
	Response
	Result []SplitTunnel `json:"result"`
}

SplitTunnelResponse represents the response from the get split tunnel endpoints.

type StorageKey added in v0.29.3

type StorageKey struct {
	Name       string      `json:"name"`
	Expiration int         `json:"expiration"`
	Metadata   interface{} `json:"metadata"`
}

StorageKey is a key name used to identify a storage value

type TeamsAccount added in v0.29.3

type TeamsAccount struct {
	GatewayTag   string `json:"gateway_tag"`   // Internal teams ID
	ProviderName string `json:"provider_name"` // Auth provider
	ID           string `json:"id"`            // cloudflare account ID
}

type TeamsAccountResponse added in v0.29.3

type TeamsAccountResponse struct {
	Response
	Result TeamsAccount `json:"result"`
}

TeamsAccountResponse is the API response, containing information on teams account.

type TeamsAccountSettings added in v0.29.3

type TeamsAccountSettings struct {
	Antivirus   *TeamsAntivirus   `json:"antivirus,omitempty"`
	TLSDecrypt  *TeamsTLSDecrypt  `json:"tls_decrypt,omitempty"`
	ActivityLog *TeamsActivityLog `json:"activity_log,omitempty"`
	BlockPage   *TeamsBlockPage   `json:"block_page,omitempty"`
	FIPS        *TeamsFIPS        `json:"fips,omitempty"`
}

type TeamsActivityLog added in v0.29.3

type TeamsActivityLog struct {
	Enabled bool `json:"enabled"`
}

type TeamsAntivirus added in v0.29.3

type TeamsAntivirus struct {
	EnabledDownloadPhase bool `json:"enabled_download_phase"`
	EnabledUploadPhase   bool `json:"enabled_upload_phase"`
	FailClosed           bool `json:"fail_closed"`
}

type TeamsBISOAdminControlSettings added in v0.29.3

type TeamsBISOAdminControlSettings struct {
	DisablePrinting  bool `json:"dp"`
	DisableCopyPaste bool `json:"dcp"`
}

type TeamsBlockPage added in v0.29.3

type TeamsBlockPage struct {
	Enabled         *bool  `json:"enabled,omitempty"`
	FooterText      string `json:"footer_text,omitempty"`
	HeaderText      string `json:"header_text,omitempty"`
	LogoPath        string `json:"logo_path,omitempty"`
	BackgroundColor string `json:"background_color,omitempty"`
	Name            string `json:"name,omitempty"`
}

type TeamsConfigResponse added in v0.29.3

type TeamsConfigResponse struct {
	Response
	Result TeamsConfiguration `json:"result"`
}

TeamsConfigResponse is the API response, containing information on teams account config.

type TeamsConfiguration added in v0.29.3

type TeamsConfiguration struct {
	Settings  TeamsAccountSettings `json:"settings"`
	CreatedAt time.Time            `json:"created_at,omitempty"`
	UpdatedAt time.Time            `json:"updated_at,omitempty"`
}

TeamsConfiguration data model.

type TeamsFIPS added in v0.29.3

type TeamsFIPS struct {
	TLS bool `json:"tls"`
}

type TeamsFilterType added in v0.29.3

type TeamsFilterType string
const (
	HttpFilter TeamsFilterType = "http"
	DnsFilter  TeamsFilterType = "dns"
	L4Filter   TeamsFilterType = "l4"
)

type TeamsGatewayAction added in v0.29.3

type TeamsGatewayAction string
const (
	Allow        TeamsGatewayAction = "allow"
	Block        TeamsGatewayAction = "block"
	SafeSearch   TeamsGatewayAction = "safesearch"
	YTRestricted TeamsGatewayAction = "ytrestricted"
	On           TeamsGatewayAction = "on"
	Off          TeamsGatewayAction = "off"
	Scan         TeamsGatewayAction = "scan"
	NoScan       TeamsGatewayAction = "noscan"
	Isolate      TeamsGatewayAction = "isolate"
	NoIsolate    TeamsGatewayAction = "noisolate"
	Override     TeamsGatewayAction = "override"
	L4Override   TeamsGatewayAction = "l4_override"
)

type TeamsL4OverrideSettings added in v0.29.3

type TeamsL4OverrideSettings struct {
	IP   string `json:"ip,omitempty"`
	Port int    `json:"port,omitempty"`
}

TeamsL4OverrideSettings used in l4 filter type rule with action set to override

type TeamsList added in v0.29.3

type TeamsList struct {
	ID          string          `json:"id,omitempty"`
	Name        string          `json:"name"`
	Type        string          `json:"type"`
	Description string          `json:"description,omitempty"`
	Items       []TeamsListItem `json:"items,omitempty"`
	Count       uint64          `json:"count,omitempty"`
	CreatedAt   *time.Time      `json:"created_at,omitempty"`
	UpdatedAt   *time.Time      `json:"updated_at,omitempty"`
}

TeamsList represents a Teams List.

type TeamsListDetailResponse added in v0.29.3

type TeamsListDetailResponse struct {
	Response
	Result TeamsList `json:"result"`
}

TeamsListDetailResponse is the API response, containing a single teams list.

type TeamsListItem added in v0.29.3

type TeamsListItem struct {
	Value     string     `json:"value"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
}

TeamsListItem represents a single list item.

type TeamsListItemsListResponse added in v0.29.3

type TeamsListItemsListResponse struct {
	Result []TeamsListItem `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

TeamsListItemsListResponse represents the response from the list teams list items endpoint.

type TeamsListListResponse added in v0.29.3

type TeamsListListResponse struct {
	Result []TeamsList `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

TeamsListListResponse represents the response from the list teams lists endpoint.

type TeamsLocation added in v0.29.3

type TeamsLocation struct {
	ID                    string                 `json:"id"`
	Name                  string                 `json:"name"`
	Networks              []TeamsLocationNetwork `json:"networks"`
	PolicyIDs             []string               `json:"policy_ids"`
	Ip                    string                 `json:"ip,omitempty"`
	Subdomain             string                 `json:"doh_subdomain"`
	AnonymizedLogsEnabled bool                   `json:"anonymized_logs_enabled"`
	IPv4Destination       string                 `json:"ipv4_destination"`
	ClientDefault         bool                   `json:"client_default"`

	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

type TeamsLocationDetailResponse added in v0.29.3

type TeamsLocationDetailResponse struct {
	Response
	Result TeamsLocation `json:"result"`
}

type TeamsLocationNetwork added in v0.29.3

type TeamsLocationNetwork struct {
	ID      string `json:"id"`
	Network string `json:"network"`
}

type TeamsLocationsListResponse added in v0.29.3

type TeamsLocationsListResponse struct {
	Response
	ResultInfo `json:"result_info"`
	Result     []TeamsLocation `json:"result"`
}

type TeamsRule added in v0.29.3

type TeamsRule struct {
	ID            string             `json:"id,omitempty"`
	CreatedAt     *time.Time         `json:"created_at,omitempty"`
	UpdatedAt     *time.Time         `json:"updated_at,omitempty"`
	DeletedAt     *time.Time         `json:"deleted_at,omitempty"`
	Name          string             `json:"name"`
	Description   string             `json:"description"`
	Precedence    uint64             `json:"precedence"`
	Enabled       bool               `json:"enabled"`
	Action        TeamsGatewayAction `json:"action"`
	Filters       []TeamsFilterType  `json:"filters"`
	Traffic       string             `json:"traffic"`
	Identity      string             `json:"identity"`
	DevicePosture string             `json:"device_posture"`
	Version       uint64             `json:"version"`
	RuleSettings  TeamsRuleSettings  `json:"rule_settings,omitempty"`
}

TeamsRule represents an Teams wirefilter rule.

type TeamsRulePatchRequest added in v0.29.3

type TeamsRulePatchRequest struct {
	ID           string             `json:"id"`
	Name         string             `json:"name"`
	Description  string             `json:"description"`
	Precedence   uint64             `json:"precedence"`
	Enabled      bool               `json:"enabled"`
	Action       TeamsGatewayAction `json:"action"`
	RuleSettings TeamsRuleSettings  `json:"rule_settings,omitempty"`
}

TeamsRulePatchRequest is used to patch an existing rule.

type TeamsRuleResponse added in v0.29.3

type TeamsRuleResponse struct {
	Response
	Result TeamsRule `json:"result"`
}

TeamsRuleResponse is the API response, containing a single rule.

type TeamsRuleSettings added in v0.29.3

type TeamsRuleSettings struct {
	// Enable block page on rules with action block
	BlockPageEnabled bool `json:"block_page_enabled"`

	// show this string at block page caused by this rule
	BlockReason string `json:"block_reason"`

	// list of ipv4 or ipv6 ips to override with, when action is set to dns override
	OverrideIPs []string `json:"override_ips"`

	// host name to override with when action is set to dns override. Can not be used with OverrideIPs
	OverrideHost string `json:"override_host"`

	// settings for l4(network) level overrides
	L4Override *TeamsL4OverrideSettings `json:"l4override"`

	// settings for browser isolation actions
	BISOAdminControls *TeamsBISOAdminControlSettings `json:"biso_admin_controls"`
}

type TeamsRulesResponse added in v0.29.3

type TeamsRulesResponse struct {
	Response
	Result []TeamsRule `json:"result"`
}

TeamsRuleResponse is the API response, containing an array of rules.

type TeamsTLSDecrypt added in v0.29.3

type TeamsTLSDecrypt struct {
	Enabled bool `json:"enabled"`
}

type UniversalSSLCertificatePackValidationMethodSetting added in v0.29.3

type UniversalSSLCertificatePackValidationMethodSetting struct {
	ValidationMethod string `json:"validation_method"`
}

type UniversalSSLSetting added in v0.29.3

type UniversalSSLSetting struct {
	Enabled bool `json:"enabled"`
}

UniversalSSLSetting represents a universal ssl setting's properties.

type UniversalSSLVerificationDetails added in v0.29.3

type UniversalSSLVerificationDetails struct {
	CertificateStatus  string                       `json:"certificate_status"`
	VerificationType   string                       `json:"verification_type"`
	ValidationMethod   string                       `json:"validation_method"`
	CertPackUUID       string                       `json:"cert_pack_uuid"`
	VerificationStatus bool                         `json:"verification_status"`
	BrandCheck         bool                         `json:"brand_check"`
	VerificationInfo   UniversalSSLVerificationInfo `json:"verification_info"`
}

UniversalSSLVerificationDetails represents a universal ssl verification's properties.

type UniversalSSLVerificationInfo added in v0.29.3

type UniversalSSLVerificationInfo struct {
	RecordName   string `json:"record_name"`
	RecordTarget string `json:"record_target"`
}

UniversalSSLVerificationInfo represents DCV record.

type UpdateMagicFirewallRulesetRequest added in v0.29.3

type UpdateMagicFirewallRulesetRequest struct {
	Description string                     `json:"description"`
	Rules       []MagicFirewallRulesetRule `json:"rules"`
}

UpdateMagicFirewallRulesetRequest contains data for a Magic Firewall ruleset update

type UpdateMagicFirewallRulesetResponse added in v0.29.3

type UpdateMagicFirewallRulesetResponse struct {
	Response
	Result MagicFirewallRuleset `json:"result"`
}

UpdateMagicFirewallRulesetResponse contains response data when updating an existing Magic Firewall ruleset

type UpdateMagicTransitStaticRouteResponse added in v0.29.3

type UpdateMagicTransitStaticRouteResponse struct {
	Response
	Result struct {
		Modified      bool                    `json:"modified"`
		ModifiedRoute MagicTransitStaticRoute `json:"modified_route"`
	} `json:"result"`
}

UpdateMagicTransitStaticRouteResponse contains a static route update response

type UpdateRulesetRequest added in v0.29.3

type UpdateRulesetRequest struct {
	Description string        `json:"description"`
	Rules       []RulesetRule `json:"rules"`
}

UpdateRulesetRequest is the representation of a Ruleset update.

type UpdateRulesetResponse added in v0.29.3

type UpdateRulesetResponse struct {
	Response
	Result Ruleset `json:"result"`
}

UpdateRulesetResponse contains response data when updating an existing Ruleset.

type User

type User struct {
	ID         string     `json:"id,omitempty"`
	Email      string     `json:"email,omitempty"`
	FirstName  string     `json:"first_name,omitempty"`
	LastName   string     `json:"last_name,omitempty"`
	Username   string     `json:"username,omitempty"`
	Telephone  string     `json:"telephone,omitempty"`
	Country    string     `json:"country,omitempty"`
	Zipcode    string     `json:"zipcode,omitempty"`
	CreatedOn  *time.Time `json:"created_on,omitempty"`
	ModifiedOn *time.Time `json:"modified_on,omitempty"`
	APIKey     string     `json:"api_key,omitempty"`
	TwoFA      bool       `json:"two_factor_authentication_enabled,omitempty"`
	Betas      []string   `json:"betas,omitempty"`
	Accounts   []Account  `json:"organizations,omitempty"`
}

User describes a user account.

type UserAgentRule added in v0.8.0

type UserAgentRule struct {
	ID            string              `json:"id"`
	Description   string              `json:"description"`
	Mode          string              `json:"mode"`
	Configuration UserAgentRuleConfig `json:"configuration"`
	Paused        bool                `json:"paused"`
}

UserAgentRule represents a User-Agent Block. These rules can be used to challenge, block or whitelist specific User-Agents for a given zone.

type UserAgentRuleConfig added in v0.8.0

type UserAgentRuleConfig ZoneLockdownConfig

UserAgentRuleConfig represents a Zone Lockdown config, which comprises a Target ("ip" or "ip_range") and a Value (an IP address or IP+mask, respectively.)

type UserAgentRuleListResponse added in v0.8.0

type UserAgentRuleListResponse struct {
	Result []UserAgentRule `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

UserAgentRuleListResponse represents a response from the List Zone Lockdown endpoint.

type UserAgentRuleResponse added in v0.8.0

type UserAgentRuleResponse struct {
	Result UserAgentRule `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

UserAgentRuleResponse represents a response from the Zone Lockdown endpoint.

type UserBillingProfile added in v0.7.3

type UserBillingProfile struct {
	ID              string     `json:"id,omitempty"`
	FirstName       string     `json:"first_name,omitempty"`
	LastName        string     `json:"last_name,omitempty"`
	Address         string     `json:"address,omitempty"`
	Address2        string     `json:"address2,omitempty"`
	Company         string     `json:"company,omitempty"`
	City            string     `json:"city,omitempty"`
	State           string     `json:"state,omitempty"`
	ZipCode         string     `json:"zipcode,omitempty"`
	Country         string     `json:"country,omitempty"`
	Telephone       string     `json:"telephone,omitempty"`
	CardNumber      string     `json:"card_number,omitempty"`
	CardExpiryYear  int        `json:"card_expiry_year,omitempty"`
	CardExpiryMonth int        `json:"card_expiry_month,omitempty"`
	VAT             string     `json:"vat,omitempty"`
	CreatedOn       *time.Time `json:"created_on,omitempty"`
	EditedOn        *time.Time `json:"edited_on,omitempty"`
}

UserBillingProfile contains Billing Profile information.

type UserResponse

type UserResponse struct {
	Response
	Result User `json:"result"`
}

UserResponse wraps a response containing User accounts.

type VirtualDNS deprecated

type VirtualDNS struct {
	ID                   string   `json:"id"`
	Name                 string   `json:"name"`
	OriginIPs            []string `json:"origin_ips"`
	VirtualDNSIPs        []string `json:"virtual_dns_ips"`
	MinimumCacheTTL      uint     `json:"minimum_cache_ttl"`
	MaximumCacheTTL      uint     `json:"maximum_cache_ttl"`
	DeprecateAnyRequests bool     `json:"deprecate_any_requests"`
	ModifiedOn           string   `json:"modified_on"`
}

VirtualDNS represents a Virtual DNS configuration.

Deprecated: Use DNSFirewallCluster instead.

type VirtualDNSAnalytics deprecated added in v0.29.3

type VirtualDNSAnalytics struct {
	Totals VirtualDNSAnalyticsMetrics `json:"totals"`
	Min    VirtualDNSAnalyticsMetrics `json:"min"`
	Max    VirtualDNSAnalyticsMetrics `json:"max"`
}

VirtualDNSAnalytics represents a set of aggregated Virtual DNS metrics.

Deprecated: Use DNSFirewallAnalytics instead.

type VirtualDNSAnalyticsMetrics deprecated added in v0.29.3

type VirtualDNSAnalyticsMetrics DNSFirewallAnalyticsMetrics

VirtualDNSAnalyticsMetrics represents a group of aggregated Virtual DNS metrics.

Deprecated: Use DNSFirewallAnalyticsMetrics instead.

type VirtualDNSAnalyticsResponse deprecated added in v0.29.3

type VirtualDNSAnalyticsResponse struct {
	Response
	Result VirtualDNSAnalytics `json:"result"`
}

VirtualDNSAnalyticsResponse represents a Virtual DNS analytics response.

Deprecated: This internal type will be removed in the future.

type VirtualDNSListResponse deprecated

type VirtualDNSListResponse struct {
	Response
	Result []*VirtualDNS `json:"result"`
}

VirtualDNSListResponse represents an array of Virtual DNS responses.

Deprecated: This internal type will be removed in the future.

type VirtualDNSResponse deprecated

type VirtualDNSResponse struct {
	Response
	Result *VirtualDNS `json:"result"`
}

VirtualDNSResponse represents a Virtual DNS response.

Deprecated: This internal type will be removed in the future.

type VirtualDNSUserAnalyticsOptions deprecated added in v0.29.3

type VirtualDNSUserAnalyticsOptions DNSFirewallUserAnalyticsOptions

VirtualDNSUserAnalyticsOptions represents range and dimension selection on analytics endpoint

Deprecated: Use DNSFirewallUserAnalyticsOptions instead.

type WAFGroup added in v0.29.3

type WAFGroup struct {
	ID                 string   `json:"id"`
	Name               string   `json:"name"`
	Description        string   `json:"description"`
	RulesCount         int      `json:"rules_count"`
	ModifiedRulesCount int      `json:"modified_rules_count"`
	PackageID          string   `json:"package_id"`
	Mode               string   `json:"mode"`
	AllowedModes       []string `json:"allowed_modes"`
}

WAFGroup represents a WAF rule group.

type WAFGroupResponse added in v0.29.3

type WAFGroupResponse struct {
	Response
	Result     WAFGroup   `json:"result"`
	ResultInfo ResultInfo `json:"result_info"`
}

WAFGroupResponse represents the response from the WAF group endpoint.

type WAFGroupsResponse added in v0.29.3

type WAFGroupsResponse struct {
	Response
	Result     []WAFGroup `json:"result"`
	ResultInfo ResultInfo `json:"result_info"`
}

WAFGroupsResponse represents the response from the WAF groups endpoint.

type WAFOverride added in v0.29.3

type WAFOverride struct {
	ID            string            `json:"id,omitempty"`
	Description   string            `json:"description"`
	URLs          []string          `json:"urls"`
	Priority      int               `json:"priority"`
	Groups        map[string]string `json:"groups"`
	RewriteAction map[string]string `json:"rewrite_action"`
	Rules         map[string]string `json:"rules"`
	Paused        bool              `json:"paused"`
}

WAFOverride represents a WAF override.

type WAFOverrideResponse added in v0.29.3

type WAFOverrideResponse struct {
	Response
	Result     WAFOverride `json:"result"`
	ResultInfo ResultInfo  `json:"result_info"`
}

WAFOverrideResponse represents the response form the WAF override endpoint.

type WAFOverridesResponse added in v0.29.3

type WAFOverridesResponse struct {
	Response
	Result     []WAFOverride `json:"result"`
	ResultInfo ResultInfo    `json:"result_info"`
}

WAFOverridesResponse represents the response form the WAF overrides endpoint.

type WAFPackage

type WAFPackage struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	ZoneID        string `json:"zone_id"`
	DetectionMode string `json:"detection_mode"`
	Sensitivity   string `json:"sensitivity"`
	ActionMode    string `json:"action_mode"`
}

WAFPackage represents a WAF package configuration.

type WAFPackageOptions added in v0.29.3

type WAFPackageOptions struct {
	Sensitivity string `json:"sensitivity,omitempty"`
	ActionMode  string `json:"action_mode,omitempty"`
}

WAFPackageOptions represents options to edit a WAF package.

type WAFPackageResponse added in v0.29.3

type WAFPackageResponse struct {
	Response
	Result     WAFPackage `json:"result"`
	ResultInfo ResultInfo `json:"result_info"`
}

WAFPackageResponse represents the response from the WAF package endpoint.

type WAFPackagesResponse

type WAFPackagesResponse struct {
	Response
	Result     []WAFPackage `json:"result"`
	ResultInfo ResultInfo   `json:"result_info"`
}

WAFPackagesResponse represents the response from the WAF packages endpoint.

type WAFRule

type WAFRule struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Priority    string `json:"priority"`
	PackageID   string `json:"package_id"`
	Group       struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"group"`
	Mode         string   `json:"mode"`
	DefaultMode  string   `json:"default_mode"`
	AllowedModes []string `json:"allowed_modes"`
}

WAFRule represents a WAF rule.

type WAFRuleOptions added in v0.29.3

type WAFRuleOptions struct {
	Mode string `json:"mode"`
}

WAFRuleOptions is a subset of WAFRule, for editable options.

type WAFRuleResponse added in v0.29.3

type WAFRuleResponse struct {
	Response
	Result     WAFRule    `json:"result"`
	ResultInfo ResultInfo `json:"result_info"`
}

WAFRuleResponse represents the response from the WAF rule endpoint.

type WAFRulesResponse

type WAFRulesResponse struct {
	Response
	Result     []WAFRule  `json:"result"`
	ResultInfo ResultInfo `json:"result_info"`
}

WAFRulesResponse represents the response from the WAF rules endpoint.

type WaitingRoom added in v0.29.3

type WaitingRoom struct {
	ID                    string    `json:"id,omitempty"`
	CreatedOn             time.Time `json:"created_on,omitempty"`
	ModifiedOn            time.Time `json:"modified_on,omitempty"`
	Name                  string    `json:"name"`
	Description           string    `json:"description,omitempty"`
	Suspended             bool      `json:"suspended"`
	Host                  string    `json:"host"`
	Path                  string    `json:"path"`
	QueueAll              bool      `json:"queue_all"`
	NewUsersPerMinute     int       `json:"new_users_per_minute"`
	TotalActiveUsers      int       `json:"total_active_users"`
	SessionDuration       int       `json:"session_duration"`
	DisableSessionRenewal bool      `json:"disable_session_renewal"`
	CustomPageHTML        string    `json:"custom_page_html,omitempty"`
	JsonResponseEnabled   bool      `json:"json_response_enabled"`
}

WaitingRoom describes a WaitingRoom object.

type WaitingRoomDetailResponse added in v0.29.3

type WaitingRoomDetailResponse struct {
	Response
	Result WaitingRoom `json:"result"`
}

WaitingRoomDetailResponse is the API response, containing a single WaitingRoom.

type WaitingRoomsResponse added in v0.29.3

type WaitingRoomsResponse struct {
	Response
	Result []WaitingRoom `json:"result"`
}

WaitingRoomsResponse is the API response, containing an array of WaitingRooms.

type WorkerBinding added in v0.29.3

type WorkerBinding interface {
	Type() WorkerBindingType
	// contains filtered or unexported methods
}

WorkerBinding is the generic interface implemented by all of the various binding types

type WorkerBindingListItem added in v0.29.3

type WorkerBindingListItem struct {
	Name    string `json:"name"`
	Binding WorkerBinding
}

WorkerBindingListItem a struct representing an individual binding in a list of bindings

type WorkerBindingListResponse added in v0.29.3

type WorkerBindingListResponse struct {
	Response
	BindingList []WorkerBindingListItem
}

WorkerBindingListResponse wrapper struct for API response to worker binding list API call

type WorkerBindingType added in v0.29.3

type WorkerBindingType string

WorkerBindingType represents a particular type of binding

const (
	// WorkerInheritBindingType is the type for inherited bindings
	WorkerInheritBindingType WorkerBindingType = "inherit"
	// WorkerKvNamespaceBindingType is the type for KV Namespace bindings
	WorkerKvNamespaceBindingType WorkerBindingType = "kv_namespace"
	// WorkerWebAssemblyBindingType is the type for Web Assembly module bindings
	WorkerWebAssemblyBindingType WorkerBindingType = "wasm_module"
	// WorkerSecretTextBindingType is the type for secret text bindings
	WorkerSecretTextBindingType WorkerBindingType = "secret_text"
	// WorkerPlainTextBindingType is the type for plain text bindings
	WorkerPlainTextBindingType WorkerBindingType = "plain_text"
)

func (WorkerBindingType) String added in v0.29.3

func (b WorkerBindingType) String() string

type WorkerCronTrigger added in v0.29.3

type WorkerCronTrigger struct {
	Cron       string     `json:"cron"`
	CreatedOn  *time.Time `json:"created_on,omitempty"`
	ModifiedOn *time.Time `json:"modified_on,omitempty"`
}

WorkerCronTrigger holds an individual cron schedule for a worker.

type WorkerCronTriggerResponse added in v0.29.3

type WorkerCronTriggerResponse struct {
	Response
	Result WorkerCronTriggerSchedules `json:"result"`
}

WorkerCronTriggerResponse represents the response from the Worker cron trigger API endpoint.

type WorkerCronTriggerSchedules added in v0.29.3

type WorkerCronTriggerSchedules struct {
	Schedules []WorkerCronTrigger `json:"schedules"`
}

WorkerCronTriggerSchedules contains the schedule of Worker cron triggers.

type WorkerInheritBinding added in v0.29.3

type WorkerInheritBinding struct {
	// Optional parameter that allows for renaming a binding without changing
	// its contents. If `OldName` is empty, the binding name will not be changed.
	OldName string
}

WorkerInheritBinding will just persist whatever binding content was previously uploaded

func (WorkerInheritBinding) Type added in v0.29.3

Type returns the type of the binding

type WorkerKvNamespaceBinding added in v0.29.3

type WorkerKvNamespaceBinding struct {
	NamespaceID string
}

WorkerKvNamespaceBinding is a binding to a Workers KV Namespace

https://developers.cloudflare.com/workers/archive/api/resource-bindings/kv-namespaces/

func (WorkerKvNamespaceBinding) Type added in v0.29.3

Type returns the type of the binding

type WorkerListResponse added in v0.29.3

type WorkerListResponse struct {
	Response
	WorkerList []WorkerMetaData `json:"result"`
}

WorkerListResponse wrapper struct for API response to worker script list API call

type WorkerMetaData added in v0.29.3

type WorkerMetaData struct {
	ID         string    `json:"id,omitempty"`
	ETAG       string    `json:"etag,omitempty"`
	Size       int       `json:"size,omitempty"`
	CreatedOn  time.Time `json:"created_on,omitempty"`
	ModifiedOn time.Time `json:"modified_on,omitempty"`
}

WorkerMetaData contains worker script information such as size, creation & modification dates

type WorkerPlainTextBinding added in v0.29.3

type WorkerPlainTextBinding struct {
	Text string
}

WorkerPlainTextBinding is a binding to plain text

https://developers.cloudflare.com/workers/tooling/api/scripts/#add-a-plain-text-binding

func (WorkerPlainTextBinding) Type added in v0.29.3

Type returns the type of the binding

type WorkerRequestParams added in v0.29.3

type WorkerRequestParams struct {
	ZoneID     string
	ScriptName string
}

WorkerRequestParams provides parameters for worker requests for both enterprise and standard requests

type WorkerRoute added in v0.29.3

type WorkerRoute struct {
	ID      string `json:"id,omitempty"`
	Pattern string `json:"pattern"`
	Enabled bool   `json:"enabled"` // this is deprecated: https://api.cloudflare.com/#worker-filters-deprecated--properties
	Script  string `json:"script,omitempty"`
}

WorkerRoute is used to map traffic matching a URL pattern to a workers

API reference: https://api.cloudflare.com/#worker-routes-properties

type WorkerRouteResponse added in v0.29.3

type WorkerRouteResponse struct {
	Response
	WorkerRoute `json:"result"`
}

WorkerRouteResponse embeds Response struct and a single WorkerRoute

type WorkerRoutesResponse added in v0.29.3

type WorkerRoutesResponse struct {
	Response
	Routes []WorkerRoute `json:"result"`
}

WorkerRoutesResponse embeds Response struct and slice of WorkerRoutes

type WorkerScript added in v0.29.3

type WorkerScript struct {
	WorkerMetaData
	Script string `json:"script"`
}

WorkerScript Cloudflare Worker struct with metadata

type WorkerScriptParams added in v0.29.3

type WorkerScriptParams struct {
	Script string

	// Bindings should be a map where the keys are the binding name, and the
	// values are the binding content
	Bindings map[string]WorkerBinding
}

WorkerScriptParams provides a worker script and the associated bindings

type WorkerScriptResponse added in v0.29.3

type WorkerScriptResponse struct {
	Response
	WorkerScript `json:"result"`
}

WorkerScriptResponse wrapper struct for API response to worker script calls

type WorkerSecretTextBinding added in v0.29.3

type WorkerSecretTextBinding struct {
	Text string
}

WorkerSecretTextBinding is a binding to secret text

https://developers.cloudflare.com/workers/tooling/api/scripts/#add-a-secret-text-binding

func (WorkerSecretTextBinding) Type added in v0.29.3

Type returns the type of the binding

type WorkerWebAssemblyBinding added in v0.29.3

type WorkerWebAssemblyBinding struct {
	Module io.Reader
}

WorkerWebAssemblyBinding is a binding to a WebAssembly module

https://developers.cloudflare.com/workers/archive/api/resource-bindings/webassembly-modules/

func (WorkerWebAssemblyBinding) Type added in v0.29.3

Type returns the type of the binding

type WorkersKVBulkWriteRequest added in v0.29.3

type WorkersKVBulkWriteRequest []*WorkersKVPair

WorkersKVBulkWriteRequest is the request to the bulk KV api

type WorkersKVNamespace added in v0.29.3

type WorkersKVNamespace struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

WorkersKVNamespace contains the unique identifier and title of a storage namespace

type WorkersKVNamespaceRequest added in v0.29.3

type WorkersKVNamespaceRequest struct {
	Title string `json:"title"`
}

WorkersKVNamespaceRequest provides parameters for creating and updating storage namespaces

type WorkersKVNamespaceResponse added in v0.29.3

type WorkersKVNamespaceResponse struct {
	Response
	Result WorkersKVNamespace `json:"result"`
}

WorkersKVNamespaceResponse is the response received when creating storage namespaces

type WorkersKVPair added in v0.29.3

type WorkersKVPair struct {
	Key           string      `json:"key"`
	Value         string      `json:"value"`
	Expiration    int         `json:"expiration,omitempty"`
	ExpirationTTL int         `json:"expiration_ttl,omitempty"`
	Metadata      interface{} `json:"metadata,omitempty"`
	Base64        bool        `json:"base64,omitempty"`
}

WorkersKVPair is used in an array in the request to the bulk KV api

type WorkersListSecretsResponse added in v0.29.3

type WorkersListSecretsResponse struct {
	Response
	Result []WorkersSecret `json:"result"`
}

WorkersListSecretsResponse is the response received when listing secrets

type WorkersPutSecretRequest added in v0.29.3

type WorkersPutSecretRequest struct {
	Name string            `json:"name"`
	Text string            `json:"text"`
	Type WorkerBindingType `json:"type"`
}

WorkersPutSecretRequest provides parameters for creating and updating secrets

type WorkersPutSecretResponse added in v0.29.3

type WorkersPutSecretResponse struct {
	Response
	Result WorkersSecret `json:"result"`
}

WorkersPutSecretResponse is the response received when creating or updating a secret

type WorkersSecret added in v0.29.3

type WorkersSecret struct {
	Name string `json:"name"`
	Type string `json:"secret_text"`
}

WorkersSecret contains the name and type of the secret

type Zone

type Zone struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// DevMode contains the time in seconds until development expires (if
	// positive) or since it expired (if negative). It will be 0 if never used.
	DevMode           int       `json:"development_mode"`
	OriginalNS        []string  `json:"original_name_servers"`
	OriginalRegistrar string    `json:"original_registrar"`
	OriginalDNSHost   string    `json:"original_dnshost"`
	CreatedOn         time.Time `json:"created_on"`
	ModifiedOn        time.Time `json:"modified_on"`
	NameServers       []string  `json:"name_servers"`
	Owner             Owner     `json:"owner"`
	Permissions       []string  `json:"permissions"`
	Plan              ZonePlan  `json:"plan"`
	PlanPending       ZonePlan  `json:"plan_pending,omitempty"`
	Status            string    `json:"status"`
	Paused            bool      `json:"paused"`
	Type              string    `json:"type"`
	Host              struct {
		Name    string
		Website string
	} `json:"host"`
	VanityNS        []string `json:"vanity_name_servers"`
	Betas           []string `json:"betas"`
	DeactReason     string   `json:"deactivation_reason"`
	Meta            ZoneMeta `json:"meta"`
	Account         Account  `json:"account"`
	VerificationKey string   `json:"verification_key"`
}

Zone describes a Cloudflare zone.

type ZoneAnalytics

type ZoneAnalytics struct {
	Since    time.Time `json:"since"`
	Until    time.Time `json:"until"`
	Requests struct {
		All         int            `json:"all"`
		Cached      int            `json:"cached"`
		Uncached    int            `json:"uncached"`
		ContentType map[string]int `json:"content_type"`
		Country     map[string]int `json:"country"`
		SSL         struct {
			Encrypted   int `json:"encrypted"`
			Unencrypted int `json:"unencrypted"`
		} `json:"ssl"`
		HTTPStatus map[string]int `json:"http_status"`
	} `json:"requests"`
	Bandwidth struct {
		All         int            `json:"all"`
		Cached      int            `json:"cached"`
		Uncached    int            `json:"uncached"`
		ContentType map[string]int `json:"content_type"`
		Country     map[string]int `json:"country"`
		SSL         struct {
			Encrypted   int `json:"encrypted"`
			Unencrypted int `json:"unencrypted"`
		} `json:"ssl"`
	} `json:"bandwidth"`
	Threats struct {
		All     int            `json:"all"`
		Country map[string]int `json:"country"`
		Type    map[string]int `json:"type"`
	} `json:"threats"`
	Pageviews struct {
		All           int            `json:"all"`
		SearchEngines map[string]int `json:"search_engines"`
	} `json:"pageviews"`
	Uniques struct {
		All int `json:"all"`
	}
}

ZoneAnalytics contains analytics data for a zone.

type ZoneAnalyticsColocation

type ZoneAnalyticsColocation struct {
	ColocationID string          `json:"colo_id"`
	Timeseries   []ZoneAnalytics `json:"timeseries"`
}

ZoneAnalyticsColocation contains analytics data by datacenter.

type ZoneAnalyticsData

type ZoneAnalyticsData struct {
	Totals     ZoneAnalytics   `json:"totals"`
	Timeseries []ZoneAnalytics `json:"timeseries"`
}

ZoneAnalyticsData contains totals and timeseries analytics data for a zone.

type ZoneAnalyticsOptions

type ZoneAnalyticsOptions struct {
	Since      *time.Time
	Until      *time.Time
	Continuous *bool
}

ZoneAnalyticsOptions represents the optional parameters in Zone Analytics endpoint requests.

type ZoneCustomSSL

type ZoneCustomSSL struct {
	ID              string                       `json:"id"`
	Hosts           []string                     `json:"hosts"`
	Issuer          string                       `json:"issuer"`
	Signature       string                       `json:"signature"`
	Status          string                       `json:"status"`
	BundleMethod    string                       `json:"bundle_method"`
	GeoRestrictions ZoneCustomSSLGeoRestrictions `json:"geo_restrictions"`
	ZoneID          string                       `json:"zone_id"`
	UploadedOn      time.Time                    `json:"uploaded_on"`
	ModifiedOn      time.Time                    `json:"modified_on"`
	ExpiresOn       time.Time                    `json:"expires_on"`
	Priority        int                          `json:"priority"`
	KeylessServer   KeylessSSL                   `json:"keyless_server"`
}

ZoneCustomSSL represents custom SSL certificate metadata.

type ZoneCustomSSLGeoRestrictions added in v0.29.3

type ZoneCustomSSLGeoRestrictions struct {
	Label string `json:"label"`
}

ZoneCustomSSLGeoRestrictions represents the parameter to create or update geographic restrictions on a custom ssl certificate.

type ZoneCustomSSLOptions

type ZoneCustomSSLOptions struct {
	Certificate     string                        `json:"certificate"`
	PrivateKey      string                        `json:"private_key"`
	BundleMethod    string                        `json:"bundle_method,omitempty"`
	GeoRestrictions *ZoneCustomSSLGeoRestrictions `json:"geo_restrictions,omitempty"`
	Type            string                        `json:"type,omitempty"`
}

ZoneCustomSSLOptions represents the parameters to create or update an existing custom SSL configuration.

type ZoneCustomSSLPriority

type ZoneCustomSSLPriority struct {
	ID       string `json:"ID"`
	Priority int    `json:"priority"`
}

ZoneCustomSSLPriority represents a certificate's ID and priority. It is a subset of ZoneCustomSSL used for patch requests.

type ZoneDNSSEC added in v0.29.3

type ZoneDNSSEC struct {
	Status          string    `json:"status"`
	Flags           int       `json:"flags"`
	Algorithm       string    `json:"algorithm"`
	KeyType         string    `json:"key_type"`
	DigestType      string    `json:"digest_type"`
	DigestAlgorithm string    `json:"digest_algorithm"`
	Digest          string    `json:"digest"`
	DS              string    `json:"ds"`
	KeyTag          int       `json:"key_tag"`
	PublicKey       string    `json:"public_key"`
	ModifiedOn      time.Time `json:"modified_on"`
}

ZoneDNSSEC represents the response from the Zone DNSSEC Setting result

type ZoneDNSSECDeleteResponse added in v0.29.3

type ZoneDNSSECDeleteResponse struct {
	Response
	Result string `json:"result"`
}

ZoneDNSSECDeleteResponse represents the response from the Zone DNSSEC Delete request

type ZoneDNSSECResponse added in v0.29.3

type ZoneDNSSECResponse struct {
	Response
	Result ZoneDNSSEC `json:"result"`
}

ZoneDNSSECResponse represents the response from the Zone DNSSEC Setting

type ZoneDNSSECUpdateOptions added in v0.29.3

type ZoneDNSSECUpdateOptions struct {
	Status string `json:"status"`
}

ZoneDNSSECUpdateOptions represents the options for DNSSEC update

type ZoneID

type ZoneID struct {
	ID string `json:"id"`
}

ZoneID contains only the zone ID.

type ZoneIDResponse

type ZoneIDResponse struct {
	Response
	Result ZoneID `json:"result"`
}

ZoneIDResponse represents the response from the Zone endpoint, containing only a zone ID.

type ZoneLockdown added in v0.8.0

type ZoneLockdown struct {
	ID             string               `json:"id"`
	Description    string               `json:"description"`
	URLs           []string             `json:"urls"`
	Configurations []ZoneLockdownConfig `json:"configurations"`
	Paused         bool                 `json:"paused"`
	Priority       int                  `json:"priority,omitempty"`
	CreatedOn      *time.Time           `json:"created_on,omitempty"`
	ModifiedOn     *time.Time           `json:"modified_on,omitempty"`
}

ZoneLockdown represents a Zone Lockdown rule. A rule only permits access to the provided URL pattern(s) from the given IP address(es) or subnet(s).

type ZoneLockdownConfig added in v0.8.0

type ZoneLockdownConfig struct {
	Target string `json:"target"`
	Value  string `json:"value"`
}

ZoneLockdownConfig represents a Zone Lockdown config, which comprises a Target ("ip" or "ip_range") and a Value (an IP address or IP+mask, respectively.)

type ZoneLockdownListResponse added in v0.8.0

type ZoneLockdownListResponse struct {
	Result []ZoneLockdown `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

ZoneLockdownListResponse represents a response from the List Zone Lockdown endpoint.

type ZoneLockdownResponse added in v0.8.0

type ZoneLockdownResponse struct {
	Result ZoneLockdown `json:"result"`
	Response
	ResultInfo `json:"result_info"`
}

ZoneLockdownResponse represents a response from the Zone Lockdown endpoint.

type ZoneMeta

type ZoneMeta struct {
	// custom_certificate_quota is broken - sometimes it's a string, sometimes a number!
	// CustCertQuota     int    `json:"custom_certificate_quota"`
	PageRuleQuota     int  `json:"page_rule_quota"`
	WildcardProxiable bool `json:"wildcard_proxiable"`
	PhishingDetected  bool `json:"phishing_detected"`
}

ZoneMeta describes metadata about a zone.

type ZoneOptions

type ZoneOptions struct {
	Paused   *bool     `json:"paused,omitempty"`
	VanityNS []string  `json:"vanity_name_servers,omitempty"`
	Plan     *ZonePlan `json:"plan,omitempty"`
	Type     string    `json:"type,omitempty"`
}

ZoneOptions is a subset of Zone, for editable options.

type ZonePlan

type ZonePlan struct {
	ZonePlanCommon
	IsSubscribed      bool   `json:"is_subscribed"`
	CanSubscribe      bool   `json:"can_subscribe"`
	LegacyID          string `json:"legacy_id"`
	LegacyDiscount    bool   `json:"legacy_discount"`
	ExternallyManaged bool   `json:"externally_managed"`
}

ZonePlan contains the plan information for a zone.

type ZonePlanCommon added in v0.29.3

type ZonePlanCommon struct {
	ID        string `json:"id"`
	Name      string `json:"name,omitempty"`
	Price     int    `json:"price,omitempty"`
	Currency  string `json:"currency,omitempty"`
	Frequency string `json:"frequency,omitempty"`
}

ZonePlanCommon contains fields used by various Plan endpoints

type ZoneRailgun

type ZoneRailgun struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Enabled   bool   `json:"enabled"`
	Connected bool   `json:"connected"`
}

ZoneRailgun represents the status of a Railgun on a zone.

type ZoneRatePlan added in v0.7.4

type ZoneRatePlan struct {
	ZonePlanCommon
	Components []zoneRatePlanComponents `json:"components,omitempty"`
}

ZoneRatePlan contains the plan information for a zone.

type ZoneRatePlanResponse added in v0.7.4

type ZoneRatePlanResponse struct {
	Response
	Result ZoneRatePlan `json:"result"`
}

ZoneRatePlanResponse represents the response from the Plan Details endpoint.

type ZoneResponse

type ZoneResponse struct {
	Response
	Result Zone `json:"result"`
}

ZoneResponse represents the response from the Zone endpoint containing a single zone.

type ZoneSSLSetting added in v0.7.4

type ZoneSSLSetting struct {
	ID                string `json:"id"`
	Editable          bool   `json:"editable"`
	ModifiedOn        string `json:"modified_on"`
	Value             string `json:"value"`
	CertificateStatus string `json:"certificate_status"`
}

ZoneSSLSetting contains ssl setting for a zone.

type ZoneSSLSettingResponse added in v0.7.4

type ZoneSSLSettingResponse struct {
	Response
	Result ZoneSSLSetting `json:"result"`
}

ZoneSSLSettingResponse represents the response from the Zone SSL Setting endpoint.

type ZoneSetting

type ZoneSetting struct {
	ID            string      `json:"id"`
	Editable      bool        `json:"editable"`
	ModifiedOn    string      `json:"modified_on,omitempty"`
	Value         interface{} `json:"value"`
	TimeRemaining int         `json:"time_remaining"`
}

ZoneSetting contains settings for a zone.

type ZoneSettingResponse

type ZoneSettingResponse struct {
	Response
	Result []ZoneSetting `json:"result"`
}

ZoneSettingResponse represents the response from the Zone Setting endpoint.

type ZoneSettingSingleResponse added in v0.29.3

type ZoneSettingSingleResponse struct {
	Response
	Result ZoneSetting `json:"result"`
}

ZoneSettingSingleResponse represents the response from the Zone Setting endpoint for the specified setting.

type ZonesResponse

type ZonesResponse struct {
	Response
	Result     []Zone `json:"result"`
	ResultInfo `json:"result_info"`
}

ZonesResponse represents the response from the Zone endpoint containing an array of zones.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL