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

     1  package agency
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/openstack/identity/v3/roles"
     6  )
     7  
     8  type Agency struct {
     9  	ID                  string `json:"id"`
    10  	Name                string `json:"name"`
    11  	DomainID            string `json:"domain_id"`
    12  	DelegatedDomainID   string `json:"trust_domain_id"`
    13  	DelegatedDomainName string `json:"trust_domain_name"`
    14  	Description         string `json:"description"`
    15  	Duration            string `json:"duration"`
    16  	ExpireTime          string `json:"expire_time"`
    17  	CreateTime          string `json:"create_time"`
    18  }
    19  
    20  type commonResult struct {
    21  	golangsdk.Result
    22  }
    23  
    24  func (r commonResult) Extract() (*Agency, error) {
    25  	var s struct {
    26  		Agency *Agency `json:"agency"`
    27  	}
    28  	err := r.ExtractInto(&s)
    29  	return s.Agency, err
    30  }
    31  
    32  type GetResult struct {
    33  	commonResult
    34  }
    35  
    36  type CreateResult struct {
    37  	commonResult
    38  }
    39  
    40  type UpdateResult struct {
    41  	commonResult
    42  }
    43  
    44  type ErrResult struct {
    45  	golangsdk.ErrResult
    46  }
    47  
    48  type ListRolesResult struct {
    49  	golangsdk.Result
    50  }
    51  
    52  func (r ListRolesResult) ExtractRoles() ([]roles.Role, error) {
    53  	var s struct {
    54  		Roles []roles.Role `json:"roles"`
    55  	}
    56  	err := r.ExtractInto(&s)
    57  	return s.Roles, err
    58  }