config

package
v1.1.5-rc4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

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) Auth

func (p *Profile) Auth() error

Auth fetches the org and project name from the server if they are not set.

func (*Profile) CheckAuth

func (p *Profile) CheckAuth() bool

CheckAuth checks if the profile has the org and project name set.

func (*Profile) EventCli

func (p *Profile) EventCli() api.EventInterface

EventCli return event api interface used profile.

func (*Profile) FileCli

func (p *Profile) FileCli() api.FileInterface

FileCli return file api interface used profile.

func (*Profile) GetBaseUrl

func (p *Profile) GetBaseUrl() string

GetBaseUrl returns the base url of the corresponding coScene website.

func (*Profile) GetRecordUrl

func (p *Profile) GetRecordUrl(recordName *name.Record) (string, error)

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) String

func (p *Profile) String() string

func (*Profile) StringWithOpts

func (p *Profile) StringWithOpts(withStar bool, verbose bool) string

func (*Profile) TaskCli

func (p *Profile) TaskCli() api.TaskInterface

TaskCli return task api interface used profile.

func (*Profile) UserCli

func (p *Profile) UserCli() api.UserInterface

UserCli return user api interface used profile.

func (*Profile) Validate

func (p *Profile) Validate() error

Validate checks if the profile has all the required fields set.

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) EventCli

func (pm *ProfileManager) EventCli() api.EventInterface

EventCli return event client of current profile.

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

func (pm *ProfileManager) ProjectName(ctx context.Context, slug string) (*name.Project, error)

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) TaskCli

func (pm *ProfileManager) TaskCli() api.TaskInterface

TaskCli return task client of current 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

func Provide

func Provide(path string) Provider

Jump to

Keyboard shortcuts

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