github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/kms/v1/grants/results.go (about)

     1  package grants
     2  
     3  import golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     4  
     5  type CreateGrant struct {
     6  	GrantID string `json:"grant_id"`
     7  }
     8  
     9  type ListGrant struct {
    10  	Grants     []Grant `json:"grants"`
    11  	NextMarker string  `json:"next_marker"`
    12  	Truncated  string  `json:"truncated"`
    13  	Total      int     `json:"total"`
    14  }
    15  
    16  type Grant struct {
    17  	KeyID             string   `json:"key_id"`
    18  	GrantID           string   `json:"grant_id"`
    19  	GranteePrincipal  string   `json:"grantee_principal"`
    20  	Operations        []string `json:"operations"`
    21  	IssuingPrincipal  string   `json:"issuing_principal"`
    22  	CreationDate      string   `json:"creation_date"`
    23  	Name              string   `json:"name"`
    24  	RetiringPrincipal string   `json:"retiring_principal"`
    25  }
    26  
    27  // CreateResult contains the response body and error from a Create request.
    28  type CreateResult struct {
    29  	golangsdk.Result
    30  }
    31  
    32  func (r CreateResult) Extract() (*CreateGrant, error) {
    33  	s := new(CreateGrant)
    34  	err := r.ExtractInto(s)
    35  	if err != nil {
    36  		return nil, err
    37  	}
    38  	return s, nil
    39  }
    40  
    41  type DeleteResult struct {
    42  	golangsdk.ErrResult
    43  }
    44  
    45  type ListResult struct {
    46  	golangsdk.Result
    47  }
    48  
    49  func (r ListResult) Extract() (*ListGrant, error) {
    50  	s := new(ListGrant)
    51  	err := r.ExtractInto(&s)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  	return s, nil
    56  }