api

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: MPL-2.0 Imports: 26 Imported by: 6

Documentation

Overview

Code generated by "make api"; DO NOT EDIT.

Code generated by "make api"; DO NOT EDIT.

Code generated by "make api"; DO NOT EDIT.

Index

Constants

View Source
const EnvBoundaryAddr = "BOUNDARY_ADDR"
View Source
const EnvBoundaryCACert = "BOUNDARY_CACERT"
View Source
const EnvBoundaryCAPath = "BOUNDARY_CAPATH"
View Source
const EnvBoundaryClientCert = "BOUNDARY_CLIENT_CERT"
View Source
const EnvBoundaryClientKey = "BOUNDARY_CLIENT_KEY"
View Source
const EnvBoundaryClientTimeout = "BOUNDARY_CLIENT_TIMEOUT"
View Source
const EnvBoundaryMaxRetries = "BOUNDARY_MAX_RETRIES"
View Source
const EnvBoundaryRateLimit = "BOUNDARY_RATE_LIMIT"
View Source
const EnvBoundarySRVLookup = "BOUNDARY_SRV_LOOKUP"
View Source
const EnvBoundaryTLSInsecure = "BOUNDARY_TLS_INSECURE"
View Source
const EnvBoundaryTLSServerName = "BOUNDARY_TLS_SERVER_NAME"
View Source
const EnvBoundaryToken = "BOUNDARY_TOKEN"
View Source
const (
	ErrOutputStringRequest = "output a string, please"
)

Variables

View Source
var (
	ErrNotFound         = &Error{Status: http.StatusNotFound, Code: codes.NotFound.String()}
	ErrInvalidArgument  = &Error{Status: http.StatusBadRequest, Code: codes.InvalidArgument.String()}
	ErrPermissionDenied = &Error{Status: http.StatusForbidden, Code: codes.PermissionDenied.String()}
	ErrUnauthorized     = &Error{Status: http.StatusUnauthorized, Code: codes.Unauthenticated.String()}
)

Functions

This section is empty.

Types

type Client

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

Client is the client to the Boundary API. Create a client with NewClient.

func NewClient

func NewClient(c *Config) (*Client, error)

NewClient returns a new client for the given configuration.

If the configuration is nil, Boundary will use configuration from DefaultConfig(), which is the recommended starting configuration.

If the environment variable `BOUNDARY_TOKEN` is present, the token will be automatically added to the client. Otherwise, you must manually call `SetToken()`.

func (*Client) Addr

func (c *Client) Addr() string

Addr returns the current (parsed) address

func (*Client) Clone

func (c *Client) Clone() *Client

Clone creates a new client with the same configuration. Note that the same underlying http.Client is used; modifying the client from more than one goroutine at once may not be safe, so modify the client as needed and then clone.

func (*Client) Do

func (c *Client) Do(r *retryablehttp.Request) (*Response, error)

Do takes a properly configured request and applies client configuration to it, returning the response.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, requestPath string, body interface{}, opt ...Option) (*retryablehttp.Request, error)

NewRequest creates a new raw request object to query the Boundary controller configured for this client. This is an advanced method and generally doesn't need to be called externally.

func (*Client) RecoveryKmsWrapper

func (c *Client) RecoveryKmsWrapper() wrapping.Wrapper

RecoveryKmsWrapper gets the configured recovery KMS wrapper.

func (*Client) SetAddr

func (c *Client) SetAddr(addr string) error

Sets the address of Boundary in the client. The format of address should be "<Scheme>://<Host>:<Port>". Setting this on a client will override the value of the BOUNDARY_ADDR environment variable.

func (*Client) SetBackoff

func (c *Client) SetBackoff(backoff retryablehttp.Backoff)

SetBackoff sets the backoff function to be used for future requests.

func (*Client) SetCheckRetry

func (c *Client) SetCheckRetry(checkRetry retryablehttp.CheckRetry)

SetCheckRetry sets the CheckRetry function to be used for future requests.

