stackpath

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPStatusFromCode

func HTTPStatusFromCode(code int32) int

HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto

This method is adapted from https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go to prevent having to import the entire grpc-gateway package.

func NewStackPathError

func NewStackPathError(err error) error

NewStackPathError factories common StackPath error scenarios into their own error types, or returns the original error.

func Provider

func Provider() *schema.Provider

Provider returns the configured provider for managing StackPath resources.

Types

type APIError

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

APIError models an error received from the StackPath API.

func (*APIError) Error

func (e *APIError) Error() string

Error satisfies the error interface for APIError.

type Config

type Config struct {
	// The Stack in which all resources should be created
	StackID string

	// The Client ID that should be used to retrieve an access token. This
	// option must not be used with the access token option.
	ClientID string

	// The Client Secret that should be used to retrieve an access
	// token. This options must not be used with the access token option.
	ClientSecret string

	// The AccessToken that should be used in the request. This must not
	// be used in combination with the client ID and client secret options.
	AccessToken string

	// The base URL to use for API requests. This value must not end
	// in a trailing slash. This value will default to the official
	// StackPath API.
	BaseURL string
	// contains filtered or unexported fields
}

Config is used to configure the StackPath provider.

func (*Config) LoadAndValidate

func (c *Config) LoadAndValidate(ctx context.Context, terraformVersion string) error

LoadAndValidate will load the configuration and validate the configuration options. An error will be returned when the configuration is invalid.

type InvalidClientIDError

type InvalidClientIDError struct{}

InvalidClientSecretError models when a StackPath API OAuth 2 client ID is invalid, either due to an invalid format or because the client ID does not exist at StackPath.

func NewInvalidClientIDError

func NewInvalidClientIDError() *InvalidClientIDError

NewInvalidClientIDError wraps an existing error as an invalid client ID error.

func (*InvalidClientIDError) Error

func (e *InvalidClientIDError) Error() string

Error returns a human-readable invalid client ID error message.

type InvalidClientSecretError

type InvalidClientSecretError struct{}

InvalidClientSecretError models when a StackPath API OAuth 2 client ID is correct, but the client secret is incorrect.

func NewInvalidClientSecretError

func NewInvalidClientSecretError() *InvalidClientSecretError

NewInvalidClientSecretError wraps an existing error as an invalid client secret error.

func (*InvalidClientSecretError) Error

func (e *InvalidClientSecretError) Error() string

Error returns a human-readable invalid client secret error message.

type UserAgentTransport

type UserAgentTransport struct {
	http.RoundTripper
	// contains filtered or unexported fields
}

UserAgentTransport is an http RoundTripper that sets a descriptive User-Agent header for all StackPath API requests.

func NewUserAgentTransport

func NewUserAgentTransport(parent http.RoundTripper, terraformVersion string) *UserAgentTransport

NewUserAgentTransport builds a new UserAgentTransport around the underlying RoundTripper.

func (*UserAgentTransport) RoundTrip

func (t *UserAgentTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the http.RoundTripper interface, setting a User-Agent header on the HTTP request.

Jump to

Keyboard shortcuts

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