Documentation
¶
Index ¶
- Constants
- Variables
- func GetDefault(profiler *Profiler) (string, error)
- func IsValidOutputFormat(format string) bool
- func ListProfiles(profiler *Profiler) ([]string, error)
- func Migrate(to ProfileDriver, from ProfileDriver) error
- func NormalizeOutputFormat(format string) string
- func SetDefault(profiler *Profiler, name string) error
- type AuthCredentials
- type AuthCredentialsAccessToken
- type OtdfctlProfileStore
- func LoadOtdfctlProfileStore(storeType ProfileDriver, profileName string) (*OtdfctlProfileStore, error)
- func LoadProfile(profiler *Profiler, name string) (*OtdfctlProfileStore, error)
- func NewOtdfctlProfileStore(storeType ProfileDriver, cfg *ProfileConfig, setDefault bool) (*OtdfctlProfileStore, error)
- func RegisterProfile(profiler *Profiler, cfg *ProfileConfig) (*OtdfctlProfileStore, error)
- func (p *OtdfctlProfileStore) GetAuthCredentials() AuthCredentials
- func (p *OtdfctlProfileStore) GetEndpoint() string
- func (p *OtdfctlProfileStore) GetOutputFormat() string
- func (p *OtdfctlProfileStore) GetTLSNoVerify() bool
- func (p *OtdfctlProfileStore) IsDefault() bool
- func (p *OtdfctlProfileStore) Name() string
- func (p *OtdfctlProfileStore) SetAuthCredentials(authCredentials AuthCredentials) error
- func (p *OtdfctlProfileStore) SetEndpoint(endpoint string) error
- func (p *OtdfctlProfileStore) SetOutputFormat(format string) error
- func (p *OtdfctlProfileStore) SetTLSNoVerify(tlsNoVerify bool) error
- type ProfileConfig
- type ProfileDriver
- type Profiler
Constants ¶
const ( AuthTypeClientCredentials = "client-credentials" AuthTypeAccessToken = "access-token" )
const ( OutputJSON = "json" OutputStyled = "styled" )
Variables ¶
var ( ErrDeletingDefaultProfile = errors.New("cannot delete the default profile") ErrProfileIsEmpty = errors.New("error profile is empty") ErrProfileIncorrectType = errors.New("error profile is not of type ProfileConfig") ErrCreatingPlatform = errors.New("error when creating platform") ErrCreatingNewProfile = errors.New("error creating profile") ErrUnknownProfileDriverType = errors.New("error unknown profile driver type") ErrCleaningUpProfiles = errors.New("error occurred when cleaning up profiles") ErrProfileConfigEmpty = errors.New("error profile configuration cannot be empty") // ErrProfileEndpointInvalid deliberately carries no URL or underlying parse error. ErrProfileEndpointInvalid = errors.New("error profile endpoint is invalid") // ErrMigrationDestinationNotPersistent prevents cleanup into a discarded memory store. ErrMigrationDestinationNotPersistent = errors.New("migration requires a persistent destination") )
var ( ErrInvalidProfiler = osprofiles.ErrInvalidProfiler ErrProfileNameConflict = osprofiles.ErrProfileNameConflict ErrMissingProfileName = osprofiles.ErrMissingProfileName )
Functions ¶
func GetDefault ¶ added in v0.41.0
GetDefault returns the cached default name, including an intentionally empty default, without selecting a profile or writing configuration.
func IsValidOutputFormat ¶
IsValidOutputFormat reports whether the provided format string is supported.
func ListProfiles ¶ added in v0.41.0
ListProfiles returns a detached inventory from an initialized profiler's cached global configuration. It does not write or refresh configuration from storage.
func Migrate ¶
func Migrate(to ProfileDriver, from ProfileDriver) error
func NormalizeOutputFormat ¶
NormalizeOutputFormat returns a supported output format. Any unknown value defaults to styled output.
func SetDefault ¶ added in v0.41.0
SetDefault explicitly selects a registered profile. Missing names and storage errors leave the cached default unchanged. The engine retains opaque data.
Types ¶
type AuthCredentials ¶
type AuthCredentials struct {
AuthType string `json:"authType"`
ClientID string `json:"clientId"`
// Used for client credentials
ClientSecret string `json:"clientSecret,omitempty"`
Scopes []string `json:"scopes,omitempty"`
AccessToken AuthCredentialsAccessToken `json:"accessToken,omitempty"`
}
type OtdfctlProfileStore ¶
type OtdfctlProfileStore struct {
// contains filtered or unexported fields
}
func LoadOtdfctlProfileStore ¶
func LoadOtdfctlProfileStore(storeType ProfileDriver, profileName string) (*OtdfctlProfileStore, error)
func LoadProfile ¶ added in v0.41.0
func LoadProfile(profiler *Profiler, name string) (*OtdfctlProfileStore, error)
LoadProfile loads an existing profile using the supplied engine without selecting it or changing the default. Core setters retain opaque data.
func NewOtdfctlProfileStore ¶
func NewOtdfctlProfileStore(storeType ProfileDriver, cfg *ProfileConfig, setDefault bool) (*OtdfctlProfileStore, error)
func RegisterProfile ¶ added in v0.41.0
func RegisterProfile(profiler *Profiler, cfg *ProfileConfig) (*OtdfctlProfileStore, error)
RegisterProfile saves a new configuration without implicitly choosing a default, even when no default exists. Unlike the legacy convenience constructor, it preserves supplied authentication. Name collisions (including unregistered stored records) are rejected. Registration is not a multi-record transaction: a storage failure can leave an unregistered record, but never selects a default.
func (*OtdfctlProfileStore) GetAuthCredentials ¶
func (p *OtdfctlProfileStore) GetAuthCredentials() AuthCredentials
func (*OtdfctlProfileStore) GetEndpoint ¶
func (p *OtdfctlProfileStore) GetEndpoint() string
func (*OtdfctlProfileStore) GetOutputFormat ¶
func (p *OtdfctlProfileStore) GetOutputFormat() string
func (*OtdfctlProfileStore) GetTLSNoVerify ¶
func (p *OtdfctlProfileStore) GetTLSNoVerify() bool
func (*OtdfctlProfileStore) IsDefault ¶
func (p *OtdfctlProfileStore) IsDefault() bool
func (*OtdfctlProfileStore) Name ¶
func (p *OtdfctlProfileStore) Name() string
func (*OtdfctlProfileStore) SetAuthCredentials ¶
func (p *OtdfctlProfileStore) SetAuthCredentials(authCredentials AuthCredentials) error
func (*OtdfctlProfileStore) SetEndpoint ¶
func (p *OtdfctlProfileStore) SetEndpoint(endpoint string) error
func (*OtdfctlProfileStore) SetOutputFormat ¶
func (p *OtdfctlProfileStore) SetOutputFormat(format string) error
func (*OtdfctlProfileStore) SetTLSNoVerify ¶
func (p *OtdfctlProfileStore) SetTLSNoVerify(tlsNoVerify bool) error
type ProfileConfig ¶
type ProfileConfig struct {
Name string `json:"profile"`
Endpoint string `json:"endpoint"`
TLSNoVerify bool `json:"tlsNoVerify"`
OutputFormat string `json:"outputFormat,omitempty"`
AuthCredentials AuthCredentials `json:"authCredentials"`
}
func (*ProfileConfig) GetName ¶
func (pc *ProfileConfig) GetName() string
type ProfileDriver ¶
type ProfileDriver string
const ( ProfileDriverKeyring ProfileDriver = "keyring" ProfileDriverMemory ProfileDriver = "in-memory" ProfileDriverFileSystem ProfileDriver = "filesystem" ProfileDriverUnknown ProfileDriver = "unknown" ProfileDriverDefault = ProfileDriverFileSystem )
func ToProfileDriver ¶
func ToProfileDriver(driverType string) (ProfileDriver, error)
type Profiler ¶ added in v0.41.0
type Profiler = osprofiles.Profiler
Profiler names the existing engine returned by CreateProfiler and NewProfiler. Consumers can retain it in typed fields without importing the internal engine. Constructors initialize missing global configuration and may upgrade its version; they are not read-only inspection APIs. These facade operations never migrate drivers.
func CreateProfiler ¶
func CreateProfiler(driverType ProfileDriver) (*Profiler, error)