Add operator audit endpoint changes (#18899)

This commit is contained in:
Ronald 2023-09-19 13:05:06 -04:00 committed by GitHub
parent 203a36821e
commit 70e738ce20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 0 deletions

40
api/operator_audit.go Normal file
View File

@ -0,0 +1,40 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
// The /v1/operator/audit-hash endpoint is available only in Consul Enterprise and
// interact with its audit logging subsystem.
package api
type AuditHashRequest struct {
Input string
}
type AuditHashResponse struct {
Hash string
}
func (op *Operator) AuditHash(a *AuditHashRequest, q *QueryOptions) (*AuditHashResponse, error) {
r := op.c.newRequest("POST", "/v1/operator/audit-hash")
r.setQueryOptions(q)
r.obj = a
rtt, resp, err := op.c.doRequest(r)
if err != nil {
return nil, err
}
defer closeResponseBody(resp)
if err := requireOK(resp); err != nil {
return nil, err
}
wm := &WriteMeta{}
wm.RequestTime = rtt
var out AuditHashResponse
if err := decodeBody(resp, &out); err != nil {
return nil, err
}
return &out, nil
}