cli

package
v1.4.20 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SessionFolderFlag = "session-directory"

Variables

View Source
var DefaultSessionFolder string
View Source
var Output io.Writer = os.Stdout

Functions

func DefaultArgsShellComp added in v1.3.2

func DefaultArgsShellComp(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

func ValidArgsGetCloudServices added in v1.3.11

func ValidArgsGetCloudServices(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)

func ValidArgsGetMetrics added in v1.3.2

func ValidArgsGetMetrics(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)

func ValidArgsGetRequirements added in v1.4.0

func ValidArgsGetRequirements(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)

func ValidArgsGetTools added in v1.3.2

func ValidArgsGetTools(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)

Types

type Session

type Session struct {
	*grpc.ClientConn
	*oauth2.Config

	// URL is the URL of the gRPC server to connect to
	URL string `json:"url"`

	Folder string `json:"-"`
	// contains filtered or unexported fields
}

func ContinueSession

func ContinueSession() (session *Session, err error)

func NewSession

func NewSession(url string, config *oauth2.Config, token *oauth2.Token) (session *Session, err error)

func (*Session) Authorizer added in v1.4.0

func (s *Session) Authorizer() api.Authorizer

func (*Session) HandleResponse

func (*Session) HandleResponse(msg proto.Message, err error) error

HandleResponse handles the response and error message of an gRPC call

func (*Session) MarshalJSON added in v1.4.0

func (s *Session) MarshalJSON() ([]byte, error)

MarshalJSON is custom JSON marshalling implementation that gives us more control over the fields we want to serialize. The core problem is that we want to serialize our token, e.g. to store a session state for our clients, but we do not want to export the token field in our struct. Exporting the field would create problems in multi-threaded environments. Therefore, access is only allowed through the Token() function, which keeps the token synchronized using a mutex.

func (*Session) Save

func (s *Session) Save() (err error)

Save saves the session into the `.clouditor` folder in the home directory

func (*Session) SetAuthorizer added in v1.4.0

func (s *Session) SetAuthorizer(authorizer api.Authorizer)

func (*Session) UnmarshalJSON added in v1.4.0

func (s *Session) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON is custom JSON marshalling implementation that gives us more control over the fields we want to deserialize. See MarshalJSON for a detailed explanation, why this is necessary.

Jump to

Keyboard shortcuts

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