profile

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	// ID is either a username, email, or token.
	ID string `json:"id,omitempty"`

	// Type is the type of the profile.
	Type Type `json:"type"`

	// Session is a session token used to authenticate to Upbound.
	Session string `json:"session,omitempty"`

	// Account is the default account to use when this profile is selected.
	Account string `json:"account,omitempty"`

	// Kubeconfig is the kubeconfig file path that GetSpaceKubeConfig() will
	// read. If empty, it refers to client-go's default kubeconfig location.
	Kubeconfig string `json:"kubeconfig,omitempty"`

	// KubeContext is the context within Kubeconfig that GetSpaceKubeConfig()
	// will read. If empty, it refers to the default context.
	KubeContext string `json:"kube_context,omitempty"`

	// BaseConfig represent persisted settings for this profile.
	// For example:
	// * flags
	// * environment variables
	BaseConfig map[string]string `json:"base,omitempty"`
}

A Profile is a set of credentials

func (Profile) GetSpaceKubeConfig

func (p Profile) GetSpaceKubeConfig() (*rest.Config, string, error)

GetSpaceKubeConfig returns a *rest.Config loaded from p.Kubeconfig and p.KubeContext. It returns an error if p.IsSpace() is false.

func (Profile) IsSpace

func (p Profile) IsSpace() bool

func (Profile) Validate

func (p Profile) Validate() error

Validate returns an error if the profile is invalid.

type Redacted

type Redacted struct {
	Profile
}

Redacted embeds a Upbound Profile for the sole purpose of redacting sensitive information.

func (Redacted) MarshalJSON

func (p Redacted) MarshalJSON() ([]byte, error)

MarshalJSON overrides the session field with `REDACTED` so as not to leak sensitive information. We're using an explicit copy here instead of updating the underlying Profile struct so as to not modifying the internal state of the struct by accident.

type Type

type Type string

Type is a type of Upbound profile.

const (
	// Types of profiles.
	User  Type = "user"
	Token Type = "token"
	Space Type = "space"

	DefaultName = "default"
)

Jump to

Keyboard shortcuts

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