func (*Client) SetClientTimeout

func (c *Client) SetClientTimeout(timeout time.Duration)

SetClientTimeout sets the client request timeout

func (*Client) SetHeaders

func (c *Client) SetHeaders(headers http.Header)

SetHeaders clears all previous headers and uses only the given ones going forward.

func (*Client) SetLimiter

func (c *Client) SetLimiter(rateLimit float64, burst int)

SetLimiter will set the rate limiter for this client. This method is thread-safe. rateLimit and burst are specified according to https://godoc.org/golang.org/x/time/rate#NewLimiter

func (*Client) SetMaxRetries

func (c *Client) SetMaxRetries(retries int)

SetMaxRetries sets the number of retries that will be used in the case of certain errors

func (*Client) SetOutputCurlString

func (c *Client) SetOutputCurlString(curl bool)

func (*Client) SetRecoveryKmsWrapper

func (c *Client) SetRecoveryKmsWrapper(wrapper wrapping.Wrapper)

SetRecoveryKmsWrapper sets the wrapper used for the recovery workflow

func (*Client) SetTLSConfig

func (c *Client) SetTLSConfig(conf *TLSConfig) error

SetTLSConfig sets the TLS parameters to use and calls ConfigureTLS

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken sets the token directly. This won't perform any auth verification, it simply sets the token properly for future requests.

func (*Client) Token

func (c *Client) Token() string

Token gets the configured token.

type Config

type Config struct {
	// Addr is the address of the Boundary controller. This should be a
	// complete URL such as "http://boundary.example.com". If you need a custom
	// SSL cert or want to enable insecure mode, you need to specify a custom
	// HttpClient.
	Addr string

	// Token is the client token that reuslts from authentication and can be
	// used to make calls into Boundary
	Token string

	// RecoveryKmsWrapper is a wrapper used in the recovery KMS authentication
	// flow. If set, this will always be used to generate a new token value
	// per-call, regardless of any value set in Token.
	RecoveryKmsWrapper wrapping.Wrapper

	// HttpClient is the HTTP client to use. Boundary sets sane defaults for the
	// http.Client and its associated http.Transport created in DefaultConfig.
	// If you must modify Boundary's defaults, it is suggested that you start
	// with that client and modify as needed rather than start with an empty
	// client (or http.DefaultClient). Currently if the client is cloned the
	// same HttpClient is used.
	HttpClient *http.Client

	// TLSConfig contains TLS configuration information. After modifying these
	// values, ConfigureTLS should be called.
	TLSConfig *TLSConfig

	// Headers contains extra headers that will be added to any request
	Headers http.Header

	// MaxRetries controls the maximum number of times to retry when a 5xx
	// error occurs. Set to 0 to disable retrying. Defaults to 2 (for a total
	// of three tries).
	MaxRetries int

	// Timeout is for setting custom timeout parameter in the HttpClient
	Timeout time.Duration

	// The Backoff function to use; a default is used if not provided
	Backoff retryablehttp.Backoff

	// The CheckRetry function to use; a default is used if not provided
	CheckRetry retryablehttp.CheckRetry

	// Limiter is the rate limiter used by the client. If this pointer is nil,
	// then there will be no limit set. In contrast, if this pointer is set,
	// even to an empty struct, then that limiter will be used. Note that an
	// empty Limiter is equivalent blocking all events. Currently if the client
	// is cloned the same limiter is used.
	Limiter *rate.Limiter

	// OutputCurlString causes the actual request to return an error of type
	// *OutputStringError. Type asserting the error message will allow
	// fetching a cURL-compatible string for the operation.
	OutputCurlString bool

	// SRVLookup enables the client to lookup the host through DNS SRV lookup
	SRVLookup bool
}

Config is used to configure the creation of the client

func DefaultConfig

func DefaultConfig() (*Config, error)

DefaultConfig returns a default configuration for the client. It is safe to modify the return value of this function.

