profiles

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: BSD-3-Clause-Clear Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeClientCredentials = "client-credentials"
	AuthTypeAccessToken       = "access-token"
)
View Source
const (
	OutputJSON   = "json"
	OutputStyled = "styled"
)

Variables

View Source
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")
)

Functions

func CreateProfiler

func CreateProfiler(driverType ProfileDriver) (*osprofiles.Profiler, error)

func IsValidOutputFormat

func IsValidOutputFormat(format string) bool

IsValidOutputFormat reports whether the provided format string is supported.

func Migrate

func Migrate(to ProfileDriver, from ProfileDriver) error

func NewProfiler

func NewProfiler(store string) (*osprofiles.Profiler, error)

func NormalizeOutputFormat

func NormalizeOutputFormat(format string) string

NormalizeOutputFormat returns a supported output format. Any unknown value defaults to styled output.

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 AuthCredentialsAccessToken

type AuthCredentialsAccessToken struct {
	ClientID     string `json:"clientId"`
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
	Expiration   int64  `json:"expiration"`
}

type OtdfctlProfileStore

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

func LoadOtdfctlProfileStore

func LoadOtdfctlProfileStore(storeType ProfileDriver, profileName string) (*OtdfctlProfileStore, error)

func NewOtdfctlProfileStore

func NewOtdfctlProfileStore(storeType ProfileDriver, cfg *ProfileConfig, setDefault bool) (*OtdfctlProfileStore, error)

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)

Jump to

Keyboard shortcuts

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