upbound

package
v1.15.2 Latest Latest
Warning

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

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

Documentation

Overview

Package upbound implements authentication for xpkg.upbound.io.

Index

Constants

View Source
const (
	// UserAgent is the default user agent to use to make requests to the
	// Upbound API.
	UserAgent = "crossplane-cli"

	// CookieName is the default cookie name used to identify a session token.
	CookieName = "SID"
)

Variables

This section is empty.

Functions

func JSON

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     config.Profile
	Token       string
	Account     string
	Domain      *url.URL

	InsecureSkipTLSVerify bool

	APIEndpoint      *url.URL
	RegistryEndpoint *url.URL
	Cfg              *config.Config
	CfgSrc           config.Source
	// contains filtered or unexported fields
}

Context includes common data that Upbound consumers may utilize.

func NewFromFlags

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

NewFromFlags constructs a new context from flags.

func (*Context) BuildSDKConfig

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

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

type Flags

type Flags struct {
	// Keep sorted alphabetically.
	Account               string   `short:"a" env:"UP_ACCOUNT" help:"Account used to execute command." json:"account,omitempty"`
	Domain                *url.URL `env:"UP_DOMAIN" default:"https://upbound.io" help:"Root Upbound domain." json:"domain,omitempty"`
	InsecureSkipTLSVerify bool     `env:"UP_INSECURE_SKIP_TLS_VERIFY" help:"[INSECURE] Skip verifying TLS certificates." json:"insecureSkipTLSVerify,omitempty"`
	Profile               string   `env:"UP_PROFILE" help:"Profile used to execute command." predictor:"profiles" json:"profile,omitempty"`

	// Hidden flags.
	APIEndpoint      *url.URL `` /* 138-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

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

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

type Option

type Option func(*Context)

Option modifies a Context

func AllowMissingProfile

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

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

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

TokenFromPath extracts a token from the provided path.

type TokenOption

type TokenOption func(conf *tokenConf)

TokenOption modifies how a token is obtained.

Directories

Path Synopsis
Package config manages the Crossplane CLI configuration.
Package config manages the Crossplane CLI configuration.
Package credhelper provides a docker credential helper for the Upbound marketplace.
Package credhelper provides a docker credential helper for the Upbound marketplace.

Jump to

Keyboard shortcuts

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