Documentation ¶
Index ¶
- type Profile
- func (p *Profile) ActionCli() api.ActionInterface
- func (p *Profile) Auth() error
- func (p *Profile) CheckAuth() bool
- func (p *Profile) FileCli() api.FileInterface
- func (p *Profile) GetBaseUrl() string
- func (p *Profile) GetRecordUrl(recordName *name.Record) (string, error)
- func (p *Profile) LabelCli() api.LabelInterface
- func (p *Profile) OrgCli() api.OrganizationInterface
- func (p *Profile) ProjectCli() api.ProjectInterface
- func (p *Profile) RecordCli() api.RecordInterface
- func (p *Profile) SecurityTokenCli() api.SecurityTokenInterface
- func (p *Profile) String() string
- func (p *Profile) StringWithOpts(withStar bool, verbose bool) string
- func (p *Profile) UserCli() api.UserInterface
- func (p *Profile) Validate() error
- type ProfileManager
- func (pm *ProfileManager) ActionCli() api.ActionInterface
- func (pm *ProfileManager) AddProfile(profile *Profile) error
- func (pm *ProfileManager) Auth() error
- func (pm *ProfileManager) CheckAuth() bool
- func (pm *ProfileManager) DeleteProfile(name string) error
- func (pm *ProfileManager) FileCli() api.FileInterface
- func (pm *ProfileManager) GetBaseUrl() string
- func (pm *ProfileManager) GetCurrentProfile() *Profile
- func (pm *ProfileManager) GetProfiles() []*Profile
- func (pm *ProfileManager) GetRecordUrl(recordName *name.Record) (string, error)
- func (pm *ProfileManager) IsEmpty() bool
- func (pm *ProfileManager) LabelCli() api.LabelInterface
- func (pm *ProfileManager) ProjectCli() api.ProjectInterface
- func (pm *ProfileManager) ProjectName(ctx context.Context, slug string) (*name.Project, error)
- func (pm *ProfileManager) RecordCli() api.RecordInterface
- func (pm *ProfileManager) SecurityTokenCli() api.SecurityTokenInterface
- func (pm *ProfileManager) SetProfile(profile *Profile) error
- func (pm *ProfileManager) SwitchProfile(name string) error
- func (pm *ProfileManager) UserCli() api.UserInterface
- func (pm *ProfileManager) Validate() error
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Profile ¶
type Profile struct { Name string `koanf:"name"` EndPoint string `koanf:"endpoint"` Token string `koanf:"token"` Org string `koanf:"org"` ProjectSlug string `koanf:"project"` ProjectName string `koanf:"project-name"` // contains filtered or unexported fields }
Profile represents a profile in the configuration file. Note that if Org is set, then Token is authorized If ProjectName is set, then ProjectSlug is authorized and validated
func (*Profile) ActionCli ¶
func (p *Profile) ActionCli() api.ActionInterface
ActionCli return action api interface used profile.
func (*Profile) FileCli ¶
func (p *Profile) FileCli() api.FileInterface
FileCli return file api interface used profile.
func (*Profile) GetBaseUrl ¶
GetBaseUrl returns the base url of the corresponding coScene website.
func (*Profile) GetRecordUrl ¶
GetRecordUrl returns the url of the record in the corresponding coScene website.
func (*Profile) LabelCli ¶
func (p *Profile) LabelCli() api.LabelInterface
LabelCli return label api interface used profile.
func (*Profile) OrgCli ¶
func (p *Profile) OrgCli() api.OrganizationInterface
OrgCli return org api interface used profile.
func (*Profile) ProjectCli ¶
func (p *Profile) ProjectCli() api.ProjectInterface
ProjectCli return project api interface used profile.
func (*Profile) RecordCli ¶
func (p *Profile) RecordCli() api.RecordInterface
RecordCli return project api interface used profile.
func (*Profile) SecurityTokenCli ¶
func (p *Profile) SecurityTokenCli() api.SecurityTokenInterface
SecurityTokenCli return security token api interface used profile.
func (*Profile) StringWithOpts ¶
func (*Profile) UserCli ¶
func (p *Profile) UserCli() api.UserInterface
UserCli return user api interface used profile.
type ProfileManager ¶
type ProfileManager struct { CurrentProfile string `koanf:"current-profile"` Profiles []*Profile `koanf:"profiles"` }
ProfileManager represents a profile manager in the configuration file.
func (*ProfileManager) ActionCli ¶
func (pm *ProfileManager) ActionCli() api.ActionInterface
ActionCli return action client of current profile.
func (*ProfileManager) AddProfile ¶
func (pm *ProfileManager) AddProfile(profile *Profile) error
AddProfile add a new profile to the profile manager.
func (*ProfileManager) Auth ¶
func (pm *ProfileManager) Auth() error
Auth authenticate the current login profile and modify the profile manager
func (*ProfileManager) CheckAuth ¶
func (pm *ProfileManager) CheckAuth() bool
CheckAuth check if the current login profile is authenticated
func (*ProfileManager) DeleteProfile ¶
func (pm *ProfileManager) DeleteProfile(name string) error
DeleteProfile delete a profile from the profile manager.
func (*ProfileManager) FileCli ¶
func (pm *ProfileManager) FileCli() api.FileInterface
FileCli return file client of current profile.
func (*ProfileManager) GetBaseUrl ¶
func (pm *ProfileManager) GetBaseUrl() string
GetBaseUrl returns the base url of the corresponding coScene website.
func (*ProfileManager) GetCurrentProfile ¶
func (pm *ProfileManager) GetCurrentProfile() *Profile
GetCurrentProfile return current profile of profile manager.
func (*ProfileManager) GetProfiles ¶
func (pm *ProfileManager) GetProfiles() []*Profile
GetProfiles return all profiles of profile manager.
func (*ProfileManager) GetRecordUrl ¶
func (pm *ProfileManager) GetRecordUrl(recordName *name.Record) (string, error)
GetRecordUrl gets the url of the record in the corresponding coScene website.
func (*ProfileManager) IsEmpty ¶
func (pm *ProfileManager) IsEmpty() bool
IsEmpty check if the profile manager is empty
func (*ProfileManager) LabelCli ¶
func (pm *ProfileManager) LabelCli() api.LabelInterface
LabelCli return label client of current profile.
func (*ProfileManager) ProjectCli ¶
func (pm *ProfileManager) ProjectCli() api.ProjectInterface
ProjectCli return project client of current profile.
func (*ProfileManager) ProjectName ¶
ProjectName return project name used slug parameter preferred to current profile.
func (*ProfileManager) RecordCli ¶
func (pm *ProfileManager) RecordCli() api.RecordInterface
RecordCli return record client of current profile.
func (*ProfileManager) SecurityTokenCli ¶
func (pm *ProfileManager) SecurityTokenCli() api.SecurityTokenInterface
SecurityTokenCli return security token client of current profile.
func (*ProfileManager) SetProfile ¶
func (pm *ProfileManager) SetProfile(profile *Profile) error
SetProfile set a profile to the profile manager.
func (*ProfileManager) SwitchProfile ¶
func (pm *ProfileManager) SwitchProfile(name string) error
SwitchProfile switch the current profile to the specified profile.
func (*ProfileManager) UserCli ¶
func (pm *ProfileManager) UserCli() api.UserInterface
UserCli return user client of current profile.
func (*ProfileManager) Validate ¶
func (pm *ProfileManager) Validate() error
Validate each profile and ensure that all profiles have different names. Note that empty profile manager is valid.
type Provider ¶
type Provider interface { GetProfileManager() (*ProfileManager, error) Persist(pm *ProfileManager) error }
Provider is an interface for providing the configuration