Documentation ¶
Index ¶
- func BatchAction(client *golangsdk.ServiceClient, opts BatchOpts) (err error)
- func Create(client *golangsdk.ServiceClient, opts CreateOpts) (string, error)
- func Delete(client *golangsdk.ServiceClient, id string) (err error)
- func PolicyAction(client *golangsdk.ServiceClient, opts ActionOpts) (err error)
- func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) (string, error)
- type Action
- type ActionOpts
- type BatchOpts
- type CreateOpts
- type EipMetaData
- type JobRecords
- type ListLogsOpts
- type ListOpts
- type ListScalingInstancesResponse
- type ListScalingPolicyExecuteLogsResponse
- type Policy
- type ScalingPolicyActionV1
- type ScalingPolicyExecuteLogList
- type ScalingV1PolicyDetail
- type SchedulePolicy
- type SchedulePolicyOpts
- type ScheduledPolicy
- type UpdateOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchAction ¶ added in v0.5.25
func BatchAction(client *golangsdk.ServiceClient, opts BatchOpts) (err error)
func Create ¶
func Create(client *golangsdk.ServiceClient, opts CreateOpts) (string, error)
func PolicyAction ¶ added in v0.5.25
func PolicyAction(client *golangsdk.ServiceClient, opts ActionOpts) (err error)
Types ¶
type Action ¶
type Action struct { // Specifies the operation to be performed. The default operation is ADD. // ADD: adds specified number of instances to the AS group. // REMOVE/REDUCE: removes or reduces 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. // The value range is as follows for a default quota: // If operation is set to SET, the value range is 0 to 200. // If operation is set to ADD, REMOVE, or REDUCE, the value range is 1 to 200. // NOTE: // Either instance_number or instance_percentage is required. InstanceNum int `json:"instance_number,omitempty"` // Specifies 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 operation is set to ADD, REMOVE or REDUCE, the value of this parameter is an integer from 1 to 20000. // If operation is set to SET, the value is an integer from 0 to 20000. // 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 ActionOpts ¶
type BatchOpts ¶ added in v0.5.25
type BatchOpts struct { ScalingPolicyId []string `json:"scaling_policy_id" required:"true"` // Specifies an action to be performed on AS policies in batches. The options are as follows: // delete: deletes AS policies. // resume: enables AS policies. // pause: disables AS policies. Action string `json:"action" required:"true"` // Specifies whether to forcibly delete an AS policy. If the value is set to no, in-progress AS policies cannot be deleted. // Options: // no (default): indicates that the AS policy is not forcibly deleted. // yes: indicates that the AS policy is forcibly deleted. // This parameter is available only when action is set to delete. ForceDelete string `json:"force_delete,omitempty"` // Specifies whether to delete the alarm rule used by the alarm policy. The value can be yes or no (default). // This parameter is available only when action is set to delete. DeleteAlarm string `json:"delete_alarm,omitempty"` }
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 EipMetaData ¶ added in v0.5.25
type EipMetaData struct { string `json:"metadata_bandwidth_share_type,omitempty"` // Specifies the EIP ID for the bandwidth in the bandwidth scaling policy. MetadataEipId string `json:"metadata_eip_id,omitempty"` // Specifies the EIP for the bandwidth in the bandwidth scaling policy. MetadataeipAddress string `json:"metadataeip_address,omitempty"` }MetadataBandwidthShareType
type JobRecords ¶ added in v0.5.25
type JobRecords struct { // Specifies the task name. JobName string `json:"job_name,omitempty"` // Specifies the record type. // API: API calling type // MEG: message type RecordType string `json:"record_type,omitempty"` // Specifies the record time. RecordTime string `json:"record_time,omitempty"` // Specifies the request body. This parameter is valid only if record_type is set to API. Request string `json:"request,omitempty"` // Specifies the response body. This parameter is valid only if record_type is set to API. Response string `json:"response,omitempty"` // Specifies the returned code. This parameter is valid only if record_type is set to API. Code string `json:"code,omitempty"` // Specifies the message. This parameter is valid only if record_type is set to MEG. Message string `json:"message,omitempty"` // Specifies the execution status of the task. // SUCCESS: The task is successfully executed. // FAIL: The task failed to be executed. JobStatus string `json:"job_status,omitempty"` }
type ListLogsOpts ¶ added in v0.5.25
type ListLogsOpts struct { // Specifies the AS policy ID. ScalingPolicyId string // Specifies the ID of an AS policy execution log. LogId string `q:"log_id,omitempty"` // Specifies the scaling resource type. // AS group: SCALING_GROUP // Bandwidth: BANDWIDTH ScalingResourceType string `q:"scaling_resource_type,omitempty"` // Specifies the scaling resource ID. ScalingResourceId string `q:"scaling_resource_id,omitempty"` // Specifies the AS policy execution type. // SCHEDULED: automatically triggered at a specified time point // RECURRENCE: automatically triggered at a specified time period // ALARM: alarm-triggered // MANUAL: manually triggered ExecuteType string `q:"execute_type,omitempty"` // Specifies the start time that complies with UTC for querying AS policy execution logs. // The format of the start time is yyyy-MM-ddThh:mm:ssZ. StartTime string `q:"start_time,omitempty"` // Specifies the end time that complies with UTC for querying AS policy execution logs. // The format of the end time is yyyy-MM-ddThh:mm:ssZ. EndTime string `q:"end_time,omitempty"` // Specifies the start line number. The default value is 0. The minimum parameter value is 0. StartNumber int32 `q:"start_number,omitempty"` // Specifies the number of query records. The default value is 20. The value range is 0 to 100. Limit int32 `q:"limit,omitempty"` }
type ListOpts ¶ added in v0.5.25
type ListOpts struct { // Specifies the AS group ID. ScalingGroupId string // Specifies the AS policy name. // Supports fuzzy search. ScalingPolicyName string `q:"scaling_policy_name,omitempty"` // Specifies the AS policy type. // ALARM: alarm policy // SCHEDULED: scheduled policy // RECURRENCE: periodic policy ScalingPolicyType string `q:"scaling_policy_type,omitempty"` // Specifies the AS policy ID. ScalingPolicyId string `q:"scaling_policy_id,omitempty"` // Specifies the start line number. The default value is 0. The minimum parameter value is 0. StartNumber int32 `q:"start_number,omitempty"` // Specifies the number of query records. The default value is 20. The value range is 0 to 100. Limit int32 `q:"limit,omitempty"` }
type ListScalingInstancesResponse ¶ added in v0.5.25
type ListScalingInstancesResponse struct { TotalNumber int32 `json:"total_number,omitempty"` StartNumber int32 `json:"start_number,omitempty"` Limit int32 `json:"limit,omitempty"` ScalingPolicies []ScalingV1PolicyDetail `json:"scaling_policies,omitempty"` }
func List ¶ added in v0.5.25
func List(client *golangsdk.ServiceClient, opts ListOpts) (*ListScalingInstancesResponse, error)
type ListScalingPolicyExecuteLogsResponse ¶ added in v0.5.25
type ListScalingPolicyExecuteLogsResponse struct { TotalNumber int32 `json:"total_number,omitempty"` StartNumber int32 `json:"start_number,omitempty"` Limit int32 `json:"limit,omitempty"` ScalingPolicyExecuteLog []ScalingPolicyExecuteLogList `json:"scaling_policy_execute_log,omitempty"` }
func ListScalingPolicyExecuteLogs ¶ added in v0.5.25
func ListScalingPolicyExecuteLogs(client *golangsdk.ServiceClient, opts ListLogsOpts) (*ListScalingPolicyExecuteLogsResponse, error)
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"` }
type ScalingPolicyActionV1 ¶ added in v0.5.25
type ScalingPolicyActionV1 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,omitempty"` // Specifies the number of instances to be operated. InstanceNumber int32 `json:"instance_number,omitempty"` // Specifies the percentage of instances to be operated. InstancePercentage int32 `json:"instance_percentage,omitempty"` }
type ScalingPolicyExecuteLogList ¶ added in v0.5.25
type ScalingPolicyExecuteLogList struct { // Specifies the AS policy execution status. // SUCCESS: The AS policy has been executed. // FAIL: Executing the AS policy failed. // EXECUTING: The AS policy is being executed. Status string `json:"status,omitempty"` // Specifies the AS policy execution failure. FailedReason string `json:"failed_reason,omitempty"` // Specifies the AS policy execution type. // SCHEDULED: automatically triggered at a specified time point // RECURRENCE: automatically triggered at a specified time period // ALARM: alarm-triggered // MANUAL: manually triggered ExecuteType string `json:"execute_type,omitempty"` // Specifies the time when an AS policy was executed. The time format complies with UTC. ExecuteTime string `json:"execute_time,omitempty"` // Specifies the ID of an AS policy execution log. Id string `json:"id,omitempty"` // Specifies the project ID. TenantId string `json:"tenant_id,omitempty"` // Specifies the AS policy ID. ScalingPolicyId string `json:"scaling_policy_id,omitempty"` // Specifies the scaling resource type. // AS group: SCALING_GROUP // Bandwidth: BANDWIDTH ScalingResourceType string `json:"scaling_resource_type,omitempty"` // Specifies the scaling resource ID. ScalingResourceId string `json:"scaling_resource_id,omitempty"` // Specifies the source value. OldValue string `json:"old_value,omitempty"` // Specifies the target value. DesireValue string `json:"desire_value,omitempty"` // Specifies the operation restrictions. // If scaling_resource_type is set to BANDWIDTH and operation is not SET, this parameter takes effect and the unit is Mbit/s. // In this case: // If operation is set to ADD, this parameter indicates the maximum bandwidth allowed. // If operation is set to REDUCE, this parameter indicates the minimum bandwidth allowed. LimitValue string `json:"limit_value,omitempty"` // Specifies the AS policy execution type. // ADD: indicates adding instances. // REMOVE: indicates reducing instances. // SET: indicates setting the number of instances to a specified value. Type string `json:"type,omitempty"` // Specifies the tasks contained in a scaling action based on an AS policy. JobRecords []JobRecords `json:"job_records,omitempty"` MetaData EipMetaData `json:"meta_data,omitempty"` }
type ScalingV1PolicyDetail ¶ added in v0.5.25
type ScalingV1PolicyDetail struct { // Specifies the AS group ID. ScalingGroupId string `json:"scaling_group_id,omitempty"` // Specifies the AS policy name. ScalingPolicyName string `json:"scaling_policy_name,omitempty"` // Specifies the AS policy ID. ScalingPolicyId string `json:"scaling_policy_id,omitempty"` // Specifies the AS policy status. // INSERVICE: The AS policy is enabled. // PAUSED: The AS policy is disabled. // EXECUTING: The AS policy is being executed. PolicyStatus string `json:"policy_status,omitempty"` // 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,omitempty"` // Specifies the alarm ID. AlarmId string `json:"alarm_id,omitempty"` // Specifies the periodic or scheduled AS policy. ScheduledPolicy ScheduledPolicy `json:"scheduled_policy,omitempty"` // Specifies the scaling action of the AS policy. ScalingPolicyAction ScalingPolicyActionV1 `json:"scaling_policy_action,omitempty"` // Specifies the cooldown period (s). CoolDownTime int32 `json:"cool_down_time,omitempty"` // Specifies the time when an AS policy was created. The time format complies with UTC. CreateTime string `json:"create_time,omitempty"` }
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 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 ScheduledPolicy ¶ added in v0.5.25
type ScheduledPolicy 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 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,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, 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. // 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"` }
Click to show internal directories.
Click to hide internal directories.