client

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_RETRIES = 5
View Source
const MaxItemsPerPage = 200

Variables

This section is empty.

Functions

func Configure

func Configure(logger hclog.Logger, config interface{}) (schema.ClientMeta, diag.Diagnostics)

func DOTestHelper

func DOTestHelper(t *testing.T, table *schema.Table)

func DeleteFilter

func DeleteFilter(meta schema.ClientMeta, _ *schema.Resource) []interface{}

func ErrorClassifier

func ErrorClassifier(_ schema.ClientMeta, resourceName string, err error) diag.Diagnostics

func IPAddressResolver

func IPAddressResolver(path string) schema.ColumnResolver

func IsErrorMessage

func IsErrorMessage(err error, message string) bool

func IsLimitReached

func IsLimitReached(err error) bool

IsLimitReached - checks if API error is request limit error

func RedactError

func RedactError(e diag.Diagnostic) diag.Diagnostic

RedactError redacts a given diagnostic and returns a RedactedDiagnostic containing both original and redacted versions

func ResolveResourceIdFromUrn

func ResolveResourceIdFromUrn(_ context.Context, meta schema.ClientMeta, r *schema.Resource, c schema.Column) error

func ResolveResourceTypeFromUrn

func ResolveResourceTypeFromUrn(_ context.Context, meta schema.ClientMeta, r *schema.Resource, c schema.Column) error

func SpacesRegionMultiplex

func SpacesRegionMultiplex(client schema.ClientMeta) []schema.ClientMeta

func ThrottleWrapper

func ThrottleWrapper(ctx context.Context, client *Client, doFunc retry.RetryableFunc) error

ThrottleWrapper does API request until it is succeeded

Types

type AwsLogger

type AwsLogger struct {
	// contains filtered or unexported fields
}

func (AwsLogger) Logf

func (a AwsLogger) Logf(classification logging.Classification, format string, v ...interface{})

type Client

type Client struct {
	DoClient         *godo.Client
	Regions          []string
	SpacesRegion     string
	CredentialStatus DoCredentialStruct
	S3               *s3.Client
	// contains filtered or unexported fields
}

func (*Client) Logger

func (c *Client) Logger() hclog.Logger

func (*Client) WithSpacesRegion

func (c *Client) WithSpacesRegion(region string) *Client

type Config

type Config struct {
	Token string `yaml:"token,omitempty"`
	// SpacesRegions is a list of DO regions to fetch spaces from, if not given we execute on all regions
	SpacesRegions []string `yaml:"spaces_regions,omitempty"`
	// SpacesAccessKey is the secret access token generated in DO control panel
	SpacesAccessKey string `yaml:"spaces_access_key,omitempty"`
	// SpacesAccessKeyId is the unique identifier of the access key generated in the DO control panel
	SpacesAccessKeyId string `yaml:"spaces_access_key_id,omitempty"`
	// SpacesDebugLogging allows enabling AWS S3 request logging on spaces requests
	SpacesDebugLogging bool `yaml:"spaces_debug_logging,omitempty"`
}

func (Config) Example

func (Config) Example() string

type DoCredentialStruct

type DoCredentialStruct struct {
	Api    bool
	Spaces bool
}

type SpacesCredentialsProvider

type SpacesCredentialsProvider struct {
	SpacesAccessKey   string
	SpacesAccessKeyId string
}

func (SpacesCredentialsProvider) Retrieve

type SpacesEndpointResolver

type SpacesEndpointResolver struct{}

func (SpacesEndpointResolver) ResolveEndpoint

func (SpacesEndpointResolver) ResolveEndpoint(_, region string) (aws.Endpoint, error)

Jump to

Keyboard shortcuts

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