renewal.go raw

   1  package api
   2  
   3  import (
   4  	"errors"
   5  	"net/http"
   6  )
   7  
   8  // ErrNoARI is returned when the server does not advertise a renewal info endpoint.
   9  var ErrNoARI = errors.New("renewalInfo[get/post]: server does not advertise a renewal info endpoint")
  10  
  11  // GetRenewalInfo GETs renewal information for a certificate from the renewalInfo endpoint.
  12  // This is used to determine if a certificate needs to be renewed.
  13  //
  14  // Note: this endpoint is part of a draft specification, not all ACME servers will implement it.
  15  // This method will return api.ErrNoARI if the server does not advertise a renewal info endpoint.
  16  //
  17  // https://www.rfc-editor.org/rfc/rfc9773.html
  18  func (c *CertificateService) GetRenewalInfo(certID string) (*http.Response, error) {
  19  	if c.core.GetDirectory().RenewalInfo == "" {
  20  		return nil, ErrNoARI
  21  	}
  22  
  23  	if certID == "" {
  24  		return nil, errors.New("renewalInfo[get]: 'certID' cannot be empty")
  25  	}
  26  
  27  	return c.core.HTTPClient.Get(c.core.GetDirectory().RenewalInfo + "/" + certID)
  28  }
  29