Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { NewRequest(ctx context.Context, method, prefix, urlPath string, body interface{}) (*http.Request, error) Do(req *http.Request, obj interface{}) error With(modifiers ...ClientModifierFn) Client }
Client is an HTTP client for communicating with Upbound.
type ClientModifierFn ¶
type ClientModifierFn func(*HTTPClient)
A ClientModifierFn modifies an HTTP client.
type Config ¶
type Config struct { // Client is the underlying client. Client Client // Logger is the interface for structured logging. Logger logging.Logger }
Config represents common configuration for Upbound SDK clients.
func NewConfig ¶
func NewConfig(modifiers ...ConfigModifierFn) *Config
NewConfig builds a new Config for communicating with the Upbound API.
type ContextTransport ¶ added in v1.13.0
type ContextTransport struct {
// contains filtered or unexported fields
}
ContextTransport is a http.RoundTripper that enables the caller to propagate information within the req.Context to external HTTP targets.
func NewContextTransport ¶ added in v1.13.0
func NewContextTransport(opts ...ContextTransportOption) *ContextTransport
NewContextTransport constructs a new ContextTransport.
type ContextTransportOption ¶ added in v1.13.0
type ContextTransportOption func(*ContextTransport)
ContextTransportOption modifies the underlying ContextTransport.
func WithTransport ¶ added in v1.13.0
func WithTransport(t http.RoundTripper) ContextTransportOption
WithTransport overrides the default http.Roundtripper for the ContextTransport.
type DefaultErrorHandler ¶
type DefaultErrorHandler struct{}
DefaultErrorHandler is the default operations for handling errors returned by the Upbound API.
type HTTPClient ¶
type HTTPClient struct { // BaseURL is the base Upbound API URL. BaseURL *url.URL // ErrorHandler controls how the client handles errors. ErrorHandler ResponseErrorHandler // HTTP is the underlying HTTP client. HTTP *http.Client // User agent for communicating with the Upbound API. UserAgent string }
HTTPClient implements the Client interface and allows for overriding of base URL, error handling, and user agent.
func NewClient ¶
func NewClient(modifiers ...ClientModifierFn) *HTTPClient
NewClient builds a new default HTTP client for Upbound.
func (*HTTPClient) Do ¶
func (c *HTTPClient) Do(req *http.Request, obj interface{}) error
Do performs an HTTP request and reads the body into the provided interface.
func (*HTTPClient) NewRequest ¶
func (c *HTTPClient) NewRequest(ctx context.Context, method, prefix, urlPath string, body interface{}) (*http.Request, error)
NewRequest builds an HTTP request.
func (*HTTPClient) With ¶ added in v0.3.0
func (c *HTTPClient) With(modifiers ...ClientModifierFn) Client
With returns a new Client after applying given modifiers.
type ResponseErrorHandler ¶
A ResponseErrorHandler handles errors in HTTP responses.
Directories
¶
Path | Synopsis |
---|---|
_examples
|
|
accounts
command
|
|
controlplanes
command
|
|
tokens
command
|
|
userinfo
command
|
|
apis
module
|
|
http
|
|
headers
Package headers provides HTTP header name constants for the headers we care about.
|
Package headers provides HTTP header name constants for the headers we care about. |
request
Package request offers functions for working with requestIDs.
|
Package request offers functions for working with requestIDs. |
service
|
|
users
Package users contains client and functions for user endpoint.
|
Package users contains client and functions for user endpoint. |