policies

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionURL

func ActionURL(c *gophercloud.ServiceClient, scalingPolicyId string) string

func CreateURL

func CreateURL(c *gophercloud.ServiceClient) string

func DeleteURL

func DeleteURL(c *gophercloud.ServiceClient, scalingPolicyId string) string

func GetURL

func GetURL(c *gophercloud.ServiceClient, scalingPolicyId string) string

func List

func List(client *gophercloud.ServiceClient, scalingGroupId string, opts ListOptsBuilder) pagination.Pager

func ListURL

func ListURL(c *gophercloud.ServiceClient, scalingGroupId string) string

func UpdateURL

func UpdateURL(c *gophercloud.ServiceClient, scalingPolicyId string) string

Types

type ActionOpts

type ActionOpts struct {
	// Specifies the operation flag for an AS group.execute: executes
	// the AS group.resume: enables the AS group.pause: disables the AS group.
	Action string `json:"action" required:"true"`
}

func (ActionOpts) ToPoliciesActionMap

func (opts ActionOpts) ToPoliciesActionMap() (map[string]interface{}, error)

type ActionOptsBuilder

type ActionOptsBuilder interface {
	ToPoliciesActionMap() (map[string]interface{}, error)
}

type ActionResult

type ActionResult struct {
	gophercloud.ErrResult
}

func Action

func Action(client *gophercloud.ServiceClient, scalingPolicyId string, opts ActionOptsBuilder) (r ActionResult)

type CreateOpts

type CreateOpts struct {
	// Specifies the AS policy name. The name can contain letters,
	// digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
	ScalingPolicyName string `json:"scaling_policy_name" required:"true"`

	// Specifies the AS group ID. You can obtain its value from the
	// API used to query AS groups. For details, see Querying AS
	// Groups.https://support.huaweicloud.com/en-us/api-as/en-us_topic_0043063030.html
	ScalingGroupId 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.
	ScalingPolicyType 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.You can obtain
	// the parameter value by querying the CES alarm rule list. For details, see section
	// Querying Alarms in the Cloud Eye API Reference.
	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.
	ScheduledPolicy ScheduledPolicy `json:"scheduled_policy"`

	// Specifies the action of the AS policy.
	ScalingPolicyAction CreateScalingPolicyAction `json:"scaling_policy_action"`

	// Specifies the cooling duration (in seconds), and is 900 by
	// default.
	CoolDownTime *int `json:"cool_down_time,omitempty"`
}

func (CreateOpts) ToPoliciesCreateMap

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

type CreateOptsBuilder

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

type CreateResponse

type CreateResponse struct {
	// Specifies the AS policy ID.
	ScalingPolicyId string `json:"scaling_policy_id"`
}

type CreateResult

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

func Create

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

func (CreateResult) Extract

func (r CreateResult) Extract() (*CreateResponse, error)

type CreateScalingPolicyAction

type CreateScalingPolicyAction struct {
	// Specifies the operation to be performed. The default operation
	// is ADD.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,omitempty"`

	// Specifies the number of instances to be operated. The default
	// number is 1.Either instance_number or instance_percentage is required.
	InstanceNumber *int `json:"instance_number,omitempty"`

	// Indicates the percentage of instances to be operated. You can
	// increase/decrease or set the number of instances in an AS group to the specified
	// percentage of the current number of instances.If neither instance_number nor
	// instance_percentage is specified, the number of instances to be operated is 1.Either
	// instance_number or instance_percentage is required.
	InstancePercentage *int `json:"instance_percentage,omitempty"`
}

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

func Delete

func Delete(client *gophercloud.ServiceClient, scalingPolicyId string) (r DeleteResult)

type GetResponse

type GetResponse struct {
	// Specifies details about the AS policy.
	ScalingPolicy ScalingPolicy `json:"scaling_policy"`
}

type GetResult

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

func Get

func Get(client *gophercloud.ServiceClient, scalingPolicyId string) (r GetResult)

func (GetResult) Extract

func (r GetResult) Extract() (*ScalingPolicy, error)

type ListOpts

type ListOpts struct {
	// Specifies the AS policy ID.
	ScalingPolicyID string `q:"scaling_policy_id"`
	// Specifies the AS policy name.
	ScalingPolicyName string `q:"scaling_policy_name"`

	// Specifies the AS policy type.
	ScalingPolicyType string `q:"scaling_policy_type"`

	// Specifies the start line number. The default value is 0.
	StartNumber int `q:"start_number"`

	// Specifies the total number of query records. The default value
	// is 20 and the maximum value is 100.
	Limit int `q:"limit"`
}

