cloudflare

package module
Version: v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: BSD-3-Clause Imports: 31 Imported by: 725

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.

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 using a global API key
	api, err := cloudflare.New(os.Getenv("CLOUDFLARE_API_KEY"), os.Getenv("CLOUDFLARE_API_EMAIL"))
	// alternatively, you can use a scoped API token
	// api, err := cloudflare.NewWithAPIToken(os.Getenv("CLOUDFLARE_API_TOKEN"))
	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)
}

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

Experimental improvements

This library is starting to ship with experimental improvements that are not yet ready for production but will be introduced before the next major version. See experimental README for full details.

Contributing

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

License

BSD licensed. See the LICENSE file for details.

Documentation

Overview

Package cloudflare implements the Cloudflare v4 API.

File contains helper methods for accepting variants (pointers, values, slices, etc) of a particular type and returning them in another. A common use is pointer to values and back.

_Most_ follow the convention of (where <type> is a Golang type such as Bool):

<type>Ptr: Accepts a value and returns a pointer. <type>: Accepts a pointer and returns a value. <type>PtrSlice: Accepts a slice of values and returns a slice of pointers. <type>Slice: Accepts a slice of pointers and returns a slice of values. <type>PtrMap: Accepts a string map of values into a string map of pointers. <type>Map: Accepts a string map of pointers into a string map of values.

Not all Golang types are covered here, only those that are commonly used.

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.ListDNSRecords(context.Background(), cloudflare.ZoneIdentifier(zoneID), cloudflare.ListDNSRecordsParams{})
	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 (
	// ListTypeIP specifies a list containing IP addresses.
	ListTypeIP = "ip"
	// ListTypeRedirect specifies a list containing redirects.
	ListTypeRedirect = "redirect"
	// ListTypeHostname specifies a list containing hostnames.
	ListTypeHostname = "hostname"
	// ListTypeHostname specifies a list containing autonomous system numbers (ASNs).
	ListTypeASN = "asn"
)
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 (
	AccountRouteLevel RouteLevel = accounts
	ZoneRouteLevel    RouteLevel = zones
	UserRouteLevel    RouteLevel = user

	AccountType ResourceType = account
	ZoneType    ResourceType = zone
	UserType    ResourceType = user
)
View Source
const (
	RulesetKindCustom  RulesetKind = "custom"
	RulesetKindManaged RulesetKind = "managed"
	RulesetKindRoot    RulesetKind = "root"
	RulesetKindZone    RulesetKind = "zone"

	RulesetPhaseDDoSL4                       RulesetPhase = "ddos_l4"
	RulesetPhaseDDoSL7                       RulesetPhase = "ddos_l7"
	RulesetPhaseHTTPConfigSettings           RulesetPhase = "http_config_settings"
	RulesetPhaseHTTPCustomErrors             RulesetPhase = "http_custom_errors"
	RulesetPhaseHTTPLogCustomFields          RulesetPhase = "http_log_custom_fields"
	RulesetPhaseHTTPRatelimit                RulesetPhase = "http_ratelimit"
	RulesetPhaseHTTPRequestCacheSettings     RulesetPhase = "http_request_cache_settings"
	RulesetPhaseHTTPRequestDynamicRedirect   RulesetPhase = "http_request_dynamic_redirect" //nolint:gosec
	RulesetPhaseHTTPRequestFirewallCustom    RulesetPhase = "http_request_firewall_custom"
	RulesetPhaseHTTPRequestFirewallManaged   RulesetPhase = "http_request_firewall_managed"
	RulesetPhaseHTTPRequestLateTransform     RulesetPhase = "http_request_late_transform"
	RulesetPhaseHTTPRequestOrigin            RulesetPhase = "http_request_origin"
	RulesetPhaseHTTPRequestRedirect          RulesetPhase = "http_request_redirect"
	RulesetPhaseHTTPRequestSanitize          RulesetPhase = "http_request_sanitize"
	RulesetPhaseHTTPRequestSBFM              RulesetPhase = "http_request_sbfm"
	RulesetPhaseHTTPRequestTransform         RulesetPhase = "http_request_transform"
	RulesetPhaseHTTPResponseCompression      RulesetPhase = "http_response_compression"
	RulesetPhaseHTTPResponseFirewallManaged  RulesetPhase = "http_response_firewall_managed"
	RulesetPhaseHTTPResponseHeadersTransform RulesetPhase = "http_response_headers_transform"
	RulesetPhaseMagicTransit                 RulesetPhase = "magic_transit"

	RulesetRuleActionBlock                RulesetRuleAction = "block"
	RulesetRuleActionChallenge            RulesetRuleAction = "challenge"
	RulesetRuleActionCompressResponse     RulesetRuleAction = "compress_response"
	RulesetRuleActionDDoSDynamic          RulesetRuleAction = "ddos_dynamic"
	RulesetRuleActionDDoSMitigation       RulesetRuleAction = "ddos_mitigation"
	RulesetRuleActionExecute              RulesetRuleAction = "execute"
	RulesetRuleActionForceConnectionClose RulesetRuleAction = "force_connection_close"
	RulesetRuleActionJSChallenge          RulesetRuleAction = "js_challenge"
	RulesetRuleActionLog                  RulesetRuleAction = "log"
	RulesetRuleActionLogCustomField       RulesetRuleAction = "log_custom_field"
	RulesetRuleActionManagedChallenge     RulesetRuleAction = "managed_challenge"
	RulesetRuleActionRedirect             RulesetRuleAction = "redirect"
	RulesetRuleActionRewrite              RulesetRuleAction = "rewrite"
	RulesetRuleActionRoute                RulesetRuleAction = "route"
	RulesetRuleActionScore                RulesetRuleAction = "score"
	RulesetRuleActionServeError           RulesetRuleAction = "serve_error"
	RulesetRuleActionSetCacheSettings     RulesetRuleAction = "set_cache_settings"
	RulesetRuleActionSetConfig            RulesetRuleAction = "set_config"
	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"
	RulesetRuleActionParametersHTTPHeaderOperationAdd    RulesetRuleActionParametersHTTPHeaderOperation = "add"
)
View Source
const (
	// IPListTypeIP specifies a list containing IP addresses.
	IPListTypeIP = "ip"
)

