Documentation ¶
Index ¶
- type ConfigFileHandler
- type CredFileHandler
- type FileWatcher
- type Interactor
- func (i *Interactor) Gen(profile, token string) error
- func (i *Interactor) GetConfig(profile string) (core.Config, bool, error)
- func (i *Interactor) GetCredentialFile() string
- func (i *Interactor) GetCredentialProfile(profile string) core.Cred
- func (i *Interactor) GetOriginalCred(profile string) (core.Cred, bool, error)
- func (i *Interactor) GetProfileList() ([]ProfileInfo, error)
- func (i *Interactor) Off(profile string) error
- func (i *Interactor) On(profile string) error
- func (i *Interactor) Reflect() error
- func (i *Interactor) SetConfig(profile string, conf core.Config) error
- func (i *Interactor) SetCred(profile string, cred core.Cred) error
- func (i *Interactor) StartWatch(ctx context.Context)
- func (i *Interactor) Terminate() error
- type ProfileInfo
- type Server
- func (s *Server) GetCredentialsFile(ctx context.Context, in *pb.GetCredentialsFileRequest) (*pb.GetCredentialsFileResponse, error)
- func (s *Server) GetCredentialsProfile(ctx context.Context, in *pb.GetCredentialsProfileRequest) (*pb.GetCredentialsProfileResponse, error)
- func (s *Server) GetProfileList(ctx context.Context, in *pb.GetProfileListRequest) (*pb.GetProfileListResponse, error)
- func (s *Server) SetConfig(ctx context.Context, in *pb.SetConfigRequest) (*pb.SetConfigResponse, error)
- func (s *Server) SetGenerate(ctx context.Context, in *pb.SetGenerateRequest) (*pb.SetGenerateResponse, error)
- func (s *Server) SetOff(ctx context.Context, in *pb.SetOffRequest) (*pb.SetOffResponse, error)
- func (s *Server) SetOn(ctx context.Context, in *pb.SetOnRequest) (*pb.SetOnResponse, error)
- type SessionTokenGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigFileHandler ¶
type ConfigFileHandler interface { Read() (map[string]core.Config, error) Write(map[string]core.Config) error }
ConfigFileHandler is the manager read and write a config file.
type CredFileHandler ¶
type CredFileHandler interface { Read() (map[string]core.Cred, error) Write(map[string]core.Cred) error Remove() error GetFilePath() string }
CredFileHandler is the manager read and write a credential file.
type FileWatcher ¶
FileWatcher send a event when the file has a operation.
type Interactor ¶
type Interactor struct {
// contains filtered or unexported fields
}
Interactor manage the credential file and the config file.
func NewInteractor ¶
func NewInteractor(origCredPath, credPath, confPath string) *Interactor
NewInteractor create a new interactor.
func (*Interactor) Gen ¶
func (i *Interactor) Gen(profile, token string) error
Gen generate the secure token from STS.
func (*Interactor) GetCredentialFile ¶ added in v0.2.0
func (i *Interactor) GetCredentialFile() string
GetCredentialFile return the path of awscred credentials.
func (*Interactor) GetCredentialProfile ¶ added in v0.2.0
func (i *Interactor) GetCredentialProfile(profile string) core.Cred
GetCredentialProfile returns the credential of profile.
func (*Interactor) GetOriginalCred ¶
GetOriginalCred get the credential of profile.
func (*Interactor) GetProfileList ¶
func (i *Interactor) GetProfileList() ([]ProfileInfo, error)
GetProfileList return profiles.
func (*Interactor) Off ¶
func (i *Interactor) Off(profile string) error
Off set the profile disabled.
func (*Interactor) On ¶
func (i *Interactor) On(profile string) error
On set the profile enabled, and if the configuration doesn't exist it create a new configuration.
func (*Interactor) Reflect ¶
func (i *Interactor) Reflect() error
Reflect reflect the original credential file, only for enabled profiles.
func (*Interactor) SetConfig ¶
func (i *Interactor) SetConfig(profile string, conf core.Config) error
SetConfig set the config of profile.
func (*Interactor) SetCred ¶
func (i *Interactor) SetCred(profile string, cred core.Cred) error
SetCred set a new credential for the profile.
func (*Interactor) StartWatch ¶
func (i *Interactor) StartWatch(ctx context.Context)
StartWatch start to watch the orignal credential file and reflect changes into the credential file.
func (*Interactor) Terminate ¶
func (i *Interactor) Terminate() error
Terminate stop to watch the original credential file and remove the reflected credential file.
type ProfileInfo ¶
ProfileInfo is the information of profile.
type Server ¶
type Server struct { pb.UnimplementedAWSCredServer Inter *Interactor // contains filtered or unexported fields }
Server interact with the client to manage and reflect the credentials file.
func (*Server) GetCredentialsFile ¶ added in v0.2.0
func (s *Server) GetCredentialsFile(ctx context.Context, in *pb.GetCredentialsFileRequest) (*pb.GetCredentialsFileResponse, error)
GetCredentialsFile return the path of file.
func (*Server) GetCredentialsProfile ¶ added in v0.2.0
func (s *Server) GetCredentialsProfile(ctx context.Context, in *pb.GetCredentialsProfileRequest) (*pb.GetCredentialsProfileResponse, error)
GetCredentialsProfile return the credentials of profile.
func (*Server) GetProfileList ¶
func (s *Server) GetProfileList(ctx context.Context, in *pb.GetProfileListRequest) (*pb.GetProfileListResponse, error)
GetProfileList return the information of profiles.
func (*Server) SetConfig ¶
func (s *Server) SetConfig(ctx context.Context, in *pb.SetConfigRequest) (*pb.SetConfigResponse, error)
SetConfig set the configuration of the profile.
func (*Server) SetGenerate ¶
func (s *Server) SetGenerate(ctx context.Context, in *pb.SetGenerateRequest) (*pb.SetGenerateResponse, error)
SetGenerate generate the session token of the profile, and reflect it on the credential file.
func (*Server) SetOff ¶
func (s *Server) SetOff(ctx context.Context, in *pb.SetOffRequest) (*pb.SetOffResponse, error)
SetOff set the profile disabled.
func (*Server) SetOn ¶
func (s *Server) SetOn(ctx context.Context, in *pb.SetOnRequest) (*pb.SetOnResponse, error)
SetOn set the profile enabled. It makes to reflect the session token on the credential file.
type SessionTokenGenerator ¶
type SessionTokenGenerator interface {
Generate(core.Cred, core.Config, string) (core.SessionToken, error)
}
SessionTokenGenerator generate the secure cred.