Documentation
¶
Index ¶
- func Create(client *golangsdk.ServiceClient, opts CreateOpts) (string, error)
- func Delete(client *golangsdk.ServiceClient, opts DeleteOpts) (err error)
- func Disable(client *golangsdk.ServiceClient, id string) error
- func Enable(client *golangsdk.ServiceClient, id string) error
- func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) (string, error)
- type ActionOpts
- type CreateOpts
- type DeleteOpts
- type Group
- type ID
- type LBaaSListener
- type ListOpts
- type ListScalingGroupsResponse
- type UpdateOpts
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, opts DeleteOpts) (err error)
Types ¶
type ActionOpts ¶
type ActionOpts struct {
Action string `json:"action" required:"true"`
}
type CreateOpts ¶
type CreateOpts struct {
// Specifies the AS group name. The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
Name string `json:"scaling_group_name" required:"true"`
// Specifies the AS configuration ID, which can be obtained using the API for querying AS configurations.
ConfigurationID string `json:"scaling_configuration_id,omitempty"`
// Specifies the expected number of instances. The default value is the minimum number of instances.
// The value ranges from the minimum number of instances to the maximum number of instances.
DesireInstanceNumber int `json:"desire_instance_number,omitempty"`
// Specifies the minimum number of instances. The default value is 0.
MinInstanceNumber int `json:"min_instance_number,omitempty"`
// Specifies the maximum number of instances. The default value is 0.
MaxInstanceNumber int `json:"max_instance_number,omitempty"`
// Specifies the cooldown period (in seconds). The value ranges from 0 to 86400 and is 300 by default.
// After a scaling action is triggered, the system starts the cooldown period. During the cooldown period,
// scaling actions triggered by alarms will be denied. Scheduled, periodic, and manual scaling actions are not affected..
CoolDownTime int `json:"cool_down_time,omitempty"`
// Specifies the ID of a classic load balancer listener. The system supports the binding of up to six
// load balancer listeners, the IDs of which are separated using a comma (,).
// This parameter is alternative to lbaas_listeners.
LBListenerID string `json:"lb_listener_id,omitempty"`
// Specifies information about an enhanced load balancer. The system supports the binding of up to six load balancers.
// This parameter is in list data structure.This parameter is alternative to lb_listener_id.
LBaaSListeners []LBaaSListener `json:"lbaas_listeners,omitempty"`
// Specifies the AZ information. The instances added in a scaling action will be created in a specified AZ.
// If you do not specify an AZ, the system automatically specifies one.
AvailableZones []string `json:"available_zones,omitempty"`
// Specifies network information. The system supports up to five subnets. The first subnet transferred
// serves as the primary NIC of the ECS by default. This parameter is in data structure.
Networks []ID `json:"networks" required:"true"`
// Specifies the security group information. A maximum of one security group can be selected. This parameter is in data structure.
// If the security group is specified both in the AS configuration and AS group,
// scaled ECS instances will be added to the security group specified in the AS configuration.
// If the security group is not specified in either of them, scaled ECS instances will be added to the default security group.
// For your convenience, you are advised to specify the security group in the AS configuration.
SecurityGroup []ID `json:"security_groups,omitempty"`
// Specifies the VPC ID, which can be obtained using the API for querying VPCs. For details,
// see "Querying VPCs" in Virtual Private Network API Reference.
VpcID string `json:"vpc_id" required:"true"`
// Specifies the health check method for instances in the AS group. The health check methods include ELB_AUDIT and NOVA_AUDIT.
// When load balancing is configured for an AS group, the default value is ELB_AUDIT. Otherwise, the default value is NOVA_AUDIT.
// ELB_AUDIT: indicates the ELB health check, which takes effect in an AS group with a listener.
// NOVA_AUDIT: indicates the ECS instance health check, which is the health check method delivered with AS.
HealthPeriodicAuditMethod string `json:"health_periodic_audit_method,omitempty"`
// Specifies the instance health check period. The value can be 1, 5, 15, 60, or 180 in the unit of minutes.
// If this parameter is not specified, the default value is 5.
// If the value is set to 0, health check is performed every 10 seconds.
HealthPeriodicAuditTime int `json:"health_periodic_audit_time,omitempty"`
// Specifies the grace period for instance health check. The unit is second and value range is 0-86400. The default value is 600.
// The health check grace period starts after an instance is added to an AS group and is enabled.
// The AS group will start checking the instance status only after the grace period ends.
// This parameter is valid only when the instance health check method of the AS group is ELB_AUDIT.
HealthPeriodicAuditGrace int `json:"health_periodic_audit_grace_period,omitempty"`
// Specifies the instance removal policy.
// OLD_CONFIG_OLD_INSTANCE (default): The earlier-created instances based on the earlier-created AS configurations are removed first.
// OLD_CONFIG_NEW_INSTANCE: The later-created instances based on the earlier-created AS configurations are removed first.
// OLD_INSTANCE: The earlier-created instances are removed first.
// NEW_INSTANCE: The later-created instances are removed first.
InstanceTerminatePolicy string `json:"instance_terminate_policy,omitempty"`
// Specifies the notification mode.
// EMAIL refers to notification by email.
Notifications []string `json:"notifications,omitempty"`
// Specifies whether to delete the EIP bound to the ECS when deleting the ECS.
// The value can be true or false. The default value is false.
// true: deletes the EIP bound to the ECS when deleting the ECS.
// false: only unbinds the EIP bound to the ECS when deleting the ECS.
IsDeletePublicip *bool `json:"delete_publicip,omitempty"`
// Specifies whether to delete the data disks attached to the ECS when deleting the ECS.
// The value can be true or false. The default value is false.
// true: deletes the data disks attached to the ECS when deleting the ECS.
// false: only detaches the data disks attached to the ECS when deleting the ECS.
IsDeleteVolume *bool `json:"delete_volume,omitempty"`
// Specifies the enterprise project ID, which is used to specify the enterprise project to which the AS group belongs.
// If the value is 0 or left blank, the AS group belongs to the default enterprise project.
// If the value is a UUID, the AS group belongs to the enterprise project corresponding to the UUID.
// If an enterprise project is configured for an AS group, ECSs created in this AS group also belong to this enterprise project.
// Otherwise, the default enterprise project will be used.
EnterpriseProjectID string `json:"enterprise_project_id,omitempty"`
// Specifies the priority policy used to select target AZs when adjusting the number of instances in an AS group.
// EQUILIBRIUM_DISTRIBUTE (default): When adjusting the number of instances,
// ensure that instances in each AZ in the available_zones list is evenly distributed.
// If instances cannot be added in the target AZ, select another AZ based on the PICK_FIRST policy.
// PICK_FIRST: When adjusting the number of instances, target AZs are determined in the order in the available_zones list.
MultiAZPriorityPolicy string `json:"multi_az_priority_policy,omitempty"`
// Specifies the description of the AS group. The value can contain 1 to 256 characters.
Description string `json:"description,omitempty"`
}
type DeleteOpts ¶ added in v0.5.25
type Group ¶
type Group struct {
// Specifies the name of the AS group.
Name string `json:"scaling_group_name"`
// Specifies the AS group ID.
ID string `json:"scaling_group_id"`
// Specifies the status of the AS group.
Status string `json:"scaling_group_status"`
// Specifies the AS configuration ID.
ConfigurationID string `json:"scaling_configuration_id"`
// Specifies the AS configuration name.
ConfigurationName string `json:"scaling_configuration_name"`
// Specifies the number of current instances in the AS group.
ActualInstanceNumber int `json:"current_instance_number"`
// Specifies the expected number of instances in the AS group.
DesireInstanceNumber int `json:"desire_instance_number"`
// Specifies the minimum number of instances in the AS group.
MinInstanceNumber int `json:"min_instance_number"`
// Specifies the maximum number of instances in the AS group.
MaxInstanceNumber int `json:"max_instance_number"`
// Specifies the cooldown period (s).
CoolDownTime int `json:"cool_down_time"`
// Specifies the ID of a typical ELB listener. ELB listener IDs are separated using a comma (,).
LBListenerID string `json:"lb_listener_id"`
// Specifies enhanced load balancers.
LBaaSListeners []LBaaSListener `json:"lbaas_listeners"`
// Specifies the AZ information.
AvailableZones []string `json:"available_zones"`
// Specifies the network information.
Networks []ID `json:"networks"`
// Specifies the security group information.
SecurityGroups []ID `json:"security_groups"`
// Specifies the time when an AS group was created. The time format complies with UTC.
CreateTime string `json:"create_time"`
// Specifies the ID of the VPC to which the AS group belongs.
VpcID string `json:"vpc_id"`
// Specifies details about the AS group. If a scaling action fails, this parameter is used to record errors.
Detail string `json:"detail"`
// Specifies the scaling flag of the AS group.
IsScaling bool `json:"is_scaling"`
// Specifies the health check method.
HealthPeriodicAuditMethod string `json:"health_periodic_audit_method"`
// Specifies the health check interval.
HealthPeriodicAuditTime int `json:"health_periodic_audit_time"`
// Specifies the grace period for health check.
HealthPeriodicAuditGrace int `json:"health_periodic_audit_grace_period"`
// Specifies the instance removal policy.
InstanceTerminatePolicy string `json:"instance_terminate_policy"`
// Specifies the notification mode.
// EMAIL refers to notification by email.
Notifications []string `json:"notifications"`
// Specifies whether to delete the EIP bound to the ECS when deleting the ECS.
DeletePublicIP bool `json:"delete_publicip"`
// Specifies whether to delete the data disks attached to the ECS when deleting the ECS.
DeleteVolume bool `json:"delete_volume"`
// This parameter is reserved.
CloudLocationID string `json:"cloud_location_id"`
// Specifies the enterprise project ID.
EnterpriseProjectID string `json:"enterprise_project_id"`
// Specifies the type of the AS action.
ActivityType string `json:"activity_type"`
// Specifies the priority policy used to select target AZs when adjusting the number of instances in an AS group.
MultiAZPriorityPolicy string `json:"multi_az_priority_policy"`
// Specifies the description of the AS group. The value can contain 1 to 256 characters.
Description string `json:"description"`
}
type LBaaSListener ¶
type LBaaSListener struct {
ListenerID string `json:"listener_id"`
// Specifies the backend ECS group ID.
PoolID string `json:"pool_id" required:"true"`
// Specifies the backend protocol ID, which is the port on which a backend ECS listens for traffic. The port ID ranges from 1 to 65535.
ProtocolPort int `json:"protocol_port" required:"true"`
// Specifies the weight, which determines the portion of requests a backend ECS processes
// when being compared to other backend ECSs added to the same listener. The value of this parameter ranges from 0 to 100.
Weight int `json:"weight" required:"true"`
}
type ListOpts ¶
type ListOpts struct {
// Specifies the AS group name.
// Supports fuzzy search.
Name string `q:"scaling_group_name"`
// Specifies the AS configuration ID, which can be obtained using the API for querying AS configurations.
ConfigurationID string `q:"scaling_configuration_id"`
// Specifies the AS group status. The options are as follows:
// INSERVICE: indicates that the AS group is functional.
// PAUSED: indicates that the AS group is paused.
// ERROR: indicates that the AS group malfunctions.
// DELETING: indicates that the AS group is being deleted.
Status string `q:"scaling_group_status"`
// Specifies the start line number. The default value is 0. The minimum value is 0, and there is no limit on the maximum value.
StartNumber int `q:"start_number"`
// Specifies the number of query records. The default value is 20. The value range is 0 to 100.
Limit int `q:"limit"`
// Specifies the enterprise project ID. If all_granted_eps is transferred,
// this API will query AS groups in the enterprise projects that you have permissions to.
EnterpriseProjectID string `q:"enterprise_project_id"`
}
type ListScalingGroupsResponse ¶ added in v0.5.25
type ListScalingGroupsResponse struct {
TotalNumber int32 `json:"total_number,omitempty"`
StartNumber int32 `json:"start_number,omitempty"`
Limit int32 `json:"limit,omitempty"`
ScalingGroups []Group `json:"scaling_groups,omitempty"`
}
func List ¶
func List(client *golangsdk.ServiceClient, opts ListOpts) (*ListScalingGroupsResponse, error)
type UpdateOpts ¶
type UpdateOpts struct {
// Specifies the AS group name. The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
Name string `json:"scaling_group_name,omitempty"`
// Specifies the expected number of instances.
// The value ranges from the minimum number of instances to the maximum number of instances.
DesireInstanceNumber int `json:"desire_instance_number"`
// Specifies the minimum number of instances.
MinInstanceNumber int `json:"min_instance_number"`
// Specifies the maximum number of instances, which is greater than or equal to the minimum number of instances.
MaxInstanceNumber int `json:"max_instance_number"`
// 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"`
// Specifies the ID of a classic load balancer listener.
// The system supports the binding of up to six load balancer listeners, the IDs of which are separated using a comma (,).
// The value of this parameter can be changed only when all the following conditions are met:
// No scaling actions are triggered in the AS group.
// The number of instances in the AS group is 0.
// The AS group is not in service.
LBListenerID string `json:"lb_listener_id,omitempty"`
// Specifies information about an enhanced load balancer. The system supports the binding of up to six load balancers.
// This parameter is in list data structure.
// This parameter is alternative to lb_listener_id.
LBaaSListeners []LBaaSListener `json:"lbaas_listeners,omitempty"`
// Specifies the AZ information. The instances added in a scaling action will be created in a specified AZ.
// If you do not specify an AZ, the system automatically specifies one.
// You can change the AZ of an AS group only when no scaling action is being performed in the group.
AvailableZones []string `json:"available_zones,omitempty"`
// Specifies network information. The system supports up to five subnets.
// The first subnet transferred serves as the primary NIC of the ECS by default. This parameter is in data structure.
// The value of this parameter can be changed only when all the following conditions are met:
// No scaling actions are triggered in the AS group.
// The number of instances in the AS group is 0.
// The AS group is not in service.
Networks []ID `json:"networks,omitempty"`
// Specifies the security group. A maximum of one security group can be selected. This parameter is in data structure.
// If the security group is specified both in the AS configuration and AS group,
// scaled ECS instances will be added to the security group specified in the AS configuration.
// If the security group is not specified in either of them, scaled ECS instances will be added to the default security group.
// For your convenience, you are advised to specify the security group in the AS configuration.
// The value of this parameter can be changed only when all the following conditions are met:
// No scaling actions are triggered in the AS group.
// The number of instances in the AS group is 0.
// The AS group is not in service.
SecurityGroup []ID `json:"security_groups"`
// Specifies the health check method for instances in the AS group. The health check methods include ELB_AUDIT and NOVA_AUDIT.
// When load balancing is configured for an AS group, the default value is ELB_AUDIT. Otherwise, the default value is NOVA_AUDIT.
// ELB_AUDIT: indicates the ELB health check, which takes effect in an AS group with a listener.
// NOVA_AUDIT: indicates the ECS health check, which is the health check method delivered with AS.
HealthPeriodicAuditMethod string `json:"health_periodic_audit_method,omitempty"`
// Specifies the health check period for the instances in the AS group. The value can be 1, 5, 15, 60, or 180 in the unit of minutes.
// If the value is set to 0, health check is performed every 10 seconds.
HealthPeriodicAuditTime int `json:"health_periodic_audit_time,omitempty"`
// Specifies the grace period for instance health check. The unit is second and value range is 0-86400. The default value is 600.
// The health check grace period starts after an instance is added to an AS group and is enabled.
// The AS group will start checking the instance status only after the grace period ends.
// This parameter is valid only when the instance health check method of the AS group is ELB_AUDIT.
HealthPeriodicAuditGrace int `json:"health_periodic_audit_grace_period,omitempty"`
// Specifies the instance removal policy.
// OLD_CONFIG_OLD_INSTANCE (default): The earlier-created instances based on the earlier-created AS configurations are removed first.
// OLD_CONFIG_NEW_INSTANCE: The later-created instances based on the earlier-created AS configurations are removed first.
// OLD_INSTANCE: The earlier-created instances are removed first.
// NEW_INSTANCE: The later-created instances are removed first.
InstanceTerminatePolicy string `json:"instance_terminate_policy,omitempty"`
// Specifies the notification mode.
// EMAIL refers to notification by email.
Notifications []string `json:"notifications,omitempty"`
// Specifies whether to delete the EIP bound to the ECS when deleting the ECS.
// If you do not want to delete the EIP, set this parameter to false.
// Then, the system only unbinds the EIP from the ECS and reserves the EIP.
// true: deletes the EIP bound to the ECS when deleting the ECS.
// false: only unbinds the EIP bound to the ECS when deleting the ECS.
IsDeletePublicip *bool `json:"delete_publicip,omitempty"`
// Specifies whether to delete the data disks attached to the ECS when deleting the ECS.
// The value can be true or false. The default value is false.
// true: deletes the data disks attached to the ECS when deleting the ECS.
// false: only detaches the data disks attached to the ECS when deleting the ECS.
IsDeleteVolume *bool `json:"delete_volume,omitempty"`
// Specifies the AS configuration ID, which can be obtained using the API for querying AS configurations.
ConfigurationID string `json:"scaling_configuration_id,omitempty"`
// Specifies the enterprise project ID, which is used to specify the enterprise project to which the AS group belongs.
// If the value is 0 or left blank, the AS group belongs to the default enterprise project.
// If the value is a UUID, the AS group belongs to the enterprise project corresponding to the UUID.
// If an enterprise project is configured for an AS group, ECSs created in this AS group also belong to this enterprise project.
// Otherwise, the default enterprise project will be used.
EnterpriseProjectID string `json:"enterprise_project_id,omitempty"`
// Specifies the priority policy used to select target AZs when adjusting the number of instances in an AS group.
// EQUILIBRIUM_DISTRIBUTE (default): When adjusting the number of instances,
// ensure that instances in each AZ in the available_zones list is evenly distributed.
// If instances cannot be added in the target AZ, select another AZ based on the PICK_FIRST policy.
// PICK_FIRST: When adjusting the number of instances, target AZs are determined in the order in the available_zones list.
MultiAZPriorityPolicy string `json:"multi_az_priority_policy,omitempty"`
// Specifies the description of the AS group. The value can contain 1 to 256 characters.
Description string `json:"description,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.