policies

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (string, error)

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (err error)

func Update

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) (string, error)

Types

type Action

type Action struct {
	// Specifies the scaling action.
	// ADD: adds specified number of instances to the AS group.
	// REMOVE: removes specified number of instances from the AS group.
	// SET: sets the number of instances in the AS group.
	Operation string `json:"operation"`
	// Specifies the number of instances to be operated.
	InstanceNum int `json:"instance_number"`
}

type CreateOpts

type CreateOpts struct {
	// Specifies the AS policy name. The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
	Name string `json:"scaling_policy_name" required:"true"`
	// Specifies the AS group ID, which can be obtained using the API for querying AS groups.
	ID string `json:"scaling_group_id" required:"true"`
	// Specifies the AS policy type.
	// ALARM (corresponding to alarm_id): indicates that the scaling action is triggered by an alarm.
	// SCHEDULED (corresponding to scheduled_policy): indicates that the scaling action is triggered as scheduled.
	// RECURRENCE (corresponding to scheduled_policy): indicates that the scaling action is triggered periodically.
	Type string `json:"scaling_policy_type" required:"true"`
	// Specifies the alarm rule ID. This parameter is mandatory when scaling_policy_type is set to ALARM.
	// After this parameter is specified, the value of scheduled_policy does not take effect.
	// After you create an alarm policy, the system automatically adds an alarm triggering
	// activity of the autoscaling type to the alarm_actions field in the alarm rule specified by the parameter value.
	AlarmID string `json:"alarm_id,omitempty"`
	// Specifies the periodic or scheduled AS policy. This parameter is mandatory
	// when scaling_policy_type is set to SCHEDULED or RECURRENCE.
	// After this parameter is specified, the value of alarm_id does not take effect.
	SchedulePolicy SchedulePolicyOpts `json:"scheduled_policy,omitempty"`
	// Specifies the scaling action of the AS policy.
	Action Action `json:"scaling_policy_action,omitempty"`
	// Specifies the cooldown period (in seconds). The value ranges from 0 to 86400 and is 300 by default.
	CoolDownTime int `json:"cool_down_time,omitempty"`
}

type Policy

type Policy struct {
	// Specifies the AS group ID.
	ID string `json:"scaling_group_id"`
	// Specifies the AS policy name.
	Name string `json:"scaling_policy_name"`
	// Specifies the AS policy status.
	// INSERVICE: The AS policy is enabled.
	// PAUSED: The AS policy is disabled.
	// EXECUTING: The AS policy is being executed.
	Status string `json:"policy_status"`
	// Specifies the AS policy type.
	// ALARM: indicates that the scaling action is triggered by an alarm. A value is returned for alarm_id, and no value is returned for scheduled_policy.
	// SCHEDULED: indicates that the scaling action is triggered as scheduled.
	// A value is returned for scheduled_policy, and no value is returned for alarm_id, recurrence_type, recurrence_value, start_time, or end_time.
	// RECURRENCE: indicates that the scaling action is triggered periodically.
	// Values are returned for scheduled_policy, recurrence_type, recurrence_value, start_time, and end_time, and no value is returned for alarm_id.
	Type string `json:"scaling_policy_type"`
	// Specifies the alarm ID.
	AlarmID string `json:"alarm_id"`
	// Specifies the periodic or scheduled AS policy.
	SchedulePolicy SchedulePolicy `json:"scheduled_policy"`
	// Specifies the scaling action of the AS policy.
	Action Action `json:"scaling_policy_action"`
	// Specifies the cooldown period (s).
	CoolDownTime int `json:"cool_down_time"`
	// Specifies the time when an AS policy was created. The time format complies with UTC.
	CreateTime string `json:"create_time"`
}

func Get

func Get(client *golangsdk.ServiceClient, id string) (*Policy, error)

type SchedulePolicy

