github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/autoscaling/v1/policies/batch_action.go (about) 1 package policies 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type BatchOpts struct { 9 ScalingPolicyId []string `json:"scaling_policy_id" required:"true"` 10 // Specifies an action to be performed on AS policies in batches. The options are as follows: 11 // delete: deletes AS policies. 12 // resume: enables AS policies. 13 // pause: disables AS policies. 14 Action string `json:"action" required:"true"` 15 // Specifies whether to forcibly delete an AS policy. If the value is set to no, in-progress AS policies cannot be deleted. 16 // Options: 17 // no (default): indicates that the AS policy is not forcibly deleted. 18 // yes: indicates that the AS policy is forcibly deleted. 19 // This parameter is available only when action is set to delete. 20 ForceDelete string `json:"force_delete,omitempty"` 21 // Specifies whether to delete the alarm rule used by the alarm policy. The value can be yes or no (default). 22 // This parameter is available only when action is set to delete. 23 DeleteAlarm string `json:"delete_alarm,omitempty"` 24 } 25 26 func BatchAction(client *golangsdk.ServiceClient, opts BatchOpts) (err error) { 27 b, err := build.RequestBody(opts, "") 28 if err != nil { 29 return 30 } 31 32 // POST /autoscaling-api/v1/{project_id}/scaling_policies/action 33 _, err = client.Post(client.ServiceURL("scaling_policies", "action"), b, nil, &golangsdk.RequestOpts{ 34 OkCodes: []int{204}, 35 }) 36 37 return 38 }