github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/elb/v3/certificates/results.go (about) 1 package certificates 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/pagination" 6 ) 7 8 type Certificate struct { 9 ID string `json:"id"` 10 ProjectID string `json:"project_id"` 11 Name string `json:"name"` 12 Description string `json:"description"` 13 Type string `json:"type"` 14 Domain string `json:"domain"` 15 PrivateKey string `json:"private_key"` 16 Certificate string `json:"certificate"` 17 AdminStateUp bool `json:"admin_state_up"` 18 CreatedAt string `json:"created_at"` 19 UpdatedAt string `json:"updated_at"` 20 ExpireTime string `json:"expire_time"` 21 } 22 23 // CertificatePage is the page returned by a pager when traversing over a 24 // collection of certificates. 25 type CertificatePage struct { 26 pagination.SinglePageBase 27 } 28 29 // ExtractCertificates accepts a Page struct, specifically a CertificatePage struct, 30 // and extracts the elements into a slice of Certificate structs. In other words, 31 // a generic collection is mapped into a relevant slice. 32 func ExtractCertificates(r pagination.Page) ([]Certificate, error) { 33 var s []Certificate 34 err := (r.(CertificatePage)).ExtractIntoSlicePtr(&s, "certificates") 35 if err != nil { 36 return nil, err 37 } 38 return s, nil 39 } 40 41 type commonResult struct { 42 golangsdk.Result 43 } 44 45 func (r commonResult) Extract() (*Certificate, error) { 46 s := new(Certificate) 47 err := r.ExtractIntoStructPtr(s, "certificate") 48 if err != nil { 49 return nil, err 50 } 51 return s, nil 52 } 53 54 type CreateResult struct { 55 commonResult 56 } 57 58 // GetResult represents the result of a get operation. 59 type GetResult struct { 60 commonResult 61 } 62 63 type UpdateResult struct { 64 commonResult 65 } 66 67 // DeleteResult represents the result of a delete operation. 68 type DeleteResult struct { 69 golangsdk.ErrResult 70 }