policies

package
v0.0.0-...-a0f4175 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Operation          string `json:"operation"`
	InstanceNum        int    `json:"instance_number"`
	InstancePercentage int    `json:"instance_percentage"`
}

type ActionOpts

type ActionOpts struct {
	Operation          string `json:"operation,omitempty"`
	InstanceNum        int    `json:"instance_number,omitempty"`
	InstancePercentage int    `json:"instance_percentage,omitempty"`
}

type CreateOpts

type CreateOpts struct {
	Name           string             `json:"scaling_policy_name" required:"true"`
	ID             string             `json:"scaling_group_id" required:"true"`
	Type           string             `json:"scaling_policy_type" required:"true"`
	AlarmID        string             `json:"alarm_id,omitempty"`
	SchedulePolicy SchedulePolicyOpts `json:"scheduled_policy,omitempty"`
	Action         ActionOpts         `json:"scaling_policy_action,omitempty"`
	CoolDownTime   int                `json:"cool_down_time,omitempty"`
}

CreateOpts is a struct which will be used to create a policy

func (CreateOpts) ToPolicyCreateMap

func (opts CreateOpts) ToPolicyCreateMap() (map[string]interface{}, error)

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToPolicyCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder is an interface by which can serialize the create parameters

type CreateResult

type CreateResult struct {
	golangsdk.Result
}

CreateResult is a struct which represents the create result of policy

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create is a method which can be able to access to create the policy of autoscaling service.

func (CreateResult) Extract

func (r CreateResult) Extract() (string, error)

Extract of CreateResult will deserialize the result of Creation

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

DeleteResult is a struct which represents the delete result.

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (r DeleteResult)

Delete is a method which can be able to access to delete a policy of autoscaling

type GetResult

type GetResult struct {
	golangsdk.Result
}

GetResult is a struct which represents the get result

func Get

func Get(client *golangsdk.ServiceClient, id string) (r GetResult)

Get is a method which can be able to access to get a policy detailed information

func (GetResult) Extract

func (r GetResult) Extract() (Policy, error)

type ListOpts

type ListOpts struct {
	// The scaling group ID.
	GroupID string `json:"scaling_group_id" required:"true"`
	// The scaling policy name.
	Name string `q:"scaling_policy_name"`
	// The scaling policy type.
	Type string `q:"scaling_policy_type"`
	// The scaling policy ID.
	PolicyID string `q:"scaling_policy_id"`
	// Start number value. The value must be a positive integer.
	StartNumber int `q:"start_number"`
	// Number of records displayed per page.
	// The value must be a positive integer.
	Limit int `q:"limit"`
}

ListOpts is the structure that used to query the policies of scaling group.

type ListResult

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

ListResult represents a result of the List method.

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) (r ListResult)

List is a method used to query the policies of scaling group with given parameters. Due to API limitations, there can be a maximum of 10 policies, so pagination is not considered here, simply call the API instead.

func (ListResult) Extract

func (r ListResult) Extract() ([]Policy, error)

Extract is a method to extract the list of policies for specified scaling group.

type Policy

type Policy struct {
	ID             string         `json:"scaling_group_id"`
	Name           string         `json:"scaling_policy_name"`
	PolicyID       string         `json:"scaling_policy_id"`
	Status         string         `json:"policy_status"`
	Type           string         `json:"scaling_policy_type"`
	AlarmID        string         `json:"alarm_id"`
	SchedulePolicy SchedulePolicy `json:"scheduled_policy"`
	Action         Action         `json:"scaling_policy_action"`
	CoolDownTime   int            `json:"cool_down_time"`
	CreateTime     string         `json:"create_time"`
}

Policy is a struct that represents the result of get policy

type SchedulePolicy

type SchedulePolicy struct {
	LaunchTime      string `json:"launch_time"`
	RecurrenceType  string `json:"recurrence_type"`
	RecurrenceValue string `json:"recurrence_value"`
	StartTime       string `json:"start_time"`
	EndTime         string `json:"end_time"`
}

type SchedulePolicyOpts

type SchedulePolicyOpts struct {
	LaunchTime      string `json:"launch_time" required:"true"`
	RecurrenceType  string `json:"recurrence_type,omitempty"`
	RecurrenceValue string `json:"recurrence_value,omitempty"`
	StartTime       string `json:"start_time,omitempty"`
	EndTime         string `json:"end_time,omitempty"`
}

type UpdateOpts

type UpdateOpts struct {
	Name           string             `json:"scaling_policy_name,omitempty"`
	Type           string             `json:"scaling_policy_type,omitempty"`
	AlarmID        string             `json:"alarm_id,omitempty"`
	SchedulePolicy SchedulePolicyOpts `json:"scheduled_policy,omitempty"`
	Action         ActionOpts         `json:"scaling_policy_action,omitempty"`
	CoolDownTime   int                `json:"cool_down_time,omitempty"`
}

UpdateOpts is a struct which represents the parameters of update function

func (UpdateOpts) ToPolicyUpdateMap

func (opts UpdateOpts) ToPolicyUpdateMap() (map[string]interface{}, error)

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToPolicyUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder is an interface which can build the map paramter of update function

type UpdateResult

type UpdateResult struct {
	golangsdk.Result
}

UpdateResult is a struct from which can get the result of update method

func Update

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update is a method which can be able to update the policy via accessing to the autoscaling service with Put method and parameters

func (UpdateResult) Extract

func (r UpdateResult) Extract() (string, error)

Extract will deserialize the result to group id with string

Jump to

Keyboard shortcuts

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