Skip to content

Commit

Permalink
Add operator audit endpoint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodingenthusiast committed Sep 19, 2023
1 parent 203a368 commit d0cc236
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions api/operator_audit.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit d0cc236

Please sign in to comment.