Documentation
¶
Index ¶
- Variables
- func ResolveProfile(ctx context.Context, opts ResolveProfileOptions) (*Profile, Profiles, error)
- type CachedCredential
- type Credentials
- type Name
- type Profile
- func (p Profile) CacheFor(cred credential.Credential) CachedCredential
- func (p Profile) Credentials(ctx context.Context) (out Credentials, err error)
- func (p Profile) EndpointSource() setting.FallbackSource
- func (p Profile) RemoveCredentials(ctx context.Context) error
- func (p Profile) String() string
- func (p Profile) WorkspaceSource() setting.FallbackSource
- type Profiles
- type ResolveProfileOptions
- type SettingSources
Constants ¶
This section is empty.
Variables ¶
View Source
var NameSetting = setting.Setting[Name]{ Env: "MESHSTACK_PROFILE", Short: func(envKey string) string { return fmt.Sprintf("The profile whose credentials and defaults this run uses. Also read from %s.", envKey) }, Long: func(envKey string) string { return fmt.Sprintf("The profile whose credentials and defaults this run uses, also read from `%s`.\n\n"+ "A profile is a named bundle of endpoint and credential, written by "+ "`meshstack auth login` into the meshStack CLI's configuration directory. It supplies each of those "+ "only where nothing above it did, so it is never an override.\n\n"+ "With no name given, the profile is the one whose endpoint matches the endpoint in use, else the one "+ "the last `meshstack auth login` selected, else `default`.", envKey) }, Default: setting.StaticDefault("default"), Parse: setting.ParseTextUnmarshaler[Name], }
Functions ¶
func ResolveProfile ¶
ResolveProfile loads every profile from disk, creating a default one when there is none. The returned *Profile points into Profiles.Profiles, so a change through the pointer is persisted by a later Profiles.Store.
Types ¶
type CachedCredential ¶ added in v0.2.0
type CachedCredential struct {
credential.Credential
// contains filtered or unexported fields
}
CachedCredential is the token cache of the one credential a session uses, shared with every other process using the same profile and credential.
func (CachedCredential) Load ¶ added in v0.2.0
func (c CachedCredential) Load(ctx context.Context) error
func (CachedCredential) Modify ¶ added in v0.2.0
func (c CachedCredential) Modify(ctx context.Context, action func() error) error
type Credentials ¶
type Credentials struct {
credential.Credentials
Version int `json:"version"`
FilePath string `json:"-"`
}
type Profile ¶
type Profile struct {
Endpoint xurl.URL `json:"endpoint,omitzero"`
// DefaultWorkspace might be meshstack.NoWorkspace (empty string), default value when being unmarshaled.
DefaultWorkspace meshstack.Workspace `json:"default_workspace,omitzero"`
Credential credential.Name `json:"credential,omitzero"`
// Name and ConfigDir are set by [Profile.init] after load or create, not by the JSON.
Name Name `json:"-"`
ConfigDir config.Directory `json:"-"`
}
func (Profile) CacheFor ¶ added in v0.2.0
func (p Profile) CacheFor(cred credential.Credential) CachedCredential
func (Profile) Credentials ¶
func (p Profile) Credentials(ctx context.Context) (out Credentials, err error)
func (Profile) EndpointSource ¶
func (p Profile) EndpointSource() setting.FallbackSource
func (Profile) WorkspaceSource ¶
func (p Profile) WorkspaceSource() setting.FallbackSource
type Profiles ¶
type Profiles struct {
Version int `json:"version"`
CurrentProfile Name `json:"currentProfile,omitzero"`
Profiles map[Name]*Profile `json:"profiles,omitzero"`
// contains filtered or unexported fields
}
func LoadProfiles ¶
func LoadProfiles(ctx context.Context, opts ResolveProfileOptions) (profiles Profiles, err error)
type ResolveProfileOptions ¶
type ResolveProfileOptions struct {
SettingSources
}
type SettingSources ¶
Click to show internal directories.
Click to hide internal directories.