Variables

View Source
var (
	ErrAPIKeysAndTokensAreMutuallyExclusive   = errors.New(errAPIKeysAndTokensAreMutuallyExclusive)
	ErrMissingCredentials                     = errors.New(errMissingCredentials)
	ErrMissingAccountID                       = errors.New(errMissingAccountID)
	ErrMissingZoneID                          = errors.New(errMissingZoneID)
	ErrAccountIDOrZoneIDAreRequired           = errors.New(errMissingAccountOrZoneID)
	ErrAccountIDAndZoneIDAreMutuallyExclusive = errors.New(errAccountIDAndZoneIDAreMutuallyExclusive)
	ErrMissingResourceIdentifier              = errors.New(errMissingResourceIdentifier)

	ErrRequiredAccountLevelResourceContainer = errors.New(errRequiredAccountLevelResourceContainer)
	ErrRequiredZoneLevelResourceContainer    = errors.New(errRequiredZoneLevelResourceContainer)
)
View Source
var (
	ErrInvalidImagesAPIVersion = errors.New("invalid images API version")
	ErrMissingImageID          = errors.New("required image ID missing")
)
View Source
var (
	ErrMissingPoolID         = errors.New("missing required pool ID")
	ErrMissingMonitorID      = errors.New("missing required monitor ID")
	ErrMissingLoadBalancerID = errors.New("missing required load balancer ID")
)
View Source
var (
	// ErrMissingIP is for when ipv4 or ipv6 indicator was given but ip is missing.
	ErrMissingIP = errors.New("ip is required when using 'ipv4' or 'ipv6' indicator type and is missing")
	// ErrMissingURL is for when url or domain indicator was given but url is missing.
	ErrMissingURL = errors.New("url is required when using 'domain' or 'url' indicator type and is missing")
)
View Source
var (
	ErrMissingObservatoryUrl    = errors.New("missing required page url")
	ErrMissingObservatoryTestID = errors.New("missing required test id")
)
View Source
var (
	ErrMissingProjectName  = errors.New("required missing project name")
	ErrMissingDeploymentID = errors.New("required missing deployment ID")
)
View Source
var (
	ErrMissingQueueName         = errors.New("required queue name is missing")
	ErrMissingQueueConsumerName = errors.New("required queue consumer name is missing")
)
View Source
var (
	// ErrMissingUploadURL is for when a URL is required but missing.
	ErrMissingUploadURL = errors.New("required url missing")
	// ErrMissingMaxDuration is for when MaxDuration is required but missing.
	ErrMissingMaxDuration = errors.New("required max duration missing")
	// ErrMissingVideoID is for when VideoID is required but missing.
	ErrMissingVideoID = errors.New("required video id missing")
	// ErrMissingFilePath is for when FilePath is required but missing.
	ErrMissingFilePath = errors.New("required file path missing")
	// ErrMissingTusResumable is for when TusResumable is required but missing.
	ErrMissingTusResumable = errors.New("required tus resumable missing")
	// ErrInvalidTusResumable is for when TusResumable is invalid.
	ErrInvalidTusResumable = errors.New("invalid tus resumable")
	// ErrMarshallingTUSMetadata is for when TUS metadata cannot be marshalled.
	ErrMarshallingTUSMetadata = errors.New("error marshalling TUS metadata")
	// ErrMissingUploadLength is for when UploadLength is required but missing.
	ErrMissingUploadLength = errors.New("required upload length missing")
	// ErrInvalidStatusCode is for when the status code is invalid.
	ErrInvalidStatusCode = errors.New("invalid status code")
)
View Source
var (
	ErrSTSFailure               = errors.New("failed to fetch security token")
	ErrSTSHTTPFailure           = errors.New("failed making securtiy token issuer call")
	ErrSTSHTTPResponseError     = errors.New("security token request returned a failure")
	ErrSTSMissingServiceSecret  = errors.New("service secret missing but is required")
	ErrSTSMissingServiceTag     = errors.New("service tag missing but is required")
	ErrSTSMissingIssuerHostname = errors.New("issuer hostname missing but is required")
	ErrSTSMissingServicePath    = errors.New("issuer path missing but is required")
)
View Source
var (
	ErrMissingNetwork      = errors.New("missing required network parameter")
	ErrInvalidNetworkValue = errors.New("invalid IP parameter. Cannot use CIDR ranges for this endpoint.")
)
View Source
var (
	ErrMissingWaitingRoomID     = errors.New("missing required waiting room ID")
	ErrMissingWaitingRoomRuleID = errors.New("missing required waiting room rule ID")
)
View Source
var (
	// ErrMissingIdentifier is for when identifier is required but missing.
	ErrMissingIdentifier = errors.New("identifier required but missing")
	// ErrMissingName is for when name is required but missing.
	ErrMissingName = errors.New("name required but missing")
	// ErrMissingTarget is for when target is required but missing.
	ErrMissingTarget = errors.New("target required but missing")
)
View Source
var (
	ErrMissingWebAnalyticsSiteTag     = errors.New("missing required web analytics site ID")
	ErrMissingWebAnalyticsRulesetID   = errors.New("missing required web analytics ruleset ID")
	ErrMissingWebAnalyticsRuleID      = errors.New("missing required web analytics rule ID")
	ErrMissingWebAnalyticsSiteHost    = errors.New("missing required web analytics host or zone_tag")
	ErrConflictingWebAnalyticSiteHost = errors.New("conflicting web analytics host and zone_tag, only one must be specified")
)
View Source
var (
	ErrMissingHostname    = errors.New("required hostname missing")
	ErrMissingService     = errors.New("required service missing")
	ErrMissingEnvironment = errors.New("required environment missing")
)
View Source
var (
	ErrMissingScriptName = errors.New("required script name missing")
	ErrMissingTailID     = errors.New("required tail id missing")
)
View Source
var ErrMissingASN = errors.New("required asn missing")

