github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/identity/v3.0/eps_permissions/results.go (about)

     1  package eps_permissions
     2  
     3  import (
     4  	"github.com/chnsz/golangsdk"
     5  )
     6  
     7  // CommonResult is used to accept error.
     8  type CommonResult struct {
     9  	golangsdk.ErrResult
    10  }
    11  
    12  type RoleResult struct {
    13  	golangsdk.Result
    14  }
    15  
    16  type Role struct {
    17  	ID          string `json:"id"`
    18  	Name        string `json:"display_name"`
    19  	Catalog     string `json:"catalog"`
    20  	Description string `json:"description"`
    21  	Type        string `json:"type"`
    22  	Policy      Policy `json:"policy"`
    23  	DomainId    string `json:"domain_id"`
    24  	References  int    `json:"references"`
    25  }
    26  
    27  type Policy struct {
    28  	Version   string      `json:"Version"`
    29  	Statement []Statement `json:"Statement"`
    30  }
    31  
    32  type Statement struct {
    33  	Action    []string               `json:"Action"`
    34  	Effect    string                 `json:"Effect"`
    35  	Condition map[string]interface{} `json:"Condition"`
    36  	Resource  interface{}            `json:"Resource"`
    37  }
    38  
    39  func (r RoleResult) Extract() ([]Role, error) {
    40  	var s struct {
    41  		Roles []Role `json:"roles"`
    42  	}
    43  	err := r.ExtractInto(&s)
    44  	return s.Roles, err
    45  }