type SchedulePolicy struct {
	// Specifies the time when the scaling action is triggered. The time format complies with UTC.
	// If scaling_policy_type is set to SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.
	// If scaling_policy_type is set to RECURRENCE, the time format is hh:mm.
	LaunchTime string `json:"launch_time"`
	// Specifies the type of a periodically triggered scaling action.
	// Daily: indicates that the scaling action is triggered once a day.
	// Weekly: indicates that the scaling action is triggered once a week.
	// Monthly: indicates that the scaling action is triggered once a month.
	RecurrenceType string `json:"recurrence_type"`
	// Specifies the frequency at which scaling actions are triggered.
	// If recurrence_type is set to Daily, the value is null, indicating that the scaling action is triggered once a day.
	// If recurrence_type is set to Weekly, the value ranges from 1 (Sunday) to 7 (Saturday).
	// The digits refer to dates in each week and separated by a comma, such as 1,3,5.
	// If recurrence_type is set to Monthly, the value ranges from 1 to 31.
	// The digits refer to the dates in each month and separated by a comma, such as 1,10,13,28.
	RecurrenceValue string `json:"recurrence_value"`
	// Specifies the start time of the scaling action triggered periodically.
	// The time format complies with UTC.
	// The time format is YYYY-MM-DDThh:mmZ.
	StartTime string `json:"start_time"`
	// Specifies the end time of the scaling action triggered periodically.
	// The time format complies with UTC.
	// The time format is YYYY-MM-DDThh:mmZ.
	EndTime string `json:"end_time"`
}

type SchedulePolicyOpts

type SchedulePolicyOpts struct {
	// Specifies the time when the scaling action is triggered. The time format complies with UTC.
	// If scaling_policy_type is set to SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.
	// If scaling_policy_type is set to RECURRENCE, the time format is hh:mm.
	LaunchTime string `json:"launch_time" required:"true"`
	// Specifies the periodic triggering type. This parameter is mandatory when scaling_policy_type is set to RECURRENCE.
	// Daily: indicates that the scaling action is triggered once a day.
	// Weekly: indicates that the scaling action is triggered once a week.
	// Monthly: indicates that the scaling action is triggered once a month.
	RecurrenceType string `json:"recurrence_type,omitempty"`
	// Specifies the day when a periodic scaling action is triggered. This parameter is mandatory when scaling_policy_type is set to RECURRENCE.
	// If recurrence_type is set to Daily, the value is null, indicating that the scaling action is triggered once a day.
	// If recurrence_type is set to Weekly, the value ranges from 1 (Sunday) to 7 (Saturday).
	// The digits refer to dates in each week and separated by a comma, such as 1,3,5.
	// If recurrence_type is set to Monthly, the value ranges from 1 to 31.
	// The digits refer to the dates in each month and separated by a comma, such as 1,10,13,28.
	RecurrenceValue string `json:"recurrence_value,omitempty"`
	// Specifies the start time of the scaling action triggered periodically. The time format complies with UTC.
	// The time format is YYYY-MM-DDThh:mmZ.
	StartTime string `json:"start_time,omitempty"`
	// Specifies the end time of the scaling action triggered periodically. The time format complies with UTC.
	// This parameter is mandatory when scaling_policy_type is set to RECURRENCE.
	// When the scaling action is triggered periodically, the end time cannot be earlier than the current and start time.
	// The time format is YYYY-MM-DDThh:mmZ.
	EndTime string `json:"end_time,omitempty"`
}

type UpdateOpts

type UpdateOpts struct {
	// Specifies the AS policy name. The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
	Name string `json:"scaling_policy_name,omitempty"`
	// Specifies the AS policy type.
	// ALARM (corresponding to alarm_id): indicates that the scaling action is triggered by an alarm.
	// SCHEDULED (corresponding to scheduled_policy): indicates that the scaling action is triggered as scheduled.
	// RECURRENCE (corresponding to scheduled_policy): indicates that the scaling action is triggered periodically.
	Type string `json:"scaling_policy_type,omitempty"`
	// Specifies the alarm rule ID. This parameter is mandatory when scaling_policy_type is set to ALARM.
	// After this parameter is specified, the value of scheduled_policy does not take effect.
	// After you modify an alarm policy, the system automatically adds an alarm triggering activity of the autoscaling
	// type to the alarm_actions field in the alarm rule specified by the parameter value.
	// You can obtain the parameter value by querying Cloud Eye alarm rules.
	AlarmID string `json:"alarm_id,omitempty"`
	// Specifies the periodic or scheduled AS policy. This parameter is mandatory when scaling_policy_type is set to SCHEDULED or RECURRENCE.
	// After this parameter is specified, the value of alarm_id does not take effect.
	SchedulePolicy SchedulePolicyOpts `json:"scheduled_policy,omitempty"`
	// Specifies the scaling action of the AS policy.
	Action Action `json:"scaling_policy_action,omitempty"`
	// Specifies the cooldown period (in seconds). The value ranges from 0 to 86400.
	CoolDownTime int `json:"cool_down_time,omitempty"`
}

Jump to

Keyboard shortcuts

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