The default Addr is http://127.0.0.1:9200, but this can be overridden by setting the `BOUNDARY_ADDR` environment variable.

If an error is encountered, this will return nil.

func (*Config) ConfigureTLS

func (c *Config) ConfigureTLS() error

ConfigureTLS takes a set of TLS configurations and applies those to the the HTTP client.

func (*Config) ReadEnvironment

func (c *Config) ReadEnvironment() error

ReadEnvironment reads configuration information from the environment. If there is an error, no configuration value is updated.

type Error

type Error struct {
	Status  int32         `json:"status,omitempty"`
	Code    string        `json:"code,omitempty"`
	Message string        `json:"message,omitempty"`
	Details *ErrorDetails `json:"details,omitempty"`
	// contains filtered or unexported fields
}

func AsServerError

func AsServerError(in error) *Error

AsServerError returns an api *Error from the provided error. If the provided error is not an api Error nil is returned instead.

func (*Error) Error

func (e *Error) Error() string

Error satisfies the error interface.

func (*Error) Is

func (e *Error) Is(target error) bool

Errors are considered the same iff they are both api.Errors and their statuses are the same.

func (Error) ResponseBody

func (n Error) ResponseBody() *bytes.Buffer

func (Error) ResponseMap

func (n Error) ResponseMap() map[string]interface{}

type ErrorDetails

type ErrorDetails struct {
	TraceId       string        `json:"TraceId,omitempty"`
	RequestId     string        `json:"request_id,omitempty"`
	ErrorId       string        `json:"error_id,omitempty"`
	RequestFields []*FieldError `json:"request_fields,omitempty"`
}

type FieldError

type FieldError struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type GenericDeleteResult

type GenericDeleteResult interface {
	GetResponseBody() *bytes.Buffer
	GetResponseMap() map[string]interface{}
}

type GenericListResult

type GenericListResult interface {
	GetItems() interface{}
	GetResponseBody() *bytes.Buffer
	GetResponseMap() map[string]interface{}
}

type GenericResult

type GenericResult interface {
	GetItem() interface{}
	GetResponseBody() *bytes.Buffer
	GetResponseMap() map[string]interface{}
}

type Option

type Option func(*options)

Option - how Options are passed as arguments

type OutputStringError

type OutputStringError struct {
	*retryablehttp.Request
	// contains filtered or unexported fields
}
var (
	LastOutputStringError *OutputStringError
)

func (*OutputStringError) CurlString

func (d *OutputStringError) CurlString() string

func (*OutputStringError) Error

func (d *OutputStringError) Error() string

type Response

type Response struct {
	Body *bytes.Buffer
	Map  map[string]interface{}
	// contains filtered or unexported fields
}

Response is a custom response that wraps an HTTP response. Body will be populated with a buffer containing the response body after Decode is called; it will be nil if the response was a 204.

func (*Response) Decode

func (r *Response) Decode(inStruct interface{}) (*Error, error)

func (*Response) HttpResponse

func (r *Response) HttpResponse() *http.Response

HttpResponse returns the underlying HTTP response

type TLSConfig

type TLSConfig struct {
	// CACert is the path to a PEM-encoded CA cert file to use to verify the
	// Boundary server SSL certificate.
	CACert string

	// CAPath is the path to a directory of PEM-encoded CA cert files to verify
	// the Boundary server SSL certificate.
	CAPath string

	// ClientCert is the path to the certificate for Boundary communication
	ClientCert string

	// ClientKey is the path to the private key for Boundary communication
	ClientKey string

	// ServerName, if set, is used to set the SNI host when connecting via
	// TLS.
	ServerName string

	// Insecure enables or disables SSL verification
	Insecure bool
}

TLSConfig contains the parameters needed to configure TLS on the HTTP client used to communicate with Boundary.

Directories

Path Synopsis
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
internal
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.
Code generated by "make api"; DO NOT EDIT.

Jump to

Keyboard shortcuts

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