github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/networking/v2/extensions/lbaas_v2/certificates/results.go (about)

     1  package certificates
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/pagination"
     6  )
     7  
     8  type Certificate struct {
     9  	ID           string `json:"id"`
    10  	TenantID     string `json:"tenant_id"`
    11  	AdminStateUp bool   `json:"admin_state_up"`
    12  	Name         string `json:"name"`
    13  	Description  string `json:"description"`
    14  	Type         string `json:"type"`
    15  	Domain       string `json:"domain"`
    16  	PrivateKey   string `json:"private_key"`
    17  	Certificate  string `json:"certificate"`
    18  	ExpireTime   string `json:"expire_time"`
    19  	CreateTime   string `json:"create_time"`
    20  	UpdateTime   string `json:"update_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 struct {
    34  		Certificates []Certificate `json:"certificates"`
    35  	}
    36  	err := (r.(CertificatePage)).ExtractInto(&s)
    37  	return s.Certificates, err
    38  }
    39  
    40  type commonResult struct {
    41  	golangsdk.Result
    42  }
    43  
    44  func (r commonResult) Extract() (*Certificate, error) {
    45  	s := &Certificate{}
    46  	return s, r.ExtractInto(s)
    47  }
    48  
    49  type CreateResult struct {
    50  	commonResult
    51  }
    52  
    53  // GetResult represents the result of a get operation.
    54  type GetResult struct {
    55  	commonResult
    56  }
    57  
    58  type UpdateResult struct {
    59  	commonResult
    60  }
    61  
    62  // DeleteResult represents the result of a delete operation.
    63  type DeleteResult struct {
    64  	golangsdk.ErrResult
    65  }