github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/autoscaling/v2/logs/ListScalingActivityLogs.go (about) 1 package logs 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack/autoscaling/v1/groups" 7 ) 8 9 type ListScalingActivityLogsOpts struct { 10 ScalingGroupId string 11 // Specifies the scaling action log ID. 12 LogId string `q:"log_id,omitempty"` 13 // Specifies the start time that complies with UTC for querying scaling action logs. 14 // The format of the start time is yyyy-MM-ddThh:mm:ssZ. 15 StartTime string `q:"start_time,omitempty"` 16 // Specifies the end time that complies with UTC for querying scaling action logs. 17 // The format of the end time is yyyy-MM-ddThh:mm:ssZ. 18 EndTime string `q:"end_time,omitempty"` 19 // Specifies the start line number. The default value is 0. The minimum parameter value is 0. 20 StartNumber int32 `q:"start_number,omitempty"` 21 // Specifies the number of query records. The default value is 20. The value range is 0 to 100. 22 Limit int32 `q:"limit,omitempty"` 23 // Specifies the types of the scaling actions to be queried. Different types are separated by commas (,). 24 // 25 // NORMAL: indicates a common scaling action. 26 // MANUAL_REMOVE: indicates manually removing instances from an AS group. 27 // MANUAL_DELETE: indicates manually removing and deleting instances from an AS group. 28 // MANUAL_ADD: indicates manually adding instances to an AS group. 29 // ELB_CHECK_DELETE: indicates that instances are removed from an AS group and deleted based on the ELB health check result. 30 // AUDIT_CHECK_DELETE: indicates that instances are removed from an AS group and deleted based on the OpenStack audit. 31 // DIFF: indicates that the number of expected instances is different from the actual number of instances. 32 // MODIFY_ELB: indicates the load balancer migration. 33 Type string `q:"type,omitempty"` 34 // Specifies the status of the scaling action. 35 // 36 // SUCCESS: The scaling action has been performed. 37 // FAIL: Performing the scaling action failed. 38 // DOING: The scaling action is being performed. 39 Status string `q:"status,omitempty"` 40 } 41 42 func ListScalingActivityLogs(client *golangsdk.ServiceClient, opts ListScalingActivityLogsOpts) (*ListScalingActivityLogsResponse, error) { 43 url, err := golangsdk.NewURLBuilder().WithEndpoints("scaling_activity_log", opts.ScalingGroupId).WithQueryParams(&opts).Build() 44 if err != nil { 45 return nil, err 46 } 47 48 // GET /autoscaling-api/v2/{project_id}/scaling_activity_log/{scaling_group_id} 49 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 50 if err != nil { 51 return nil, err 52 } 53 54 var res ListScalingActivityLogsResponse 55 err = extract.Into(raw.Body, &res) 56 return &res, err 57 } 58 59 type ListScalingActivityLogsResponse struct { 60 TotalNumber int32 `json:"total_number,omitempty"` 61 StartNumber int32 `json:"start_number,omitempty"` 62 Limit int32 `json:"limit,omitempty"` 63 ScalingActivityLog []ScalingActivityLog `json:"scaling_activity_log,omitempty"` 64 } 65 66 type ScalingActivityLog struct { 67 // Specifies the status of the scaling action. 68 // 69 // SUCCESS: The scaling action has been performed. 70 // FAIL: Performing the scaling action failed. 71 // DOING: The scaling action is being performed. 72 Status string `json:"status,omitempty"` 73 // Specifies the start time of the scaling action. The time format must comply with UTC. 74 StartTime string `json:"start_time,omitempty"` 75 // Specifies the end time of the scaling action. The time format must comply with UTC. 76 EndTime string `json:"end_time,omitempty"` 77 // Specifies the scaling action log ID. 78 Id string `json:"id,omitempty"` 79 // Specifies names of the ECSs that are removed from the AS group in a scaling action. 80 InstanceRemovedList []ScalingInstance `json:"instance_removed_list,omitempty"` 81 // Specifies names of the ECSs that are removed from the AS group and deleted in a scaling action. 82 InstanceDeletedList []ScalingInstance `json:"instance_deleted_list,omitempty"` 83 // Specifies names of the ECSs that are added to the AS group in a scaling action. 84 InstanceAddedList []ScalingInstance `json:"instance_added_list,omitempty"` 85 // Specifies the ECSs for which a scaling action fails. 86 InstanceFailedList []ScalingInstance `json:"instance_failed_list,omitempty"` 87 // Specifies the ECSs that are set to standby mode or for which standby mode is canceled in a scaling action. 88 InstanceStandbyList []ScalingInstance `json:"instance_standby_list,omitempty"` 89 // Specifies the number of added or deleted instances during the scaling. 90 ScalingValue string `json:"scaling_value,omitempty"` 91 // Specifies the description of the scaling action. 92 Description string `json:"description,omitempty"` 93 // Specifies the number of instances in the AS group. 94 InstanceValue int32 `json:"instance_value,omitempty"` 95 // Specifies the expected number of instances for the scaling action. 96 DesireValue int32 `json:"desire_value,omitempty"` 97 // Specifies the load balancers that are bound to the AS group. 98 LbBindSuccessList []ModifyLb `json:"lb_bind_success_list,omitempty"` 99 // Specifies the load balancers that failed to be bound to the AS group. 100 LbBindFailedList []ModifyLb `json:"lb_bind_failed_list,omitempty"` 101 // Specifies the load balancers that are unbound from the AS group. 102 LbUnbindSuccessList []ModifyLb `json:"lb_unbind_success_list,omitempty"` 103 // Specifies the load balancers that failed to be unbound from the AS group. 104 LbUnbindFailedList []ModifyLb `json:"lb_unbind_failed_list,omitempty"` 105 // Specifies the type of the scaling action. 106 Type string `json:"type,omitempty"` 107 } 108 109 type ScalingInstance struct { 110 // Specifies the ECS name. 111 InstanceName string `json:"instance_name,omitempty"` 112 // Specifies the ECS ID. 113 InstanceId string `json:"instance_id,omitempty"` 114 // Specifies the cause of the instance scaling failure. 115 FailedReason string `json:"failed_reason,omitempty"` 116 // Specifies details of the instance scaling failure. 117 FailedDetails string `json:"failed_details,omitempty"` 118 // Specifies the information about instance configurations. 119 InstanceConfig string `json:"instance_config,omitempty"` 120 } 121 122 type ModifyLb struct { 123 // Specifies information about an enhanced load balancer. 124 LbaasListener groups.LBaaSListener `json:"lbaas_listener,omitempty"` 125 // Specifies information about a classic load balancer. 126 Listener string `json:"listener,omitempty"` 127 // Specifies the cause of a load balancer migration failure. 128 FailedReason string `json:"failed_reason,omitempty"` 129 // Specifies the details of a load balancer migration failure. 130 FailedDetails string `json:"failed_details,omitempty"` 131 }