client

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: BSD-3-Clause Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingTsuruTarget       = fmt.Errorf("rpaasv2: tsuru target cannot be empty")
	ErrMissingTsuruToken        = fmt.Errorf("rpaasv2: tsuru token cannot be empty")
	ErrMissingTsuruService      = fmt.Errorf("rpaasv2: tsuru service cannot be empty")
	ErrMissingInstance          = fmt.Errorf("rpaasv2: instance cannot be empty")
	ErrMissingFile              = fmt.Errorf("rpaasv2: file must have a name")
	ErrMissingFiles             = fmt.Errorf("rpaasv2: file list must not be empty")
	ErrMissingBlockName         = fmt.Errorf("rpaasv2: block name cannot be empty")
	ErrMissingPath              = fmt.Errorf("rpaasv2: path cannot be empty")
	ErrInvalidMaxReplicasNumber = fmt.Errorf("rpaasv2: max replicas can't be lower than 1")
	ErrInvalidMinReplicasNumber = fmt.Errorf("rpaasv2: min replicas can't be lower than 1 and can't be higher than the maximum number of replicas")
	ErrInvalidCPUUsage          = fmt.Errorf("rpaasv2: CPU usage can't be lower than 1%%")
	ErrInvalidMemoryUsage       = fmt.Errorf("rpaasv2: memory usage can't be lower than 1%%")
	ErrMissingValues            = fmt.Errorf("rpaasv2: values can't be all empty")
	ErrMissingExecCommand       = fmt.Errorf("rpaasv2: command cannot be empty")
)
View Source
var DefaultClientOptions = ClientOptions{
	Timeout: 10 * time.Second,
}

Functions

func IsNotFoundError added in v0.27.6

func IsNotFoundError(err error) bool

Types

type BasicAuthTransport added in v0.37.1

type BasicAuthTransport struct {
	Username string
	Password string
	Base     http.RoundTripper
}

func (BasicAuthTransport) RoundTrip added in v0.37.1

