// SSHRekey performs the POST /ssh/rekey request to the CA and returns the
// api.SSHRekeyResponse struct.
SSHRekey performs the POST /ssh/rekey request to the CA and returns the
api.SSHRekeyResponse struct.
// SSHRekey performs the POST / ssh / rekey request to the CA and returns the // api . SSHRekeyResponse struct .
func (c *Client) SSHRekey(req *api.SSHRekeyRequest) (*api.SSHRekeyResponse, error) {
	var retried bool
	body, err := json.Marshal(req)
	if err != nil {
		return nil, errors.Wrap(err, "error marshaling request")
	}
	u := c.endpoint.ResolveReference(&url.URL{Path: "/ssh/rekey"})
retry:
	resp, err := c.client.Post(u.String(), "application/json", bytes.NewReader(body))
	if err != nil {
		return nil, errors.Wrapf(err, "client POST %s failed", u)
	}
	if resp.StatusCode >= 400 {
		if !retried && c.retryOnError(resp) {
			retried = true
			goto retry
		}
		return nil, readError(resp.Body)
	}
	var rekey api.SSHRekeyResponse
	if err := readJSON(resp.Body, &rekey); err != nil {
		return nil, errors.Wrapf(err, "error reading %s", u)
	}
	return &rekey, nil
}
func ( c * Client ) SSHRekey ( req * api . SSHRekeyRequest ) ( * api . SSHRekeyResponse , error ) { var retried bool body , err := json . Marshal ( req ) if err != nil { return nil , errors . Wrap ( err , " " ) } u := c . endpoint . ResolveReference ( & url . URL { Path : " " } ) retry : resp , err := c . client . Post ( u . String ( ) , " " , bytes . NewReader ( body ) ) 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 rekey api . SSHRekeyResponse if err := readJSON ( resp . Body , & rekey ) ; err != nil { return nil , errors . Wrapf ( err , " " , u ) } return & rekey , nil }
SSHRekey performs the POST /ssh/rekey request to the CA and returns the
api.SSHRekeyResponse struct.
SSHRekey performs the POST / ssh / rekey request to the CA and returns the api . SSHRekeyResponse struct .