github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/identity/v3.0/security/UpdateOperationProtectionPolicy.go (about) 1 package security 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 7 ) 8 9 type UpdateProtectionPolicyOpts struct { 10 // Indicates whether operation protection has been enabled. The value can be true or false. 11 OperationProtection *bool `json:"operation_protection"` 12 } 13 14 func UpdateOperationProtectionPolicy(client *golangsdk.ServiceClient, id string, opts UpdateProtectionPolicyOpts) (*ProtectionPolicy, error) { 15 b, err := build.RequestBody(opts, "protect_policy") 16 if err != nil { 17 return nil, err 18 } 19 20 // PUT /v3.0/OS-SECURITYPOLICY/domains/{domain_id}/protect-policy 21 raw, err := client.Put(client.ServiceURL("OS-SECURITYPOLICY", "domains", id, "protect-policy"), b, nil, &golangsdk.RequestOpts{ 22 OkCodes: []int{200}, 23 }) 24 if err != nil { 25 return nil, err 26 } 27 28 var res ProtectionPolicy 29 return &res, extract.IntoStructPtr(raw.Body, &res, "protect_policy") 30 }