Documentation ¶
Index ¶
- func FromConfig(ctx context.Context, cfg *config.Config, opts ...func(co *ClientOpts)) (*types.ClientWithResponses, error)
- func New(ctx context.Context, server, context string, oauthConfig *oauth2.Config, ...) (*types.ClientWithResponses, error)
- func WithAPIURL(url string) func(co *ClientOpts)
- func WithKeyring(k keyring.Keyring) func(co *ClientOpts)
- func WithLoginHint(hint string) func(co *ClientOpts)
- type Client
- type ClientOpts
- type ErrorHandlingClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromConfig ¶
func FromConfig(ctx context.Context, cfg *config.Config, opts ...func(co *ClientOpts)) (*types.ClientWithResponses, error)
FromConfig creates a new client from a Common Fate CLI config. The client loads the OAuth2.0 tokens from the system keychain. The client automatically refreshes the access token if it is expired.
func New ¶
func New(ctx context.Context, server, context string, oauthConfig *oauth2.Config, opts ...func(co *ClientOpts)) (*types.ClientWithResponses, error)
New creates a new client, specifying the URL and context directly. The client loads the OAuth2.0 tokens from the system keychain. The client automatically refreshes the access token if it is expired.
func WithAPIURL ¶
func WithAPIURL(url string) func(co *ClientOpts)
WithAPIURL overrides the API URL. If the url is empty, it is not overriden and the regular API URL from aws-exports.json is used instead.
This can be used for local development to provider a localhost URL.
func WithKeyring ¶
func WithKeyring(k keyring.Keyring) func(co *ClientOpts)
WithKeyring configures the client to use a custom keyring, rather than the default one configured using 'COMMONFATE_' environment variables
func WithLoginHint ¶
func WithLoginHint(hint string) func(co *ClientOpts)
Types ¶
type Client ¶
type Client = types.ClientWithResponses
Client is an alias for the exported Go SDK client type
type ClientOpts ¶
type ErrorHandlingClient ¶
type ErrorHandlingClient struct { Client *http.Client LoginHint string TokenStore *tokenstore.Storage }
ErrorHandlingClient checks the response status code and creates an error if the API returns greater than 300.