clients

package
v0.0.0-...-be1e11a Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(c Config, hc *http.Client) (*cloudflare.API, error)

NewClient creates a new Cloudflare Client with provided Credentials.

func ToBool

func ToBool(in interface{}) *bool

ToBool converts an interface from the Cloudflare API into a bool pointer, if it contains an existing bool or bool pointer.

func ToNumber

func ToNumber(in interface{}) *int64

ToNumber converts an interface from the Cloudflare API into an int64 pointer, if it contains an existing int, int64 or float64 value.

func ToOptionalString

func ToOptionalString(in interface{}) *string

ToOptionalString converts an interface from the Cloudflare API into a string pointer, if it contains an existing string or string pointer. If the existing string is empty (""), it returns nil.

func ToString

func ToString(in interface{}) *string

ToString converts an interface from the Cloudflare API into a string pointer, if it contains an existing string.

func ToStringSlice

func ToStringSlice(in interface{}) []string

ToStringSlice converts an interface from the Cloudflare API into a string slice.

Types

type AuthByAPIKey

type AuthByAPIKey struct {
	Key   *string `json:"apiKey,omitempty"`
	Email *string `json:"email,omitempty"`
}

AuthByAPIKey represents the details required to authenticate with the cloudflare API using a users' global API Key and Email address.

type AuthByAPIToken

type AuthByAPIToken struct {
	Token *string `json:"token,omitempty"`
}

AuthByAPIToken represents the details required to authenticate with the cloudflare API using an API token.

type Config

type Config struct {
	*AuthByAPIKey   `json:",inline"`
	*AuthByAPIToken `json:",inline"`
}

Config represents the API configuration required to create a new client.

func GetConfig

func GetConfig(ctx context.Context, c client.Client, mg resource.Managed) (*Config, error)

GetConfig returns a valid Cloudflare API configuration

func UseProviderConfig

func UseProviderConfig(ctx context.Context, c client.Client, mg resource.Managed) (*Config, error)

UseProviderConfig produces a config that can be used to authenticate with Cloudflare.

func UseProviderSecret

func UseProviderSecret(ctx context.Context, data []byte) (*Config, error)

UseProviderSecret extracts a JSON blob containing configuration keys.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL