upbound

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserAgent is the default user agent to use to make requests to the
	// Upbound API.
	UserAgent = "up-cli"
	// CookieName is the default cookie name used to identify a session token.
	CookieName = "SID"
)

Variables

This section is empty.

Functions

func JSON added in v0.25.0

func JSON(base, overlay io.Reader) (kong.Resolver, error)

JSON returns a Resolver that retrieves values from a JSON source. Based slightly off of https://github.com/alecthomas/kong/blob/f48da244f54370c0cb63e22b0e500e5459a491bf/resolver.go#L33-L60 Hyphens in flag names are replaced with underscores.

Types

type Context

type Context struct {
	ProfileName string
	Profile     profile.Profile
	Token       string
	Account     string
	Domain      *url.URL

	InsecureSkipTLSVerify bool

	APIEndpoint      *url.URL
	ProxyEndpoint    *url.URL
	RegistryEndpoint *url.URL
	Cfg              *config.Config
	CfgSrc           config.Source

	DebugLevel    int
	WrapTransport func(rt http.RoundTripper) http.RoundTripper
	// contains filtered or unexported fields
}

Context includes common data that Upbound consumers may utilize.

func NewFromFlags added in v0.25.0

func NewFromFlags(f Flags, opts ...Option) (*Context, error)

NewFromFlags constructs a new context from flags.

func (*Context) BuildSDKConfig added in v0.25.0

func (c *Context) BuildSDKConfig() (*up.Config, error)

BuildSDKConfig builds an Upbound SDK config suitable for usage with any service client.

type Flags added in v0.25.0

type Flags struct {
	// Optional
	Domain  *url.URL `env:"UP_DOMAIN" default:"https://upbound.io" help:"Root Upbound domain." json:"domain,omitempty"`
	Profile string   `env:"UP_PROFILE" help:"Profile used to execute command." predictor:"profiles" json:"profile,omitempty"`
	Account string   `short:"a" env:"UP_ACCOUNT" help:"Account used to execute command." json:"account,omitempty"`

	// Insecure
	InsecureSkipTLSVerify bool `env:"UP_INSECURE_SKIP_TLS_VERIFY" help:"[INSECURE] Skip verifying TLS certificates." json:"insecureSkipTLSVerify,omitempty"`
	Debug                 int  `` /* 199-byte string literal not displayed */

	// Hidden
	APIEndpoint      *url.URL `` /* 138-byte string literal not displayed */
	ProxyEndpoint    *url.URL `` /* 146-byte string literal not displayed */
	RegistryEndpoint *url.URL `` /* 158-byte string literal not displayed */
}

Flags are common flags used by commands that interact with Upbound.

func (Flags) MarshalJSON added in v0.25.0

func (f Flags) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Flags struct, converting the url.URL to strings.

type KubeFlags added in v0.25.0

type KubeFlags struct {
	// Kubeconfig is the kubeconfig file path to read. If empty, it refers to
	// client-go's default kubeconfig location.
	Kubeconfig string `type:"existingfile" help:"Override default kubeconfig path."`
	// Context is the context within Kubeconfig to read. If empty, it refers
	// to the default context.
	Context string `name:"kubecontext" help:"Override default kubeconfig context."`
	// contains filtered or unexported fields
}

func (*KubeFlags) AfterApply added in v0.25.0

func (f *KubeFlags) AfterApply() error

func (*KubeFlags) GetConfig added in v0.25.0

func (f *KubeFlags) GetConfig() *rest.Config

GetConfig returns the *rest.Config from KubeFlags. Returns nil unless AfterApply has been called.

func (*KubeFlags) GetContext added in v0.25.0

func (f *KubeFlags) GetContext() string

GetContext returns the kubeconfig context from KubeFlags. Returns empty string unless AfterApply has been called. Returns KubeFlags.Context if it's defined, otherwise the name of the default context in the config resolved from KubeFlags.Kubeconfig. NOTE(branden): This ensures that a profile created from this context will continue to work with the same cluster if the kubeconfig's default context is changed.

func (*KubeFlags) Namespace added in v0.25.0

func (f *KubeFlags) Namespace() string

type Option added in v0.25.0

type Option func(*Context)

Option modifies a Context

func AllowMissingProfile added in v0.25.0

func AllowMissingProfile() Option

AllowMissingProfile indicates that Context should still be returned even if a profile name is supplied and it does not exist in config.

type TokenFile added in v0.25.0

type TokenFile struct {
	AccessID string `json:"accessId"`
	Token    string `json:"token"`
}

TokenFile is the format in which Upbound tokens are stored on disk.

func TokenFromPath added in v0.25.0

func TokenFromPath(path string, opts ...TokenOption) (TokenFile, error)

TokenFromPath extracts a token from the provided path.

type TokenOption added in v0.25.0

type TokenOption func(conf *tokenConf)

TokenOption modifies how a token is obtained.

Jump to

Keyboard shortcuts

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