Documentation
¶
Index ¶
- func CertificateMetadataHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- func CreateCertificateHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- func CreateTokenHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- func DeleteCertificateHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- func GetCertificateHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- func GetTokenHandler(logger log.Logger) http.HandlerFunc
- func RevokeTokenHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- func UpdateCertificateHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- func UpdateTokenHandler(logger log.Logger, proxyClient *http.Client) http.HandlerFunc
- type TokenParams
- type TokenResponse
- type TokenResponseGet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CertificateMetadataHandler ¶
certificateMetadata godoc
@Summary Read metadata certificate
@Description Return certificate metadata like SAN,expiration, fingerprint...
@Tags metadata certificate
@Produce application/json
@Param Authorization header string true "Access token" default(Bearer <Add access token here>)
@Param issuer query string false "Certificate issuer" default(letsencrypt)
@Param domain query string false "Certificate domain" default(testfgx.example.com)
@Success 200 {object} []models.Certificate
@Success 404 {object} responseErrorJSON
@Success 409 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Router /certificate/metadata [get]
func CreateCertificateHandler ¶
certificate godoc
@Summary Create certificate
@Description Create certificate for a given issuer and domain name.
@Tags certificate
@Produce application/json
@Param Authorization header string true "Access token" default(Bearer <Add access token here>)
@Param body body models.CertificateParams true "Certificate body"
@Success 201 {object} models.CertMap
@Success 400 {object} responseErrorJSON
@Success 401 {object} responseErrorJSON
@Success 403 {object} responseErrorJSON
@Success 409 {object} responseErrorJSON
@Success 429 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Success 502 {object} responseErrorJSON
@Router /certificate [post]
func CreateTokenHandler ¶
createToken godoc
@Summary Create token
@Description Create token for a given username, scope and expiration time.
@Tags token
@Produce application/json
@Param body body TokenParams true "Token Body"
@Success 201 {object} TokenResponse
@Success 400 {object} responseErrorJSON
@Success 401 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Router /token [post]
@security APIKeyAuth
func DeleteCertificateHandler ¶
certificate godoc
@Summary Delete certificate
@Description Delete certificate for the given issuer and domain name.
@Tags certificate
@Produce application/json
@Param Authorization header string true "Access token" default(Bearer <Add access token here>)
@Param issuer path string true "Certificate issuer" default(letsencrypt)
@Param domain path string true "Certificate domain" default(testfgx.example.com)
@Param revoke query bool false "Revoke Certificate" default(false)
@Success 204
@Success 400 {object} responseErrorJSON
@Success 401 {object} responseErrorJSON
@Success 403 {object} responseErrorJSON
@Success 404 {object} responseErrorJSON
@Success 409 {object} responseErrorJSON
@Success 429 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Success 502 {object} responseErrorJSON
@Router /certificate/{issuer}/{domain} [delete]
func GetCertificateHandler ¶
certificate godoc
@Summary Read certificate
@Description Return certificate and issuer ca certificate.
@Tags certificate
@Produce application/json
@Param Authorization header string true "Access token" default(Bearer <Add access token here>)
@Param issuer path string true "Certificate issuer" default(letsencrypt)
@Param domain path string true "Certificate domain" default(testfgx.example.com)
@Success 200 {object} models.CertMap
@Success 400 {object} responseErrorJSON
@Success 401 {object} responseErrorJSON
@Success 403 {object} responseErrorJSON
@Success 404 {object} responseErrorJSON
@Success 409 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Router /certificate/{issuer}/{domain} [get]
func GetTokenHandler ¶
func GetTokenHandler(logger log.Logger) http.HandlerFunc
getToken godoc
@Summary Read token
@Description Return token infos like scope, expiration...
@Tags token
@Produce application/json
@Param id path string true "Token ID"
@Success 200 {object} TokenResponseGet
@Success 400 {object} responseErrorJSON
@Success 401 {object} responseErrorJSON
@Success 404 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Router /token/{id} [get]
@security APIKeyAuth
func RevokeTokenHandler ¶
revokeToken godoc
@Summary Revoke token
@Description Revoke token for a given ID.
@Tags token
@Produce application/json
@Param id path string true "Token ID"
@Success 204
@Success 401 {object} responseErrorJSON
@Success 404 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Router /token/{id} [delete]
@security APIKeyAuth
func UpdateCertificateHandler ¶
certificate godoc
@Summary Update certificate
@Description Update certificate will revoke the old and create a new certificate with given parameters.
@Tags certificate
@Produce application/json
@Param Authorization header string true "Access token" default(Bearer <Add access token here>)
@Param body body models.CertificateParams true "Certificate body"
@Success 200 {object} models.CertMap
@Success 400 {object} responseErrorJSON
@Success 401 {object} responseErrorJSON
@Success 403 {object} responseErrorJSON
@Success 404 {object} responseErrorJSON
@Success 409 {object} responseErrorJSON
@Success 429 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Success 502 {object} responseErrorJSON
@Router /certificate [put]
func UpdateTokenHandler ¶
updateToken godoc
@Summary Update token
@Description Update token for a given username, scope and expiration time, it will generate a new token.
@Tags token
@Produce application/json
@Param body body TokenParams true "Token Body"
@Success 200 {object} TokenResponse
@Success 400 {object} responseErrorJSON
@Success 401 {object} responseErrorJSON
@Success 429 {object} responseErrorJSON
@Success 500 {object} responseErrorJSON
@Router /token [put]
@security APIKeyAuth
Types ¶
type TokenParams ¶
type TokenParams struct {
ID string `json:"id" example:"021b5075-2d1e-44bd-b5e5-ffc7be7ad4c3"`
Username string `json:"username" example:"testfgx"`
Scope []string `json:"scope" example:"read,create,update,delete"`
Duration string `json:"duration" example:"30d"`
RateLimitWindow string `json:"rate_limit_window,omitempty" example:"1h"`
RateLimitMaxRequests int32 `json:"rate_limit_max_requests,omitempty" example:"5"`
}
used to validate api body and by swagger
type TokenResponse ¶
type TokenResponse struct {
ID string `json:"id"`
Token string `json:"token"`
Hash string `json:"tokenHash"`
Username string `json:"username"`
Expires string `json:"expires"`
Duration string `json:"duration"`
Scope []string `json:"scope"`
RateLimitWindow string `json:"rate_limit_window,omitempty"`
RateLimitMaxRequests int32 `json:"rate_limit_max_requests,omitempty"`
}
type TokenResponseGet ¶
type TokenResponseGet struct {
Hash string `json:"tokenHash"`
Username string `json:"username"`
Expires string `json:"expires"`
Duration string `json:"duration"`
Scope []string `json:"scope"`
RateLimitWindow string `json:"rate_limit_window,omitempty"`
RateLimitMaxRequests int32 `json:"rate_limit_max_requests,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.