rpaas

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: BSD-3-Clause Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPoolDefined = errors.New("No pool defined")
)

Functions

func ContextWithRpaasManager added in v0.9.3

func ContextWithRpaasManager(ctx context.Context, manager RpaasManager) context.Context

func IsConflictError

func IsConflictError(err error) bool

func IsNotFoundError

func IsNotFoundError(err error) bool

func IsValidationError

func IsValidationError(err error) bool

Types

type AutoscaleHandler added in v0.6.0

type AutoscaleHandler interface {
	GetAutoscale(ctx context.Context, name string) (*clientTypes.Autoscale, error)
	CreateAutoscale(ctx context.Context, instanceName string, autoscale *clientTypes.Autoscale) error
	UpdateAutoscale(ctx context.Context, instanceName string, autoscale *clientTypes.Autoscale) error
	DeleteAutoscale(ctx context.Context, name string) error
}

type BindAppArgs

type BindAppArgs struct {
	AppName          string   `form:"app-name"`
	AppHosts         []string `form:"app-hosts"`
	AppInternalHosts []string `form:"app-internal-hosts"`
	AppClusterName   string   `form:"app-cluster-name"`
	User             string   `form:"user"`
	EventID          string   `form:"eventid"`
}

type CacheManager

type CacheManager interface {
	PurgeCache(host, path string, port int32, preservePath bool) error
}

type CertificateData added in v0.6.3

type CertificateData struct {
	Name        string `json:"name"`
	Certificate string `json:"certificate"`
	Key         string `json:"key"`
}

type ConfigurationBlock

type ConfigurationBlock struct {
	Name    string `form:"block_name" json:"block_name"`
	Content string `form:"content" json:"content"`
}

type ConfigurationBlockHandler

type ConfigurationBlockHandler interface {
	// DeleteBlock removes the configuration block named by blockName. It returns
	// a nil error meaning it was successful, otherwise a non-nil one which
	// describes the reached problem.
	DeleteBlock(ctx context.Context, instanceName, blockName string) error

	// ListBlocks returns all custom configuration blocks from instance (which
	// name is instanceName). It returns a nil error meaning it was successful,
	// otherwise a non-nil one which describes the reached problem.
	ListBlocks(ctx context.Context, instanceName string) ([]ConfigurationBlock, error)

	// UpdateBlock overwrites the older configuration block content with the one.
	// Whether the configuration block entry does not exist, it will already be
	// created with the new content. It returns a nil error meaning it was
	// successful, otherwise a non-nil one which describes the reached problem.
	UpdateBlock(ctx context.Context, instanceName string, block ConfigurationBlock) error
}

ConfigurationBlockHandler defines some functions to handle the custom configuration blocks from an instance.

type ConflictError

type ConflictError struct {
	Msg string
}

func (ConflictError) Error

func (e ConflictError) Error() string

func (ConflictError) IsConflict

func (ConflictError) IsConflict() bool

type CreateArgs

type CreateArgs struct {
	Name        string                 `form:"name"`
	Team        string                 `form:"team"`
	Plan        string                 `form:"plan"`
	Description string                 `form:"description"`
	Tags        []string               `form:"tags"`
	Parameters  map[string]interface{} `form:"parameters"`
}

func (CreateArgs) Flavors added in v0.8.2

func (args CreateArgs) Flavors() []string

func (CreateArgs) IP

func (args CreateArgs) IP() string

func (CreateArgs) LoadBalancerName added in v0.9.3

func (args CreateArgs) LoadBalancerName() string

func (CreateArgs) PlanOverride

func (args CreateArgs) PlanOverride() string

type ExecArgs added in v0.9.3