ErrMissingASN is for when ASN is required but not set.

View Source
var (
	ErrMissingApplicationID = errors.New("missing required application ID")
)
View Source
var ErrMissingBINDContents = errors.New("required BIND config contents missing")

ErrMissingBINDContents is for when the BIND file contents is required but not set.

View Source
var (
	ErrMissingBucketName = errors.New("require bucket name missing")
)
View Source
var (
	ErrMissingCertificateID = errors.New("missing required certificate ID")
)
View Source
var ErrMissingClusterID = errors.New("missing required cluster ID")
View Source
var ErrMissingDNSRecordID = errors.New("required DNS record ID missing")

ErrMissingDNSRecordID is for when DNS record ID is needed but not given.

View Source
var ErrMissingDomain = errors.New("required domain missing")

ErrMissingDomain is for when domain is needed but not given.

View Source
var (
	ErrMissingHostnameTLSSettingName = errors.New("tls setting name required but missing")
)
View Source
var ErrMissingListID = errors.New("required missing list ID")
View Source
var ErrMissingMemberRolesOrPolicies = errors.New(errMissingMemberRolesOrPolicies)
View Source
var ErrMissingPermissionGroupID = errors.New(errMissingPermissionGroupID)
View Source
var (
	ErrMissingProfileID = errors.New("missing required profile ID")
)
View Source
var ErrMissingRuleID = errors.New("required rule id missing")
View Source
var (
	ErrMissingRulesetPhase = errors.New("missing required phase")
)
View Source
var (
	ErrMissingServiceTokenUUID = errors.New("missing required service token UUID")
)
View Source
var (
	// ErrMissingSettingName is for when setting name is required but missing.
	ErrMissingSettingName = errors.New("zone setting name required but missing")
)
View Source
var ErrMissingSiteKey = errors.New("required site key missing")
View Source
var ErrMissingTunnelID = errors.New("required missing tunnel ID")

