github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/css/v1/clusters/DownloadCertificate.go (about)

     1  package clusters
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func DownloadCertificate(client *golangsdk.ServiceClient, clusterID string) (string, error) {
     9  	raw, err := client.Get(client.ServiceURL("clusters", clusterID, "sslCert"), nil, nil)
    10  	if err != nil {
    11  		return "", err
    12  	}
    13  
    14  	var res struct {
    15  		CertBase64 string `json:"certBase64"`
    16  	}
    17  	err = extract.Into(raw.Body, &res)
    18  	return res.CertBase64, err
    19  }