github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/identity/v3.0/security/GetOperationProtectionPolicy.go (about)

     1  package security
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  type ProtectionPolicy struct {
     9  	// Indicates whether operation protection has been enabled. The value can be true or false.
    10  	OperationProtection *bool `json:"operation_protection" required:"true"`
    11  }
    12  
    13  func GetOperationProtectionPolicy(client *golangsdk.ServiceClient, id string) (*ProtectionPolicy, error) {
    14  	// GET /v3.0/OS-SECURITYPOLICY/domains/{domain_id}/protect-policy
    15  	raw, err := client.Get(client.ServiceURL("OS-SECURITYPOLICY", "domains", id, "protect-policy"), nil, nil)
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	var res ProtectionPolicy
    21  	err = extract.IntoStructPtr(raw.Body, &res, "protect_policy")
    22  	return &res, err
    23  }