github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf-premium/v1/hosts/UpdateProtectStatus.go (about) 1 package hosts 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type ProtectUpdateOpts struct { 9 // WAF status of the protected domain name. 10 // 0: The WAF protection is suspended. 11 // WAF only forwards requests destined for the domain name and does not detect attacks. 12 // 1: The WAF protection is enabled. WAF detects attacks based on the policy you configure. 13 ProtectStatus int `json:"protect_status"` 14 } 15 16 func UpdateProtectStatus(client *golangsdk.ServiceClient, id string, opts ProtectUpdateOpts) (err error) { 17 b, err := build.RequestBody(opts, "") 18 if err != nil { 19 return 20 } 21 22 // PUT /v1/{project_id}/premium-waf/host/{id}/protect_status 23 _, err = client.Put(client.ServiceURL("premium-waf", "host", id, "protect_status"), b, nil, &golangsdk.RequestOpts{ 24 OkCodes: []int{200}, 25 MoreHeaders: map[string]string{"Content-Type": "application/json;charset=utf8"}, 26 }) 27 return 28 }