services

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Endpoint is the public path for the autoscale service.
	Endpoint = "/services/autoscale"

	// AutoscaleEndpoint is the public path for the autoscale service.
	AutoscaleEndpoint = "/autoscale"

	// AutoscalePolicyEndpoint is the public path for the autoscale policy service.
	AutoscalePolicyEndpoint = "/policies"
)
View Source
const (
	// AutoscaleAdjustmentTypePercent is the percent autoscale adjustment type.
	AutoscaleAdjustmentTypePercent = "percent"

	// AutoscaleAdjustmentTypeAbsolute is the absolute autoscale adjustment type.
	AutoscaleAdjustmentTypeAbsolute = "absolute"

	// AutoscaleAdjustmentTypeChange is the change autoscale adjustment type.
	AutoscaleAdjustmentTypeChange = "change"
)
View Source
const (
	// AutoscalePolicyMetricCPU is the CPU autoscale policy metric.
	AutoscalePolicyTypeCPU = "cpu"
)
View Source
const (
	AutoscalePolicyTypeStep = "step"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoscaleAdjustmentType

type AutoscaleAdjustmentType string

AutoscaleAdjustmentType is the autoscale adjustment type.

type AutoscaleConfiguration

type AutoscaleConfiguration struct {
	// The status of the autoscale configuration.
	Status string `json:"status,omitempty"`

	// UUID is the UUID of the autoscale configuration.
	UUID string `json:"uuid,omitempty"`

	// Name is the name of the autoscale configuration.
	Name string `json:"name,omitempty"`

	// Enabled indicates if the autoscale configuration is enabled.
	Enabled bool `json:"enabled,omitempty"`

	// MinSize is the minimum number of instances of the autoscale configuration.
	MinSize uint `json:"min_size"` // 'omitempty' is not used here because 0 is a valid value.

	// MaxSize is the maximum number of instances of the autoscale configuration.
	MaxSize uint `json:"max_size,omitempty"`

	// WarmupTimeMs is the length of the warmup period in milliseconds.
	WarmupTimeMs uint `json:"warmup_time_ms,omitempty"`

	// CooldownTimeMs is the length of the cooldown period in milliseconds.
	CooldownTimeMs uint `json:"cooldown_time_ms,omitempty"`

	// Message contains the error message either on `partial_success` or `error`.
	Message string `json:"message,omitempty"`

	// Master is the master instance of the autoscale configuration.
	Master *instances.Instance `json:"master,omitempty"`

	// Policies is the list of autoscale policies of the autoscale configuration.
	Policies []map[string]interface{} `json:"policies,omitempty"`
}

type AutoscalePolicyMetric

type AutoscalePolicyMetric string

AutoscalePolicyMetric is the autoscale policy metric.

type AutoscalePolicyType

type AutoscalePolicyType string

type AutoscaleService

type AutoscaleService interface {
	client.ServiceClient[AutoscaleService]

	// CreateConfigurationByUUID creates a new autoscale configuration with the
	// UUID of a service group.
	CreateConfigurationByUUID(ctx context.Context, uuid string, req AutoscaleConfiguration) (*services.ServiceGroup, error)

	// CreateConfigurationByName creates a new autoscale configuration with the
	// Name of a service group.
	CreateConfigurationByName(ctx context.Context, name string, req AutoscaleConfiguration) (*services.ServiceGroup, error)

	// GetConfigurationByName returns the current state and the configuration of
	// an autoscale configuration
	GetConfigurationByName(ctx context.Context, name string) (*AutoscaleConfiguration, error)

	// GetConfigurationByUUID returns the current state and the configuration of
	// an autoscale configuration
	GetConfigurationByUUID(ctx context.Context, uuid string) (*AutoscaleConfiguration, error)

	// DeleteConfigurationByUUID deletes an autoscale configuration given its
	// UUID.
	DeleteConfigurationByUUID(ctx context.Context, uuid string) error

	// DeleteConfigurationByName deletes an autoscale configuration given its
	// name.
	DeleteConfigurationByName(ctx context.Context, name string) error

	// CreatePolicy creates a new autoscale policy for an autoscale configuration.
	CreatePolicy(ctx context.Context, uuid string, typ AutoscalePolicyType, req interface{}) (*AutoscaleConfiguration, error)

	// DeletePolicyByName deletes an autoscale policy given its name.
	DeletePolicyByName(ctx context.Context, uuid, name string) (*AutoscaleConfiguration, error)

	// GetPolicyByName returns the current state and the configuration of an
	// autoscale policy
	GetPolicyByName(ctx context.Context, uuid, name string) (*map[string]interface{}, error)
}

func NewAutoscaleClientFromOptions

func NewAutoscaleClientFromOptions(opts *options.Options) AutoscaleService

NewAutoscaleClientFromOptions instantiates a new autoscale services client based on the provided pre-existing options.

type AutoscaleStepPolicy

type AutoscaleStepPolicy struct {
	// Name of the policy.
	Name string `json:"name,omitempty"`

	// Type of the autoscale policy.
	Type AutoscalePolicyType `json:"type,omitempty"`

	// Metric is the metric of the autoscale policy.
	Metric AutoscalePolicyMetric `json:"metric,omitempty"`

	// AdjustmentType is the adjustment type of the autoscale policy.
	AdjustmentType AutoscaleAdjustmentType `json:"adjustment_type,omitempty"`

	// Steps are the steps of the autoscale policy.
	Steps []AutoscaleStepPolicyStep `json:"steps,omitempty"`
}

type AutoscaleStepPolicyStep

type AutoscaleStepPolicyStep struct {
	// LowerBound is the lower bound of the autoscale policy step.
	LowerBound int `json:"lower_bound"` // 'omitempty' is not used here because 0 is a valid value.

	// UpperBound is the upper bound of the autoscale policy step.
	UpperBound int `json:"upper_bound,omitempty"`

	// Adjustment is the adjustment of the autoscale policy step.
	Adjustment int `json:"adjustment,omitempty"`
}

type Service

type Service struct {
	// Public-facing port.
	Port int `json:"port"`

	// Application port to which inbound traffic is redirected.
	DestinationPort int `json:"destination_port,omitempty"`

	// List of handlers.
	Handlers []services.Handler `json:"handlers,omitempty"`
}

A service helps describe the the load balancing and autoscale groups.

Jump to

Keyboard shortcuts

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