github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/identity/v3.0/acl/results.go (about)

     1  package acl
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  // ACLResult is response of the ACL policy for consloe or api access.
     8  type ACLResult struct {
     9  	golangsdk.Result
    10  }
    11  
    12  // ConsoleExtract interprets any acl results as a acl policy for console access.
    13  func (r ACLResult) ConsoleExtract() (*ACLPolicy, error) {
    14  	var s struct {
    15  		ACLPolicy *ACLPolicy `json:"console_acl_policy"`
    16  	}
    17  	err := r.ExtractInto(&s)
    18  	return s.ACLPolicy, err
    19  }
    20  
    21  // APIExtract interprets any acl results as a acl policy for api access.
    22  func (r ACLResult) APIExtract() (*ACLPolicy, error) {
    23  	var s struct {
    24  		ACLPolicy *ACLPolicy `json:"api_acl_policy"`
    25  	}
    26  	err := r.ExtractInto(&s)
    27  	return s.ACLPolicy, err
    28  }