ErrMissingTunnelID is for when a required tunnel ID is missing from the parameters.

View Source
var ErrMissingUID = errors.New("required UID missing")
View Source
var ErrMissingVnetName = errors.New("required missing virtual network name")
View Source
var ErrMissingWorkerRouteID = errors.New("missing required route ID")
View Source
var ErrNotEnoughFilterIDsProvided = errors.New("at least one filter ID must be provided.")
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.

View Source
var (
	Version string = "v4"
)

Functions

func AnyPtr added in v0.35.0

func AnyPtr(v interface{}) interface{}

AnyPtr is a helper routine that allocates a new interface value to store v and returns a pointer to it.

Usage: var _ *Type = AnyPtr(Type(value) | value).(*Type)

var _ *bool = AnyPtr(true).(*bool)
var _ *byte = AnyPtr(byte(1)).(*byte)
var _ *complex64 = AnyPtr(complex64(1.1)).(*complex64)
var _ *complex128 = AnyPtr(complex128(1.1)).(*complex128)
var _ *float32 = AnyPtr(float32(1.1)).(*float32)
var _ *float64 = AnyPtr(float64(1.1)).(*float64)
var _ *int = AnyPtr(int(1)).(*int)
var _ *int8 = AnyPtr(int8(8)).(*int8)
var _ *int16 = AnyPtr(int16(16)).(*int16)
var _ *int32 = AnyPtr(int32(32)).(*int32)
var _ *int64 = AnyPtr(int64(64)).(*int64)
var _ *rune = AnyPtr(rune(1)).(*rune)
var _ *string = AnyPtr("ptr").(*string)
var _ *uint = AnyPtr(uint(1)).(*uint)
var _ *uint8 = AnyPtr(uint8(8)).(*uint8)
var _ *uint16 = AnyPtr(uint16(16)).(*uint16)
var _ *uint32 = AnyPtr(uint32(32)).(*uint32)
var _ *uint64 = AnyPtr(uint64(64)).(*uint64)

func Bool added in v0.36.0

func Bool(v *bool) bool

Bool is a helper routine that accepts a bool pointer and returns a value to it.

func BoolMap added in v0.36.0

func BoolMap(src map[string]*bool) map[string]bool

BoolMap converts a string map of bool pointers into a string map of bool values.

func BoolPtr added in v0.35.0

func BoolPtr(v bool) *bool

BoolPtr is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func BoolPtrMap added in v0.35.0

func BoolPtrMap(src map[string]bool) map[string]*bool

BoolPtrMap converts a string map of bool values into a string map of bool pointers.

func BoolPtrSlice added in v0.35.0

func BoolPtrSlice(src []bool) []*bool

BoolPtrSlice converts a slice of bool values into a slice of bool pointers.

func BoolSlice added in v0.36.0

func BoolSlice(src []*bool) []bool

BoolSlice converts a slice of bool pointers into a slice of bool values.

func Byte added in v0.36.0

func Byte(v *byte) byte

Byte is a helper routine that accepts a byte pointer and returns a value to it.

func BytePtr added in v0.35.0

func BytePtr(v byte) *byte

BytePtr is a helper routine that allocates a new byte value to store v and returns a pointer to it.

func Complex128 added in v0.36.0

func Complex128(v *complex128) complex128

Complex128 is a helper routine that accepts a complex128 pointer and returns a value to it.

func Complex128Ptr added in v0.35.0

func Complex128Ptr(v complex128) *complex128

Complex128Ptr is a helper routine that allocates a new complex128 value to store v and returns a pointer to it.

func Complex64 added in v0.36.0