func (bat BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Client

type Client interface {
	GetPlans(ctx context.Context, instance string) ([]types.Plan, error)
	GetFlavors(ctx context.Context, instance string) ([]types.Flavor, error)
	Scale(ctx context.Context, args ScaleArgs) error
	Start(ctx context.Context, instance string) error
	Stop(ctx context.Context, instance string) error
	Info(ctx context.Context, args InfoArgs) (*types.InstanceInfo, error)
	UpdateCertificate(ctx context.Context, args UpdateCertificateArgs) error
	DeleteCertificate(ctx context.Context, args DeleteCertificateArgs) error
	UpdateBlock(ctx context.Context, args UpdateBlockArgs) error
	DeleteBlock(ctx context.Context, args DeleteBlockArgs) error
	ListBlocks(ctx context.Context, args ListBlocksArgs) ([]types.Block, error)
	DeleteRoute(ctx context.Context, args DeleteRouteArgs) error
	ListRoutes(ctx context.Context, args ListRoutesArgs) ([]types.Route, error)
	UpdateRoute(ctx context.Context, args UpdateRouteArgs) error
	Exec(ctx context.Context, args ExecArgs) (*websocket.Conn, error)
	Debug(ctx context.Context, args DebugArgs) (*websocket.Conn, error)
	Log(ctx context.Context, args LogArgs) error
	AddExtraFiles(ctx context.Context, args ExtraFilesArgs) error
	UpdateExtraFiles(ctx context.Context, args ExtraFilesArgs) error
	DeleteExtraFiles(ctx context.Context, args DeleteExtraFilesArgs) error
	ListExtraFiles(ctx context.Context, args ListExtraFilesArgs) ([]types.RpaasFile, error)
	GetExtraFile(ctx context.Context, args GetExtraFileArgs) (types.RpaasFile, error)

	AddAccessControlList(ctx context.Context, instance, host string, port int) error
	ListAccessControlList(ctx context.Context, instance string) ([]types.AllowedUpstream, error)
	RemoveAccessControlList(ctx context.Context, instance, host string, port int) error

	SetService(service string) (Client, error)

	ListCertManagerRequests(ctx context.Context, instance string) ([]types.CertManager, error)
	UpdateCertManager(ctx context.Context, args UpdateCertManagerArgs) error
	DeleteCertManagerByName(ctx context.Context, instance, name string) error
	DeleteCertManagerByIssuer(ctx context.Context, instance, issuer string) error

	GetMetadata(ctx context.Context, instance string) (*types.Metadata, error)
	SetMetadata(ctx context.Context, instance string, metadata *types.Metadata) error
	UnsetMetadata(ctx context.Context, instance string, metadata *types.Metadata) error
}

func NewClient

func NewClient(address, user, password string) (Client, error)

func NewClientThroughTsuru

func NewClientThroughTsuru(target, token, service string) (Client, error)

func NewClientThroughTsuruWithOptions

func NewClientThroughTsuruWithOptions(target, token, service string, opts ClientOptions) (Client, error)

func NewClientWithOptions

func NewClientWithOptions(address, user, password string, opts ClientOptions) (Client, error)

type ClientOptions

type ClientOptions struct {
	Timeout            time.Duration
	InsecureSkipVerify bool
}

type DebugArgs added in v0.37.0

type DebugArgs struct {
	In             io.Reader
	Command        []string
	Instance       string
	Pod            string
	Container      string
	Image          string
	TerminalWidth  uint16
	TerminalHeight uint16
	TTY            bool
	Interactive    bool
}

func (DebugArgs) Validate added in v0.37.0

func (args DebugArgs) Validate() error

type DeleteBlockArgs

type DeleteBlockArgs struct {
	Instance string
	Name     string
}

func (DeleteBlockArgs) Validate

func (args DeleteBlockArgs) Validate() error

type DeleteCertificateArgs added in v0.13.0

type DeleteCertificateArgs struct {
	Instance string
	Name     string
}

func (*DeleteCertificateArgs) Validate added in v0.13.0

func (args *DeleteCertificateArgs) Validate() error

type DeleteExtraFilesArgs added in v0.27.5

type DeleteExtraFilesArgs struct {
	Instance string
	Files    []string
}

func (DeleteExtraFilesArgs) Validate added in v0.27.5

func (args DeleteExtraFilesArgs) Validate() error

type DeleteRouteArgs

type DeleteRouteArgs struct {
	Instance string
	Path     string
}

func (DeleteRouteArgs) Validate

func (args DeleteRouteArgs) Validate() error

type ErrUnexpectedStatusCode

type ErrUnexpectedStatusCode struct {
	Status int
	Body   string
}

func (*ErrUnexpectedStatusCode) Error added in v0.9.0

func (e *ErrUnexpectedStatusCode) Error() string

type ExecArgs added in v0.9.3

type ExecArgs struct {
	In             io.Reader
	Command        []string
	Instance       string
	Pod            string
	Container      string
	TerminalWidth  uint16
	TerminalHeight uint16
	Interactive    bool
	TTY            bool
}

func (ExecArgs) Validate added in v0.9.3

func (args ExecArgs) Validate() error

type ExtraFilesArgs added in v0.27.5

type ExtraFilesArgs struct {
	Instance string
	Files    []types.RpaasFile
}

func (ExtraFilesArgs) Validate added in v0.27.5

func (args ExtraFilesArgs) Validate() error

type GetAutoscaleArgs added in v0.8.1

type GetAutoscaleArgs struct {
	Instance string
	Raw      bool
}

type GetExtraFileArgs added in v0.27.5

type GetExtraFileArgs struct {
	Instance string
	FileName string
}

func (GetExtraFileArgs) Validate added in v0.27.5

func (args GetExtraFileArgs) Validate() error

type InfoArgs added in v0.7.4

type InfoArgs struct {
	Instance string
	Raw      bool
}

func (InfoArgs) Validate added in v0.7.4

func (args InfoArgs) Validate() error

type ListBlocksArgs

type ListBlocksArgs struct {
	Instance string
}

func (ListBlocksArgs) Validate

func (args ListBlocksArgs) Validate() error

type ListExtraFilesArgs added in v0.27.5

type ListExtraFilesArgs struct {
	Instance    string
	ShowContent bool
}

type ListRoutesArgs

type ListRoutesArgs struct {
	Instance string
}

func (ListRoutesArgs) Validate

func (args ListRoutesArgs) Validate() error

type LogArgs added in v0.21.0

type LogArgs struct {
	Out       io.Writer
	Instance  string
	Pod       string
	Container string
	Since     time.Duration
	Lines     int
	Follow    bool
	Color     bool
}

func (LogArgs) Validate added in v0.21.0

func (args LogArgs) Validate() error

type RemoveAutoscaleArgs added in v0.8.1

type RemoveAutoscaleArgs struct {
	Instance string
}

type ScaleArgs

type ScaleArgs struct {
	Instance string
	Replicas int32
}

func (ScaleArgs) Validate

func (args ScaleArgs) Validate() error

type UpdateAutoscaleArgs added in v0.8.1

type UpdateAutoscaleArgs struct {
	Instance    string
	MinReplicas *int32
	MaxReplicas *int32
	CPU         *int32
	Memory      *int32
	RPS         *int32
}

type UpdateBlockArgs

type UpdateBlockArgs struct {
	Instance string
	Name     string
	Content  string
}

func (UpdateBlockArgs) Validate

func (args UpdateBlockArgs) Validate() error

type UpdateCertManagerArgs added in v0.15.0

type UpdateCertManagerArgs struct {
	types.CertManager
	Instance string
}

func (*UpdateCertManagerArgs) Validate added in v0.15.0

func (args *UpdateCertManagerArgs) Validate() error

type UpdateCertificateArgs

type UpdateCertificateArgs struct {
	Instance    string
	Name        string
	Certificate string
	Key         string
	// contains filtered or unexported fields
}

func (UpdateCertificateArgs) Validate

func (args UpdateCertificateArgs) Validate() error

type UpdateRouteArgs

type UpdateRouteArgs struct {
	Instance    string
	Path        string
	Destination string
	HTTPSOnly   bool
	Content     string
}

func (UpdateRouteArgs) Validate

func (args UpdateRouteArgs) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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