autoscale

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateCPUThresholdScaling added in v1.1.1

type CreateCPUThresholdScaling struct {
	ServerPrefix string `validate:"required"`
	Up           int    `validate:"required"`
	Down         int    `validate:"required"`
}

type CreateRequest

type CreateRequest struct {
	Name        string `validate:"required"`
	Description string `validate:"min=0,max=512"`
	Tags        types.Tags
	IconID      types.ID

	Zones                  []string                      `validate:"required"`
	Config                 string                        `validate:"required"`
	TriggerType            types.EAutoScaleTriggerType   `validate:"omitempty,oneof=cpu router schedule"`
	CPUThresholdScaling    *CreateCPUThresholdScaling    `validate:"omitempty,dive"`
	RouterThresholdScaling *CreateRouterThresholdScaling `validate:"omitempty,dive"`
	ScheduleScaling        []*CreateScheduleScaling      `validate:"omitempty,dive"`
	Disabled               bool

	APIKeyID string `validate:"required"`
}

func (*CreateRequest) ToRequestParameter

func (req *CreateRequest) ToRequestParameter() (*iaas.AutoScaleCreateRequest, error)

func (*CreateRequest) Validate

func (req *CreateRequest) Validate() error

type CreateRouterThresholdScaling added in v1.5.0

type CreateRouterThresholdScaling struct {
	RouterPrefix string `validate:"required"`
	Direction    string `validate:"required,oneof=in out"`
	Mbps         int    `validate:"required"`
}

type CreateScheduleScaling added in v1.7.0

type CreateScheduleScaling struct {
	Action    types.EAutoScaleAction `validate:"required,oneof=up down"`
	Hour      int                    `validate:"gte=0,lte=23"`
	Minute    int                    `validate:"oneof=0 15 30 45"`
	DayOfWeek []types.EDayOfTheWeek  `validate:"gt=0,unique,dive,required,oneof=sun mon tue wed thu fri sat"`
}

type DeleteRequest

type DeleteRequest struct {
	ID types.ID `service:"-" validate:"required"`

	FailIfNotFound bool `service:"-"`
}

func (*DeleteRequest) Validate

func (req *DeleteRequest) Validate() error

type FindRequest

type FindRequest struct {
	Names []string `service:"-"`
	Tags  []string `service:"-"`

	Sort  search.SortKeys
	Count int
	From  int
}

func (*FindRequest) ToRequestParameter

func (req *FindRequest) ToRequestParameter() (*iaas.FindCondition, error)

func (*FindRequest) Validate

func (req *FindRequest) Validate() error

type ReadRequest

type ReadRequest struct {
	ID types.ID `service:"-" validate:"required"`
}

func (*ReadRequest) Validate

func (req *ReadRequest) Validate() error

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides a high-level API of for AutoScale

func New

func New(caller iaas.APICaller) *Service

New returns new service instance of AutoScale

func (*Service) Create

func (s *Service) Create(req *CreateRequest) (*iaas.AutoScale, error)

func (*Service) CreateWithContext

func (s *Service) CreateWithContext(ctx context.Context, req *CreateRequest) (*iaas.AutoScale, error)

func (*Service) Delete

func (s *Service) Delete(req *DeleteRequest) error

func (*Service) DeleteWithContext

func (s *Service) DeleteWithContext(ctx context.Context, req *DeleteRequest) error

func (*Service) Find

func (s *Service) Find(req *FindRequest) ([]*iaas.AutoScale, error)

func (*Service) FindWithContext

func (s *Service) FindWithContext(ctx context.Context, req *FindRequest) ([]*iaas.AutoScale, error)

func (*Service) Read

func (s *Service) Read(req *ReadRequest) (*iaas.AutoScale, error)

func (*Service) ReadWithContext

func (s *Service) ReadWithContext(ctx context.Context, req *ReadRequest) (*iaas.AutoScale, error)

func (*Service) Status

func (s *Service) Status(req *StatusRequest) (*iaas.AutoScaleStatus, error)

func (*Service) StatusWithContext

func (s *Service) StatusWithContext(ctx context.Context, req *StatusRequest) (*iaas.AutoScaleStatus, error)

func (*Service) Update

func (s *Service) Update(req *UpdateRequest) (*iaas.AutoScale, error)

func (*Service) UpdateWithContext

func (s *Service) UpdateWithContext(ctx context.Context, req *UpdateRequest) (*iaas.AutoScale, error)

type StatusRequest

type StatusRequest struct {
	ID types.ID `service:"-" validate:"required"`
}

func (*StatusRequest) Validate

func (req *StatusRequest) Validate() error

type UpdateCPUThresholdScaling added in v1.1.1

type UpdateCPUThresholdScaling struct {
	ServerPrefix *string `service:",omitempty" validate:"omitempty,required"`
	Up           *int    `service:",omitempty" validate:"omitempty,required"`
	Down         *int    `service:",omitempty" validate:"omitempty,required"`
}

type UpdateRequest

type UpdateRequest struct {
	ID types.ID `service:"-" validate:"required"`

	Name        *string     `service:",omitempty" validate:"omitempty,min=1"`
	Description *string     `service:",omitempty" validate:"omitempty,max=512"`
	Tags        *types.Tags `service:",omitempty"`
	IconID      *types.ID   `service:",omitempty"`

	Zones                  *[]string                     `service:",omitempty" validate:"omitempty,required"`
	Config                 *string                       `service:",omitempty" validate:"omitempty,required"`
	TriggerType            *string                       `service:",omitempty" validate:"omitempty,required,oneof=cpu router"`
	CPUThresholdScaling    *UpdateCPUThresholdScaling    `service:"-" validate:"omitempty,dive"`
	RouterThresholdScaling *UpdateRouterThresholdScaling `service:"-" validate:"omitempty,dive"`
	ScheduleScaling        *[]*UpdateScheduleScaling     `service:"-" validate:"omitempty,dive"`
	Disabled               *bool                         `service:",omitempty"`

	SettingsHash string
}

func (*UpdateRequest) ToRequestParameter

func (req *UpdateRequest) ToRequestParameter(current *iaas.AutoScale) (*iaas.AutoScaleUpdateRequest, error)

func (*UpdateRequest) Validate

func (req *UpdateRequest) Validate() error

type UpdateRouterThresholdScaling added in v1.5.0

type UpdateRouterThresholdScaling struct {
	RouterPrefix *string `service:",omitempty" validate:"omitempty,required"`
	Direction    *string `service:",omitempty" validate:"omitempty,required,oneof=in out"`
	Mbps         *int    `service:",omitempty" validate:"omitempty,required"`
}

type UpdateScheduleScaling added in v1.7.0

type UpdateScheduleScaling struct {
	Action    types.EAutoScaleAction `validate:"required,oneof=up down"`
	Hour      int                    `validate:"gte=0,lte=23"`
	Minute    int                    `validate:"oneof=0 15 30 45"`
	DayOfWeek []types.EDayOfTheWeek  `validate:"gt=0,unique,dive,required,oneof=sun mon tue wed thu fri sat"`
}

Jump to

Keyboard shortcuts

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