func Complex64(v *complex64) complex64

Complex64 is a helper routine that accepts a complex64 pointer and returns a value to it.

func Complex64Ptr added in v0.35.0

func Complex64Ptr(v complex64) *complex64

Complex64Ptr is a helper routine that allocates a new complex64 value to store v and returns a pointer to it.

func DurationPtr added in v0.35.0

func DurationPtr(v time.Duration) *time.Duration

DurationPtr is a helper routine that allocates a new time.Duration value to store v and returns a pointer to it.

func Float32 added in v0.36.0

func Float32(v *float32) float32

Float32 is a helper routine that accepts a float32 pointer and returns a value to it.

func Float32Map added in v0.36.0

func Float32Map(src map[string]*float32) map[string]float32

Float32Map converts a string map of float32 pointers into a string map of float32 values.

func Float32Ptr added in v0.35.0

func Float32Ptr(v float32) *float32

Float32Ptr is a helper routine that allocates a new float32 value to store v and returns a pointer to it.

func Float32PtrMap added in v0.35.0

func Float32PtrMap(src map[string]float32) map[string]*float32

Float32PtrMap converts a string map of float32 values into a string map of float32 pointers.

func Float32PtrSlice added in v0.35.0

func Float32PtrSlice(src []float32) []*float32

Float32PtrSlice converts a slice of float32 values into a slice of float32 pointers.

func Float32Slice added in v0.36.0

func Float32Slice(src []*float32) []float32

Float32Slice converts a slice of float32 pointers into a slice of float32 values.

func Float64 added in v0.36.0

func Float64(v *float64) float64

Float64 is a helper routine that accepts a float64 pointer and returns a value to it.

func Float64Map added in v0.36.0

func Float64Map(src map[string]*float64) map[string]float64

Float64Map converts a string map of float64 pointers into a string map of float64 values.

func Float64Ptr added in v0.35.0

func Float64Ptr(v float64) *float64

Float64Ptr is a helper routine that allocates a new float64 value to store v and returns a pointer to it.

func Float64PtrMap added in v0.35.0

func Float64PtrMap(src map[string]float64) map[string]*float64

Float64PtrMap converts a string map of float64 values into a string map of float64 pointers.

func Float64PtrSlice added in v0.35.0

func Float64PtrSlice(src []float64) []*float64

Float64PtrSlice converts a slice of float64 values into a slice of float64 pointers.

func Float64Slice added in v0.36.0

func Float64Slice(src []*float64) []float64

Float64Slice converts a slice of float64 pointers into a slice of float64 values.

func GetOriginCARootCertificate added in v0.58.0

