github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/elb/v2/certificates/request.go (about) 1 /* 2 Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. 3 */ 4 5 package certificates 6 7 import ( 8 "github.com/huaweicloud/golangsdk" 9 ) 10 11 // ListOptsBuilder allows extensions to add additional parameters to the 12 // List request. 13 type ListOptsBuilder interface { 14 ToCertificateListQuery() (string, error) 15 } 16 17 // ListOpts parameters used to query the certificate. 18 type ListOpts struct { 19 // Specifies the ID of the certificate from which pagination query starts, that is, 20 // the ID of the last certificate on the previous page. This parameter must be used with limit. 21 Marker string `q:"marker"` 22 // Specifies the number of certificates on each page. 23 // If this parameter is not set, all certificates are queried by default. 24 Limit int `q:"limit"` 25 // Specifies the page direction. The value can be true or false, and the default value is false. 26 // This parameter must be used with limit. 27 PageReverse *bool `q:"page_reverse"` 28 // Specifies the certificate ID. 29 Id string `q:"id"` 30 // Specifies the certificate name. 31 // The value contains a maximum of 255 characters. 32 Name string `q:"name"` 33 // Provides supplementary information about the certificate. 34 // The value contains a maximum of 255 characters. 35 Description string `q:"description"` 36 // Specifies the certificate type. The default value is server. 37 // The value range varies depending on the protocol of the backend server group: 38 // server: indicates the server certificate. 39 // client: indicates the CA certificate. 40 Type string `q:"type"` 41 // Specifies the domain name associated with the server certificate. The default value is null. 42 Domain string `q:"domain"` 43 // Specifies the private key of the server certificate. 44 PrivateKey string `q:"private_key"` 45 // Specifies the public key of the server certificate or CA certificate used to authenticate the client. 46 Certificate string `q:"certificate"` 47 // Specifies the time when the certificate was created. 48 // The UTC time is in YYYY-MM-DD HH:MM:SS format. 49 CreateTime string `q:"create_time"` 50 // Specifies the time when the certificate was updated. 51 // The UTC time is in YYYY-MM-DD HH:MM:SS format. 52 UpdateTime string `q:"update_time"` 53 } 54 55 // ToCertificateListQuery formats a ListOpts into a query string. 56 func (opts ListOpts) ToCertificateListQuery() (string, error) { 57 q, err := golangsdk.BuildQueryString(opts) 58 return q.String(), err 59 } 60 61 // List query the certificate list 62 func List(c *golangsdk.ServiceClient, opts ListOptsBuilder) (ListResult, error) { 63 var r ListResult 64 var err error 65 url := rootURL(c) 66 if opts != nil { 67 query, err := opts.ToCertificateListQuery() 68 if err != nil { 69 return r, err 70 } 71 url += query 72 } 73 _, r.Err = c.Get(url, &r.Body, nil) 74 return r, err 75 }