up

package module
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: Apache-2.0 Imports: 14 Imported by: 3

README

Upbound Go SDK

up-sdk-go is the official Go SDK for Upbound. It is currently under active development and subject to breaking changes.

Supported Services

The following services are currently supported:

  • Accounts
  • Configurations
  • Control Planes
  • Organizations
  • Repositories
  • Robots
  • Tokens

Authentication

up-sdk-go currently defers authentication to the consumer by passing a configured http.Client. The _examples directory contains examples of how this can be accomplished with a cookiejar implementation and session tokens.

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 ConfigModifierFn

type ConfigModifierFn func(*Config)

A ConfigModifierFn modifies a Config.

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.

func (*ContextTransport) RoundTrip added in v1.13.0

func (c *ContextTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip adds information that is deemed important to propagate to the target. Today we only propagate the request-id, but could expand this in the future.

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.

func (*DefaultErrorHandler) Handle

func (h *DefaultErrorHandler) Handle(res *http.Response) error

Handle handles HTTP response errors from the Upbound API. Caller is responsible for closing response body.

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

type ResponseErrorHandler interface {
	Handle(res *http.Response) error
}

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.

Jump to

Keyboard shortcuts

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