func GetOriginCARootCertificate(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 Int added in v0.36.0

func Int(v *int) int

Int is a helper routine that accepts a int pointer and returns a value to it.

func Int16 added in v0.36.0

func Int16(v *int16) int16

Int16 is a helper routine that accepts a int16 pointer and returns a value to it.

func Int16Map added in v0.36.0

func Int16Map(src map[string]*int16) map[string]int16

Int16Map converts a string map of int16 pointers into a string map of int16 values.

func Int16Ptr added in v0.35.0

func Int16Ptr(v int16) *int16

Int16Ptr is a helper routine that allocates a new int16 value to store v and returns a pointer to it.

func Int16PtrMap added in v0.35.0

func Int16PtrMap(src map[string]int16) map[string]*int16

Int16PtrMap converts a string map of int16 values into a string map of int16 pointers.

func Int16PtrSlice added in v0.35.0

func Int16PtrSlice(src []int16) []*int16

Int16PtrSlice converts a slice of int16 values into a slice of int16 pointers.

func Int16Slice added in v0.36.0

func Int16Slice(src []*int16) []int16

Int16Slice converts a slice of int16 pointers into a slice of int16 values.

func Int32 added in v0.36.0

func Int32(v *int32) int32

Int32 is a helper routine that accepts a int32 pointer and returns a value to it.

func Int32Map added in v0.36.0

func Int32Map(src map[string]*int32) map[string]int32

Int32Map converts a string map of int32 pointers into a string map of int32 values.

func Int32Ptr added in v0.35.0

func Int32Ptr(v int32) *int32

Int32Ptr is a helper routine that allocates a new int32 value to store v and returns a pointer to it.

func Int32PtrMap added in v0.35.0

func Int32PtrMap(src map[string]int32) map[string]*int32

Int32PtrMap converts a string map of int32 values into a string map of int32 pointers.

func Int32PtrSlice added in v0.35.0

func Int32PtrSlice(src []int32) []*int32

Int32PtrSlice converts a slice of int32 values into a slice of int32 pointers.

func Int32Slice added in v0.36.0

func Int32Slice(src []*int32) []int32

Int32Slice converts a slice of int32 pointers into a slice of int32 values.

func Int64 added in v0.36.0

func Int64(v *int64) int64

Int64 is a helper routine that accepts a int64 pointer and returns a value to it.

func Int64Map added in v0.36.0

func Int64Map(src map[string]*int64) map[string]int64

Int64Map converts a string map of int64 pointers into a string map of int64 values.

func Int64Ptr added in v0.35.0

func Int64Ptr(v int64) *int64

Int64Ptr is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func Int64PtrMap added in v0.35.0

func Int64PtrMap(src map[string]int64) map[string]*int64

Int64PtrMap converts a string map of int64 values into a string map of int64 pointers.

func Int64PtrSlice added in v0.35.0

func Int64PtrSlice(src []int64) []*int64

Int64PtrSlice converts a slice of int64 values into a slice of int64 pointers.

func Int64Slice added in v0.36.0

func Int64Slice(src []*int64) []int64

Int64Slice converts a slice of int64 pointers into a slice of int64 values.

func Int8 added in v0.36.0

func Int8(v *int8) int8

Int8 is a helper routine that accepts a int8 pointer and returns a value to it.

func Int8Map added in v0.36.0

func Int8Map(src map[string]*int8) map[string]int8

Int8Map converts a string map of int8 pointers into a string map of int8 values.

func Int8Ptr added in v0.35.0

func Int8Ptr(v int8) *int8

Int8Ptr is a helper routine that allocates a new int8 value to store v and returns a pointer to it.

func Int8PtrMap added in v0.35.0

func Int8PtrMap(src map[string]int8) map[string]*int8

Int8PtrMap converts a string map of int8 values into a string map of int8 pointers.

func Int8PtrSlice added in v0.35.0

func Int8PtrSlice(src []int8) []*int8

Int8PtrSlice converts a slice of int8 values into a slice of int8 pointers.

func Int8Slice added in v0.36.0

func Int8Slice(src []*int8) []int8

Int8Slice converts a slice of int8 pointers into a slice of int8 values.

func IntMap added in v0.36.0

func IntMap(src map[string]*int) map[string]int

IntMap converts a string map of int pointers into a string map of int values.

func IntPtr added in v0.35.0

func IntPtr(v int) *int

IntPtr is a helper routine that allocates a new int value to store v and returns a pointer to it.

func IntPtrMap added in v0.35.0

func IntPtrMap(src map[string]int) map[string]*int

IntPtrMap converts a string map of int values into a string map of int pointers.

func IntPtrSlice added in v0.35.0

func IntPtrSlice(src []int) []*int

IntPtrSlice converts a slice of int values into a slice of int pointers.

func IntSlice added in v0.36.0

func IntSlice(src []*int) []int

IntSlice converts a slice of int pointers into a slice of int values.

func RulesetActionParameterProductValues added in v0.19.0

func RulesetActionParameterProductValues() []string

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

func RulesetKindValues added in v0.19.0

func RulesetKindValues() []string

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

func RulesetPhaseValues added in v0.19.0

func RulesetPhaseValues() []string

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

func RulesetRuleActionParametersHTTPHeaderOperationValues added in v0.19.0

func RulesetRuleActionParametersHTTPHeaderOperationValues() []string

func RulesetRuleActionValues added in v0.19.0

func RulesetRuleActionValues() []string

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

func Rune added in v0.36.0

func Rune(v *rune) rune

Rune is a helper routine that accepts a rune pointer and returns a value to it.

func RunePtr added in v0.35.0

func RunePtr(v rune) *rune

RunePtr is a helper routine that allocates a new rune value to store v and returns a pointer to it.

func String added in v0.36.0

func String(v *string) string

String is a helper routine that accepts a string pointer and returns a value to it.

func StringMap added in v0.36.0

func StringMap(src map[string]*string) map[string]string

StringMap converts a string map of string pointers into a string map of string values.

func StringPtr added in v0.35.0

func StringPtr(v string) *string

StringPtr is a helper routine that allocates a new string value to store v and returns a pointer to it.

func StringPtrMap added in v0.35.0

func StringPtrMap(src map[string]string) map[