// ProvisionerKey performs the request to the CA to get the encrypted key for
// the given provisioner kid and returns the api.ProvisionerKeyResponse struct
// with the encrypted key.
ProvisionerKey performs the request to the CA to get the encrypted key for
the given provisioner kid and returns the api.ProvisionerKeyResponse struct
with the encrypted key.
// ProvisionerKey performs the request to the CA to get the encrypted key for // the given provisioner kid and returns the api . ProvisionerKeyResponse struct // with the encrypted key .
func (c *Client) ProvisionerKey(kid string) (*api.ProvisionerKeyResponse, error) {
	var retried bool
	u := c.endpoint.ResolveReference(&url.URL{Path: "/provisioners/" + kid + "/encrypted-key"})
retry:
	resp, err := c.client.Get(u.String())
	if err != nil {
		return nil, errors.Wrapf(err, "client GET %s failed", u)
	}
	if resp.StatusCode >= 400 {
		if !retried && c.retryOnError(resp) {
			retried = true
			goto retry
		}
		return nil, readError(resp.Body)
	}
	var key api.ProvisionerKeyResponse
	if err := readJSON(resp.Body, &key); err != nil {
		return nil, errors.Wrapf(err, "error reading %s", u)
	}
	return &key, nil
}
func ( c * Client ) ProvisionerKey ( kid string ) ( * api . ProvisionerKeyResponse , error ) { var retried bool u := c . endpoint . ResolveReference ( & url . URL { Path : " " + kid + " " } ) retry : resp , err := c . client . Get ( u . String ( ) ) if err != nil { return nil , errors . Wrapf ( err , " " , u ) } if resp . StatusCode >= 400 { if ! retried && c . retryOnError ( resp ) { retried = true goto retry } return nil , readError ( resp . Body ) } var key api . ProvisionerKeyResponse if err := readJSON ( resp . Body , & key ) ; err != nil { return nil , errors . Wrapf ( err , " " , u ) } return & key , nil }
ProvisionerKey performs the request to the CA to get the encrypted key for
the given provisioner kid and returns the api.ProvisionerKeyResponse struct
with the encrypted key.
ProvisionerKey performs the request to the CA to get the encrypted key for the given provisioner kid and returns the api . ProvisionerKeyResponse struct with the encrypted key .