Documentation
¶
Overview ¶
Package certificates contains functionality for working with ECL Managed Load Balancer resources.
Example to list certificates
listOpts := certificates.ListOpts{} allPages, err := certificates.List(managedLoadBalancerClient, listOpts).AllPages() if err != nil { panic(err) } allCertificates, err := certificates.ExtractCertificates(allPages) if err != nil { panic(err) } for _, certificate := range allCertificates { fmt.Printf("%+v\n", certificate) }
Example to create a certificate
var tags map[string]interface{} tagsJson := `{"key":"value"}` err := json.Unmarshal([]byte(tagsJson), &tags) if err != nil { panic(err) } createOpts := certificates.CreateOpts{ Name: "certificate", Description: "description", Tags: tags, } certificate, err := certificates.Create(managedLoadBalancerClient, createOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", certificate)
Example to show a certificate
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" certificate, err := certificates.Show(managedLoadBalancerClient, id).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", certificate)
Example to update a certificate
name := "certificate" description := "description" var tags map[string]interface{} tagsJson := `{"key":"value"}` err := json.Unmarshal([]byte(tagsJson), &tags) if err != nil { panic(err) } updateOpts := certificates.UpdateOpts{ Name: &name, Description: &description, Tags: &tags, } id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" certificate, err := certificates.Update(managedLoadBalancerClient, updateOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", certificate)
Example to delete a certificate
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" err := certificates.Delete(managedLoadBalancerClient, id).ExtractErr() if err != nil { panic(err) }
Example to upload a certificate file
uploadFileOpts := certificates.UploadFileOpts{ Type: "ca-cert", Content: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCjAxMjM0NTY3ODlBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEKMjM0NTY3ODlBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMwo0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UpLTE1OT1BRUgpTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUClVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVYKV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWApZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaCmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWIKY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZAplZmdoaWprbG1ub3BxcnN0dXZ3eHl6VjAxMjM0NTY3ODlBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlCmZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==", } id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" certificateFile, err := certificates.UploadFile(managedLoadBalancerClient, id, uploadFileOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", certificateFile)
Index ¶
- func ExtractCertificatesInto(r pagination.Page, v interface{}) error
- func List(c *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type Certificate
- type CertificatePage
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type FileInResponse
- type ListOpts
- type ListOptsBuilder
- type ShowResult
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
- type UploadFileOpts
- type UploadFileOptsBuilder
- type UploadFileResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractCertificatesInto ¶
func ExtractCertificatesInto(r pagination.Page, v interface{}) error
ExtractCertificatesInto interprets the results of a single page from a List() call, producing a slice of certificate entities.
func List ¶
func List(c *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of certificates. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.
Types ¶
type Certificate ¶
type Certificate struct { // - ID of the certificate ID string `json:"id"` // - Name of the certificate Name string `json:"name"` // - Description of the certificate Description string `json:"description"` // - Tags of the certificate (JSON object format) Tags map[string]interface{} `json:"tags"` // - ID of the owner tenant of the certificate TenantID string `json:"tenant_id"` // - CA certificate file of the certificate CACert FileInResponse `json:"ca_cert"` // - SSL certificate file of the certificate SSLCert FileInResponse `json:"ssl_cert"` // - SSL key file of the certificate SSLKey FileInResponse `json:"ssl_key"` }
Certificate represents a certificate.
func ExtractCertificates ¶
func ExtractCertificates(r pagination.Page) ([]Certificate, error)
ExtractCertificates accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of Certificate structs. In other words, a generic collection is mapped into a relevant slice.
type CertificatePage ¶
type CertificatePage struct {
pagination.LinkedPageBase
}
CertificatePage is the page returned by a pager when traversing over a collection of certificate.
func (CertificatePage) IsEmpty ¶
func (r CertificatePage) IsEmpty() (bool, error)
IsEmpty checks whether a CertificatePage struct is empty.
type CreateOpts ¶
type CreateOpts struct { // - Name of the certificate // - This field accepts single-byte characters only Name string `json:"name,omitempty"` // - Description of the certificate // - This field accepts single-byte characters only Description string `json:"description,omitempty"` // - Tags of the certificate // - Set JSON object up to 32,768 characters // - Nested structure is permitted // - This field accepts single-byte characters only Tags map[string]interface{} `json:"tags,omitempty"` }
CreateOpts represents options used to create a new certificate.
func (CreateOpts) ToCertificateCreateMap ¶
func (opts CreateOpts) ToCertificateCreateMap() (map[string]interface{}, error)
ToCertificateCreateMap builds a request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a Create operation. Call its Extract method to interpret it as a Certificate.
func Create ¶
func Create(c *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and creates a new certificate using the values provided.
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*Certificate, error)
Extract is a function that accepts a result and extracts a Certificate resource.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a certificate, if possible.
type DeleteResult ¶
type DeleteResult struct {
eclcloud.ErrResult
}
DeleteResult represents the result of a Delete operation. Call its ExtractErr method to determine if the request succeeded or failed.
func Delete ¶
func Delete(c *eclcloud.ServiceClient, id string) (r DeleteResult)
Delete accepts a unique ID and deletes the certificate associated with it.
type FileInResponse ¶
type FileInResponse struct { // - File upload status of the certificate Status string `json:"status"` }
FileInResponse represents a file in a certificate.
type ListOpts ¶
type ListOpts struct { // - ID of the resource ID string `q:"id"` // - Name of the resource // - This field accepts single-byte characters only Name string `q:"name"` // - Description of the resource // - This field accepts single-byte characters only Description string `q:"description"` // - ID of the owner tenant of the resource TenantID string `q:"tenant_id"` // - CA certificate file upload status of the certificate CACertStatus string `q:"ca_cert_status"` // - SSL certificate file upload status of the certificate SSLCertStatus string `q:"ssl_cert_status"` // - SSL key file upload status of the certificate SSLKeyStatus string `q:"ssl_key_status"` }
ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the certificate attributes you want to see returned.
func (ListOpts) ToCertificateListQuery ¶
ToCertificateListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type ShowResult ¶
type ShowResult struct {
// contains filtered or unexported fields
}
ShowResult represents the result of a Show operation. Call its Extract method to interpret it as a Certificate.
func Show ¶
func Show(c *eclcloud.ServiceClient, id string) (r ShowResult)
Show retrieves a specific certificate based on its unique ID.
func (ShowResult) Extract ¶
func (r ShowResult) Extract() (*Certificate, error)
Extract is a function that accepts a result and extracts a Certificate resource.
func (ShowResult) ExtractInto ¶
func (r ShowResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a certificate, if possible.
type UpdateOpts ¶
type UpdateOpts struct { // - Name of the certificate // - This field accepts single-byte characters only Name *string `json:"name,omitempty"` // - Description of the certificate // - This field accepts single-byte characters only Description *string `json:"description,omitempty"` // - Tags of the certificate // - Set JSON object up to 32,768 characters // - Nested structure is permitted // - This field accepts single-byte characters only Tags *map[string]interface{} `json:"tags,omitempty"` }
UpdateOpts represents options used to update a existing certificate.
func (UpdateOpts) ToCertificateUpdateMap ¶
func (opts UpdateOpts) ToCertificateUpdateMap() (map[string]interface{}, error)
ToCertificateUpdateMap builds a request body from UpdateOpts.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of a Update operation. Call its Extract method to interpret it as a Certificate.
func Update ¶
func Update(c *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates a existing certificate using the values provided.
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*Certificate, error)
Extract is a function that accepts a result and extracts a Certificate resource.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a certificate, if possible.
type UploadFileOpts ¶
type UploadFileOpts struct { // - Type of the certificate file to be uploaded // - Can be uploaded only once for each type Type string `json:"type"` // - Content of the certificate file to be uploaded // - Content must be Base64 encoded // - The file size before encoding must be less than or equal to 16KB // - The file format before encoding must be PEM // - DER can be converted to PEM by using OpenSSL command Content string `json:"content"` }
UploadFileOpts represents options used to upload a file to a existing certificate.
func (UploadFileOpts) ToCertificateUploadFileMap ¶
func (opts UploadFileOpts) ToCertificateUploadFileMap() (map[string]interface{}, error)
ToCertificateUploadFileMap builds a request body from UploadFileOpts.
type UploadFileOptsBuilder ¶
type UploadFileOptsBuilder interface {
ToCertificateUploadFileMap() (map[string]interface{}, error)
}
UploadFileOptsBuilder allows extensions to add additional parameters to the UploadFile request.
type UploadFileResult ¶
type UploadFileResult struct {
eclcloud.ErrResult
}
UploadFileResult represents the result of a UploadFile operation. Call its ExtractErr method to determine if the request succeeded or failed.
func UploadFile ¶
func UploadFile(c *eclcloud.ServiceClient, id string, opts UploadFileOptsBuilder) (r UploadFileResult)
UploadFile accepts a UploadFileOpts struct and uploads a file to a existing certificate using the values provided.