config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProfileName = "default"

Variables

View Source
var ErrCredentialProfileChanged = errors.New("credential profile changed during OAuth login")

Functions

func AliyunConfigPath

func AliyunConfigPath(getenv func(string) string) string

func ConfigPath

func ConfigPath(getenv func(string) string) string

func CredentialProfileAuthDigest added in v0.2.2

func CredentialProfileAuthDigest(profile map[string]any) [sha256.Size]byte

func EcctlConfigPath

func EcctlConfigPath(getenv func(string) string) string

func NormalizeOAuthAccountID added in v0.2.2

func NormalizeOAuthAccountID(accountID string) (string, error)

func NormalizeOAuthProfileName added in v0.2.2

func NormalizeOAuthProfileName(name string) (string, error)

func ProfileName

func ProfileName(explicit string, getenv func(string) string) string

func ResolveRegion

func ResolveRegion(explicit string, getenv func(string) string) (string, *ecerrors.AppError)

func ResolveRegionForProfile

func ResolveRegionForProfile(explicit string, profile string, configPath string, getenv func(string) string) (string, *ecerrors.AppError)

func TelemetryEnabled added in v0.2.0

func TelemetryEnabled(path string) bool

TelemetryEnabled reads the global, profile-independent telemetry switch. Missing configuration defaults to true; malformed configuration fails closed so telemetry can never make an otherwise usable CLI fail.

func ValidRegion

func ValidRegion(region string) bool

Types

type ConfigItem

type ConfigItem struct {
	Key         string   `json:"key"`
	StoredAs    string   `json:"stored_as"`
	Description string   `json:"description"`
	Value       string   `json:"value,omitempty"`
	Type        string   `json:"type"`
	Allowed     []string `json:"allowed,omitempty"`
	Sensitive   bool     `json:"sensitive,omitempty"`
	SetExample  string   `json:"set_example"`
}

func EffectiveItems

func EffectiveItems(name string, showSecret bool, ecctlConfigPath string, aliyunConfigPath string) ([]ConfigItem, error)

func SupportedItems

func SupportedItems() []ConfigItem

type ConfigValue

type ConfigValue struct {
	Key       string `json:"key"`
	Value     string `json:"value"`
	Sensitive bool   `json:"sensitive,omitempty"`
}

func ConfigValueFromProfile

func ConfigValueFromProfile(profile Profile, key string, showSecret bool) (ConfigValue, error)

func EffectiveValue

func EffectiveValue(name string, key string, showSecret bool, ecctlConfigPath string, aliyunConfigPath string) (ConfigValue, error)

type NativeOAuthProfileState added in v0.2.2

type NativeOAuthProfileState struct {
	Name           string
	SiteType       string
	Generation     string
	AccountID      string
	Current        string
	Exists         bool
	ConfigExisted  bool
	AuthGeneration [sha256.Size]byte
}

type Profile

type Profile struct {
	Name            string
	Mode            string
	Region          string
	AccessKeyID     string
	AccessKeySecret string
	SecurityToken   string
	Language        string
	Output          string
}

func EffectiveProfile

func EffectiveProfile(name string, ecctlConfigPath string, aliyunConfigPath string) (Profile, bool, error)

type RegionSource added in v0.2.1

type RegionSource uint8

RegionSource records which input won region resolution. Callers must keep this provenance until credential profile policy has been applied: ignoring credential profiles must discard a stored profile region, but it must not discard an explicit flag or ECCTL_REGION.

const (
	RegionSourceUnset RegionSource = iota
	RegionSourceExplicit
	RegionSourceECCTL
	RegionSourceAlibabaEnv
	RegionSourceProfile
)

type ResolvedRegion added in v0.2.1

type ResolvedRegion struct {
	Value  string
	Source RegionSource
}

func ResolveRegionForProfileWithSource added in v0.2.1

func ResolveRegionForProfileWithSource(explicit string, profile string, configPath string, getenv func(string) string) (ResolvedRegion, *ecerrors.AppError)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func LoadExistingStore

func LoadExistingStore(path string) (*Store, bool, error)

func LoadNativeOAuthStore added in v0.2.2

func LoadNativeOAuthStore(path string) (*Store, error)

LoadNativeOAuthStore freezes and strictly validates the ecctl configuration target before an interactive login begins. OAuth tokens are never stored in this general configuration file.

func LoadStore

func LoadStore(path string) (*Store, error)

func (*Store) ConfigItems

func (s *Store) ConfigItems(name string, showSecret bool) ([]ConfigItem, error)

func (*Store) Current

func (s *Store) Current() string

func (*Store) GetValue

func (s *Store) GetValue(name string, key string, showSecret bool) (ConfigValue, error)

func (*Store) NativeOAuthProfileState added in v0.2.2

func (s *Store) NativeOAuthProfileState(name string) NativeOAuthProfileState

func (*Store) PreflightNativeOAuthWrite added in v0.2.2

func (s *Store) PreflightNativeOAuthWrite(ctx context.Context) error

func (*Store) Profile

func (s *Store) Profile(name string) (Profile, bool)

func (*Store) RequestedPath added in v0.2.2

func (s *Store) RequestedPath() string

func (*Store) ResolvedPath added in v0.2.2

func (s *Store) ResolvedPath() string

func (*Store) Save

func (s *Store) Save() error

func (*Store) SaveContext added in v0.2.2

func (s *Store) SaveContext(ctx context.Context) error

func (*Store) SetCurrentProfile

func (s *Store) SetCurrentProfile(name string) error

func (*Store) SetNativeOAuthProfile added in v0.2.2

func (s *Store) SetNativeOAuthProfile(state NativeOAuthProfileState, siteType, generation, accountID string) error

func (*Store) SetRegion

func (s *Store) SetRegion(name string, region string) error

func (*Store) SetValue

func (s *Store) SetValue(name string, key string, value string) (ConfigValue, error)

func (*Store) UseProfile

func (s *Store) UseProfile(name string) error

Jump to

Keyboard shortcuts

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