mirror of https://github.com/status-im/consul.git
Add missing LicenseReset API function (#6311)
This commit is contained in:
parent
5ecffb0c0a
commit
69c7d64701
|
@ -73,6 +73,25 @@ func (op *Operator) LicenseGetSigned(q *QueryOptions) (string, error) {
|
|||
return string(data), nil
|
||||
}
|
||||
|
||||
// LicenseReset will reset the license to the builtin one if it is still valid.
|
||||
// If the builtin license is invalid, the current license stays active.
|
||||
func (op *Operator) LicenseReset(opts *WriteOptions) (*LicenseReply, error) {
|
||||
var reply LicenseReply
|
||||
r := op.c.newRequest("DELETE", "/v1/operator/license")
|
||||
r.setWriteOptions(opts)
|
||||
_, resp, err := requireOK(op.c.doRequest(r))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if err := decodeBody(resp, &reply); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &reply, nil
|
||||
}
|
||||
|
||||
func (op *Operator) LicensePut(license string, opts *WriteOptions) (*LicenseReply, error) {
|
||||
var reply LicenseReply
|
||||
r := op.c.newRequest("PUT", "/v1/operator/license")
|
||||
|
|
Loading…
Reference in New Issue