github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf-premium/v1/certificates/Get.go (about)

     1  package certificates
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func Get(client *golangsdk.ServiceClient, id string) (*Certificate, error) {
     9  	// GET /v1/{project_id}/waf/certificate/{certificate_id}
    10  	raw, err := client.Get(client.ServiceURL("waf", "certificate", id), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res Certificate
    16  	return &res, extract.Into(raw.Body, &res)
    17  }
    18  
    19  type Certificate struct {
    20  	// Certificate ID.
    21  	ID string `json:"id"`
    22  	// Certificate name.
    23  	Name string `json:"name"`
    24  	// Certificate file in PEM format.
    25  	Content string `json:"content"`
    26  	// Private key of the certificate in PEM format.
    27  	Key string `json:"key"`
    28  	// Timestamp when the certificate expire.
    29  	ExpireAt int64 `json:"expire_time"`
    30  	// Timestamp when the certificate is uploaded.
    31  	CreatedAt int64 `json:"timestamp"`
    32  	// Domain name associated with the certificate.
    33  	// This parameter is returned to the response body only when the value of host in the URL request is true.
    34  	BoundHosts []Hosts `json:"bind_host"`
    35  }
    36  
    37  type Hosts struct {
    38  	// Domain name ID.
    39  	// It is the unique identifier generated by WAF for a domain name when you add the domain name to WAF.
    40  	ID string `json:"id"`
    41  	// Domain name.
    42  	Hostname string `json:"hostname"`
    43  	// WAF mode of the domain name. The value is premium.
    44  	WafType string `json:"waf_type"`
    45  }