type ExecArgs struct {
	Command        []string
	Pod            string
	Container      string
	TerminalWidth  uint16
	TerminalHeight uint16
	TTY            bool
	Interactive    bool

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

type ExtraFileHandler

type ExtraFileHandler interface {
	CreateExtraFiles(ctx context.Context, instanceName string, files ...File) error
	DeleteExtraFiles(ctx context.Context, instanceName string, filenames ...string) error
	GetExtraFiles(ctx context.Context, instanceName string) ([]File, error)
	UpdateExtraFiles(ctx context.Context, instanceName string, files ...File) error
}

type File

type File struct {
	Name    string
	Content []byte
}

func (File) MarshalJSON

func (f File) MarshalJSON() ([]byte, error)

func (File) SHA256

func (f File) SHA256() string

type Flavor added in v0.5.0

type Flavor struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type LogArgs added in v0.21.0

type LogArgs struct {
	Pod           *regexp.Regexp
	Container     *regexp.Regexp
	Buffer        io.Writer
	Lines         *int64
	Since         int64
	Follow        bool
	WithTimestamp bool
	Color         bool
}

type NotFoundError

type NotFoundError struct {
	Msg string
}

func (NotFoundError) Error

func (e NotFoundError) Error() string

func (NotFoundError) IsNotFound

func (NotFoundError) IsNotFound() bool

type Plan added in v0.8.2

type Plan struct {
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Schemas     *osb.Schemas `json:"schemas,omitempty"`
}

type PodStatus

type PodStatus struct {
	Running bool   `json:"running"`
	Status  string `json:"status"`
	Address string `json:"address"`
}

type PodStatusMap

type PodStatusMap map[string]PodStatus

type PurgeCacheArgs

type PurgeCacheArgs struct {
	Path         string `json:"path" form:"path"`
	PreservePath bool   `json:"preserve_path" form:"preserve_path"`
}

type PurgeCacheBulkResult added in v0.9.3

type PurgeCacheBulkResult struct {
	Path            string `json:"path"`
	InstancesPurged int    `json:"instances_purged,omitempty"`
	Error           string `json:"error,omitempty"`
}

type Route

type Route struct {
	Path        string `json:"path" form:"path"`
	Destination string `json:"destination" form:"destination"`
	Content     string `json:"content" form:"content"`
	HTTPSOnly   bool   `json:"https_only" form:"https_only"`
}

type RouteHandler

type RouteHandler interface {
	DeleteRoute(ctx context.Context, instanceName, path string) error
	GetRoutes(ctx context.Context, instanceName string) ([]Route, error)
	UpdateRoute(ctx context.Context, instanceName string, route Route) error
}

type RpaasManager

type RpaasManager interface {
	ConfigurationBlockHandler
	ExtraFileHandler
	RouteHandler
	AutoscaleHandler

	UpdateCertificate(ctx context.Context, instance, name string, cert tls.Certificate) error
	DeleteCertificate(ctx context.Context, instance, name string) error
	GetCertificates(ctx context.Context, instanceName string) ([]CertificateData, error)
	CreateInstance(ctx context.Context, args CreateArgs) error
	DeleteInstance(ctx context.Context, name string) error
	UpdateInstance(ctx context.Context, name string, args UpdateInstanceArgs) error
	GetInstance(ctx context.Context, name string) (*v1alpha1.RpaasInstance, error)
	GetInstanceAddress(ctx context.Context, name string) (string, error)
	GetInstanceStatus(ctx context.Context, name string) (*nginxv1alpha1.Nginx, PodStatusMap, error)
	Scale(ctx context.Context, name string, replicas int32) error
	GetPlans(ctx context.Context) ([]Plan, error)
	GetFlavors(ctx context.Context) ([]Flavor, error)
	BindApp(ctx context.Context, instanceName string, args BindAppArgs) error
	UnbindApp(ctx context.Context, instanceName, appName string) error
	PurgeCache(ctx context.Context, instanceName string, args PurgeCacheArgs) (int, error)
	GetInstanceInfo(ctx context.Context, instanceName string) (*clientTypes.InstanceInfo, error)
	Exec(ctx context.Context, instanceName string, args ExecArgs) error
	Log(ctx context.Context, intanceName string, args LogArgs) error

	AddUpstream(ctx context.Context, instanceName string, upstream v1alpha1.AllowedUpstream) error
	GetUpstreams(ctx context.Context, name string) ([]v1alpha1.AllowedUpstream, error)
	DeleteUpstream(ctx context.Context, instance string, upstream v1alpha1.AllowedUpstream) error

	UpdateCertManagerRequest(ctx context.Context, instanceName string, in clientTypes.CertManager) error
	DeleteCertManagerRequest(ctx context.Context, instanceName string) error
}

func NewK8S

func NewK8S(cfg *rest.Config, k8sClient client.Client, clusterName string, poolName string) (RpaasManager, error)

func RpaasManagerFromContext added in v0.9.3

func RpaasManagerFromContext(ctx context.Context) RpaasManager

type UpdateInstanceArgs added in v0.3.0

type UpdateInstanceArgs struct {
	Team        string                 `form:"team"`
	Description string                 `form:"description"`
	Plan        string                 `form:"plan"`
	Tags        []string               `form:"tags"`
	Parameters  map[string]interface{} `form:"parameters"`
}

func (UpdateInstanceArgs) Flavors added in v0.8.2

func (args UpdateInstanceArgs) Flavors() []string

func (UpdateInstanceArgs) IP added in v0.8.2

func (args UpdateInstanceArgs) IP() string

func (UpdateInstanceArgs) LoadBalancerName added in v0.9.3

func (args UpdateInstanceArgs) LoadBalancerName() string

func (UpdateInstanceArgs) PlanOverride added in v0.8.2

func (args UpdateInstanceArgs) PlanOverride() string

type ValidationError

type ValidationError struct {
	Msg string
}

func (ValidationError) Error

func (e ValidationError) Error() string

func (ValidationError) IsValidation

func (ValidationError) IsValidation() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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