Documentation
¶
Index ¶
Constants ¶
View Source
const ( AccessKey = "access_key" AccessSecret = "secret_key" Region = "region" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
// Connector indicates the model.Connector for creating.
Connector model.Connector
ModelClient model.ClientSet
}
CreateOptions holds the options for creating Operator.
type Creator ¶
type Creator func(context.Context, CreateOptions) (Operator, error)
Creator is a factory func to create Operator.
type Credential ¶
func CredentialFromCtx ¶
func CredentialFromCtx(ctx context.Context) (*Credential, error)
func GetCredential ¶
func GetCredential(configData crypto.Properties) (*Credential, error)
type CredentialKeyType ¶
type CredentialKeyType string
const (
CredentialKey CredentialKeyType = "credential"
)
type ExecOptions ¶
type ExecOptions struct {
// Out receives the output.
Out io.Writer
// In passes the input.
In io.Reader
// Shell indicates to launch what kind of shell.
Shell string
// Resizer indicates to resize the size(width, height) of the terminal.
Resizer TerminalResizer
}
ExecOptions holds the options of Operator's Exec action.
type ExecutableResource ¶
type LogOptions ¶
type LogOptions struct {
// Out receives the output.
Out io.Writer
// WithoutFollow returns logs without following.
WithoutFollow bool
// Previous indicates to get the previous log of the accessing target.
Previous bool
// SinceSeconds returns logs newer than a relative duration.
SinceSeconds *int64
// Timestamps returns logs with RFC3339 or RFC3339Nano timestamp.
Timestamps bool
// TailLines indicates to get the lines from end of the logs.
TailLines *int64
}
LogOptions holds the options of Operator's Log action.
type LoggableResource ¶
type LoggableResource interface {
Log(ctx context.Context, key string, opts LogOptions) error
}
type Operator ¶
type Operator interface {
// Type returns Type.
Type() Type
// IsConnected validates whether is connected.
IsConnected(context.Context) error
// Burst returns the maximum number of operations that can be called at once.
Burst() int
// ID returns an operation identifier of the operator.
//
// The result is not a unique notation of in the traditional sense,
// which means we can't use it to identify the only operator,
// but rather a generalization of the characteristics of the operator.
//
// If two operators have the same ID,
// we can group them together for some operations.
//
// ID returns a blank string if no that kind of identifier.
ID() string
// GetKeys returns keys from the given resource.
//
// The given model.ResourceComponent item must specify the following fields:
// ID, DeployerType, Type and Name.
GetKeys(context.Context, *model.ResourceComponent) (*types.ResourceComponentOperationKeys, error)
// GetStatus gets status of the given resource.
//
// The given model.ResourceComponent item must specify the following fields:
// ID, DeployerType, Type and Name.
GetStatus(context.Context, *model.ResourceComponent) (*status.Status, error)
// GetComponents gets components of the given resource,
// returns list must not be `nil` unless unexpected input or raising error,
// it can be used to clean stale items safety if got an empty list.
//
// The given model.ResourceComponent item must specify the following fields:
// ID, DeployerType, Type, Name, ProjectID, EnvironmentID, ResourceID and ConnectorID.
GetComponents(context.Context, *model.ResourceComponent) ([]*model.ResourceComponent, error)
// Log gets logs from the given key.
Log(context.Context, string, LogOptions) error
// Exec executes commands to the given key.
Exec(context.Context, string, ExecOptions) error
// Label apply labels to the resource.
//
// The given model.ResourceComponent item must specify the following fields:
// ID, DeployerType, Type and Name.
Label(context.Context, *model.ResourceComponent, map[string]string) error
}
Operator holds the actions that an operator must satisfy.
type TerminalResizer ¶
type TerminalResizer interface {
// Next returns the new terminal size after the terminal has been resized.
// It returns false when monitoring has been stopped.
Next() (width, height uint16, ok bool)
}
TerminalResizer holds the options to resize the terminal.
Click to show internal directories.
Click to hide internal directories.