// Sign performs the sign request to the CA and returns the api.SignResponse
// struct.
Sign performs the sign request to the CA and returns the api.SignResponse
struct.
// Sign performs the sign request to the CA and returns the api . SignResponse // struct .
func (c *Client) Sign(req *api.SignRequest) (*api.SignResponse, error) {
	var retried bool
	body, err := json.Marshal(req)
	if err != nil {
		return nil, errs.Wrap(http.StatusInternalServerError, err, "client.Sign; error marshaling request")
	}
	u := c.endpoint.ResolveReference(&url.URL{Path: "/sign"})
retry:
	resp, err := c.client.Post(u.String(), "application/json", bytes.NewReader(body))
	if err != nil {
		return nil, errs.Wrapf(http.StatusInternalServerError, err, "client.Sign; client POST %s failed", u)
	}
	if resp.StatusCode >= 400 {
		if !retried && c.retryOnError(resp) {
			retried = true
			goto retry
		}
		return nil, readError(resp.Body)
	}
	var sign api.SignResponse
	if err := readJSON(resp.Body, &sign); err != nil {
		return nil, errs.Wrapf(http.StatusInternalServerError, err, "client.Sign; error reading %s", u)
	}
	sign.TLS = resp.TLS
	return &sign, nil
}
func ( c * Client ) Sign ( req * api . SignRequest ) ( * api . SignResponse , error ) { var retried bool body , err := json . Marshal ( req ) if err != nil { return nil , errs . Wrap ( http . StatusInternalServerError , err , " " ) } u := c . endpoint . ResolveReference ( & url . URL { Path : " " } ) retry : resp , err := c . client . Post ( u . String ( ) , " " , bytes . NewReader ( body ) ) if err != nil { return nil , errs . Wrapf ( http . StatusInternalServerError , err , " " , u ) } if resp . StatusCode >= 400 { if ! retried && c . retryOnError ( resp ) { retried = true goto retry } return nil , readError ( resp . Body ) } var sign api . SignResponse if err := readJSON ( resp . Body , & sign ) ; err != nil { return nil , errs . Wrapf ( http . StatusInternalServerError , err , " " , u ) } sign . TLS = resp . TLS return & sign , nil }
Sign performs the sign request to the CA and returns the api.SignResponse
struct.
Sign performs the sign request to the CA and returns the api . SignResponse struct .
// Add tls.ConnectionState: // We'll extract the root certificate from the verified chains