func (ListOpts) ToListQuery

func (opts ListOpts) ToListQuery() (string, error)

type ListOptsBuilder

type ListOptsBuilder interface {
	ToListQuery() (string, error)
}

type ListResponse

type ListResponse struct {
	// Specifies the total number of query records.
	TotalNumber int `json:"total_number"`

	// Specifies the start line number.
	StartNumber int `json:"start_number"`

	// Specifies the total number of query records.
	Limit int `json:"limit"`

	// Specifies the AS policy list.
	ScalingPolicies []ScalingPolicy `json:"scaling_policies"`
}

func ExtractPolicies

func ExtractPolicies(r pagination.Page) (ListResponse, error)

ExtractPolicies is a function that takes a ListResult and returns the information.

type PolicyPage

type PolicyPage struct {
	pagination.NumberPageBase
}

func (PolicyPage) IsEmpty

func (r PolicyPage) IsEmpty() (bool, error)

IsEmpty returns true if a ListResult contains no services.

func (PolicyPage) LastStartNumber

func (r PolicyPage) LastStartNumber() (string, error)

LastStartNumber returns the last service in a ListResult.

type ScalingPolicy

type ScalingPolicy struct {
	// Specifies the AS group ID.
	ScalingGroupId string `json:"scaling_group_id"`

	// Specifies the AS policy name.
	ScalingPolicyName string `json:"scaling_policy_name"`

	// Specifies the AS policy ID.
	ScalingPolicyId string `json:"scaling_policy_id"`

	// Specifies the AS policy status.INSERVICE: indicates that the AS
	// policy is in use.PAUSED: indicates that the AS policy is disabled.
	PolicyStatus 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.
	ScalingPolicyType string `json:"scaling_policy_type"`

	// Specifies the alarm ID.
	AlarmId string `json:"alarm_id"`

	// Specifies the periodic or scheduled AS policy.
	ScheduledPolicy ScheduledPolicy `json:"scheduled_policy"`

	// Specifies the scaling action of the AS policy.
	ScalingPolicyAction ScalingPolicyAction `json:"scaling_policy_action"`

	// Specifies the cooling duration (s).
	CoolDownTime int `json:"cool_down_time"`

	// Specifies the time when an AS policy is created. The time
	// format complies with UTC.
	CreateTime string `json:"create_time"`
}

type ScalingPolicyAction

type ScalingPolicyAction struct {
	// Specifies the operation to be performed. The default operation
	// is ADD.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,omitempty"`

	// Specifies the number of instances to be operated. The default
	// number is 1.Either instance_number or instance_percentage is required.
	InstanceNumber *int `json:"instance_number,omitempty"`

	// Indicates the percentage of instances to be operated. You can
	// increase/decrease or set the number of instances in an AS group to the specified
	// percentage of the current number of instances.If neither instance_number nor
	// instance_percentage is specified, the number of instances to be operated is 1.Either
	// instance_number or instance_percentage is required.
	InstancePercentage *int `json:"instance_percentage,omitempty"`
}

type ScheduledPolicy

type ScheduledPolicy struct {
	// Specifies the time when the scaling action is triggered. The
	// time format must comply 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 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. For example, 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 current time is used by
	// default.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 can contain letters,
	// digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
	ScalingPolicyName 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.
	ScalingPolicyType 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 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.You can obtain
	// the parameter value by querying the CES alarm rule list. For details, see section
	// Querying Alarms in the Cloud Eye API Reference.
	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.
	ScheduledPolicy ScheduledPolicy `json:"scheduled_policy"`

	// Specifies the scaling action of the AS policy.
	ScalingPolicyAction ScalingPolicyAction `json:"scaling_policy_action"`

	// Specifies the cooling duration (in seconds), which is 900 by
	// default.
	CoolDownTime *int `json:"cool_down_time,omitempty"`
}

func (UpdateOpts) ToPoliciesUpdateMap

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

type UpdateOptsBuilder

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

type UpdateResponse

type UpdateResponse struct {
	// Specifies the AS policy ID.
	ScalingPolicyId string `json:"scaling_policy_id"`
}

type UpdateResult

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

func Update

func Update(client *gophercloud.ServiceClient, scalingPolicyId string, opts UpdateOptsBuilder) (r UpdateResult)

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*UpdateResponse, error)

Jump to

Keyboard shortcuts

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