github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/identity/v3.0/credentials/results.go (about) 1 package credentials 2 3 import "github.com/huaweicloud/golangsdk" 4 5 type Credential struct { 6 // IAM user ID 7 UserID string `json:"user_id"` 8 9 // Description of the access key 10 Description string `json:"description"` 11 12 // AK 13 AccessKey string `json:"access"` 14 15 // SK, returned only during creation 16 SecretKey string `json:"secret,omitempty"` 17 18 // Status of the access key, active/inactive 19 Status string `json:"status"` 20 21 // Time when the access key was created 22 CreateTime string `json:"create_time"` 23 24 // Time when the access key was last used 25 LastUseTime string `json:"last_use_time,omitempty"` 26 } 27 28 type credentialResult struct { 29 golangsdk.Result 30 } 31 32 // CreateResult is the response of a Create operations. Call its Extract method to 33 // interpret it as a Credential. 34 type CreateResult struct { 35 credentialResult 36 } 37 38 // Extract provides access to the Credential returned by the Get and 39 // Create functions. 40 func (r credentialResult) Extract() (*Credential, error) { 41 var s struct { 42 Credential *Credential `json:"credential"` 43 } 44 err := r.ExtractInto(&s) 45 return s.Credential, err 46 } 47 48 // GetResult is the response of a Get operations. Call its Extract method to 49 // interpret it as a Credential. 50 type GetResult struct { 51 credentialResult 52 } 53 54 // UpdateResult is the response from an Update operation. Call its Extract 55 // method to interpret it as a Credential. 56 type UpdateResult struct { 57 credentialResult 58 } 59 60 type ListResult struct { 61 golangsdk.Result 62 } 63 64 func (lr ListResult) Extract() ([]Credential, error) { 65 var a struct { 66 Instances []Credential `json:"credentials"` 67 } 68 err := lr.Result.ExtractInto(&a) 69 return a.Instances, err 70 } 71 72 // DeleteResult is the response from a Delete operation. Call its ExtractErr to 73 // determine if the request succeeded or failed. 74 type DeleteResult struct { 75 golangsdk.ErrResult 76 }