github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/autoscaling/v1/policies/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 ActionOpts struct { 9 ScalingPolicyId string 10 // Specifies the operation for an AS policy. 11 // execute: immediately executes the AS policy. 12 // resume: enables the AS group. 13 // pause: disables the AS group. 14 Action string `json:"action"` 15 } 16 17 func PolicyAction(client *golangsdk.ServiceClient, opts ActionOpts) (err error) { 18 b, err := build.RequestBody(opts, "") 19 if err != nil { 20 return 21 } 22 23 // POST /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}/action 24 _, err = client.Post(client.ServiceURL("scaling_policy", opts.ScalingPolicyId, "action"), b, nil, &golangsdk.RequestOpts{ 25 OkCodes: []int{204}, 26 }) 27 28 return 29 }