Skip to content

Commit ec479d1

Browse files
cleanup
1 parent 372419a commit ec479d1

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

service/logger/audit/deferred.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ type GetDecisionV2Event struct {
9292
// defer auditEvent.Log(ctx)
9393
// // ... perform operation ...
9494
// auditEvent.Success(ctx, updatedObject)
95-
func (a *Logger) PolicyCRUD(ctx context.Context, params PolicyEventParams) *PolicyCRUDEvent {
95+
func (a *Logger) PolicyCRUD(_ context.Context, params PolicyEventParams) *PolicyCRUDEvent {
9696
// Store a reference to params for mutation
9797
paramsCopy := params
9898
return &PolicyCRUDEvent{
@@ -115,18 +115,18 @@ func (d *PolicyCRUDEvent) Success(ctx context.Context, updated proto.Message) {
115115
// Update the params with the updated object
116116
d.params.Updated = updated
117117
d.deferred.params = *d.params
118-
d.deferred.markSuccess(ctx)
118+
d.markSuccess(ctx)
119119
}
120120

121121
// Failure marks the audit event as failed and logs it immediately.
122122
func (d *PolicyCRUDEvent) Failure(ctx context.Context) {
123-
d.deferred.markFailure(ctx)
123+
d.markFailure(ctx)
124124
}
125125

126126
// Log should be called in a defer statement. If neither Success() nor Failure()
127127
// was called, it will check the context for cancellation and log appropriately.
128128
func (d *PolicyCRUDEvent) Log(ctx context.Context) {
129-
d.deferred.log(ctx)
129+
d.log(ctx)
130130
}
131131

132132
// DeferRewrap creates a deferred rewrap audit event.
@@ -137,7 +137,7 @@ func (d *PolicyCRUDEvent) Log(ctx context.Context) {
137137
// defer auditEvent.Log(ctx)
138138
// // ... perform operation ...
139139
// auditEvent.Success(ctx)
140-
func (a *Logger) DeferRewrap(ctx context.Context, params RewrapAuditEventParams) *RewrapEvent {
140+
func (a *Logger) DeferRewrap(_ context.Context, params RewrapAuditEventParams) *RewrapEvent {
141141
return &RewrapEvent{
142142
deferred: &deferred[RewrapAuditEventParams]{
143143
params: params,
@@ -153,18 +153,18 @@ func (a *Logger) DeferRewrap(ctx context.Context, params RewrapAuditEventParams)
153153

154154
// Success marks the audit event as successful and logs it immediately.
155155
func (d *RewrapEvent) Success(ctx context.Context) {
156-
d.deferred.markSuccess(ctx)
156+
d.markSuccess(ctx)
157157
}
158158

159159
// Failure marks the audit event as failed and logs it immediately.
160160
func (d *RewrapEvent) Failure(ctx context.Context) {
161-
d.deferred.markFailure(ctx)
161+
d.markFailure(ctx)
162162
}
163163

164164
// Log should be called in a defer statement. If neither Success() nor Failure()
165165
// was called, it will check the context for cancellation and log appropriately.
166166
func (d *RewrapEvent) Log(ctx context.Context) {
167-
d.deferred.log(ctx)
167+
d.log(ctx)
168168
}
169169

170170
// Decision creates a deferred GetDecision audit event.
@@ -175,7 +175,7 @@ func (d *RewrapEvent) Log(ctx context.Context) {
175175
// defer auditEvent.Log(ctx)
176176
// // ... perform operation, enriching with UpdateEntitlements/UpdateEntityDecisions ...
177177
// auditEvent.Success(ctx, decision)
178-
func (a *Logger) Decision(ctx context.Context, entityChainID string, resourceAttributeID string, fqns []string) *GetDecisionEvent {
178+
func (a *Logger) Decision(_ context.Context, entityChainID string, resourceAttributeID string, fqns []string) *GetDecisionEvent {
179179
params := GetDecisionEventParams{
180180
Decision: GetDecisionResultDeny, // Default to deny on cancellation
181181
EntityChainID: entityChainID,
@@ -217,18 +217,18 @@ func (d *GetDecisionEvent) UpdateEntityDecisions(decisions []EntityDecision) {
217217
func (d *GetDecisionEvent) Success(ctx context.Context, decision DecisionResult) {
218218
d.params.Decision = decision
219219
d.deferred.params = *d.params
220-
d.deferred.markSuccess(ctx)
220+
d.markSuccess(ctx)
221221
}
222222

223223
// Failure marks the audit event as failed (logs with deny decision)
224224
func (d *GetDecisionEvent) Failure(ctx context.Context) {
225-
d.deferred.markFailure(ctx)
225+
d.markFailure(ctx)
226226
}
227227

228228
// Log should be called in a defer statement. If neither Success() nor Failure()
229229
// was called, it will log with a deny decision.
230230
func (d *GetDecisionEvent) Log(ctx context.Context) {
231-
d.deferred.log(ctx)
231+
d.log(ctx)
232232
}
233233

234234
// DecisionV2 creates a deferred GetDecisionV2 audit event.
@@ -239,7 +239,7 @@ func (d *GetDecisionEvent) Log(ctx context.Context) {
239239
// defer auditEvent.Log(ctx)
240240
// // ... perform operation, enriching with UpdateEntitlements/UpdateResourceDecisions/UpdateObligations ...
241241
// auditEvent.Success(ctx, decision)
242-
func (a *Logger) DecisionV2(ctx context.Context, entityID string, actionName string) *GetDecisionV2Event {
242+
func (a *Logger) DecisionV2(_ context.Context, entityID string, actionName string) *GetDecisionV2Event {
243243
params := GetDecisionV2EventParams{
244244
EntityID: entityID,
245245
ActionName: actionName,
@@ -290,16 +290,16 @@ func (d *GetDecisionV2Event) UpdateObligations(fulfillable []string, satisfied b
290290
func (d *GetDecisionV2Event) Success(ctx context.Context, decision DecisionResult) {
291291
d.params.Decision = decision
292292
d.deferred.params = *d.params
293-
d.deferred.markSuccess(ctx)
293+
d.markSuccess(ctx)
294294
}
295295

296296
// Failure marks the audit event as failed (logs with deny decision)
297297
func (d *GetDecisionV2Event) Failure(ctx context.Context) {
298-
d.deferred.markFailure(ctx)
298+
d.markFailure(ctx)
299299
}
300300

301301
// Log should be called in a defer statement. If neither Success() nor Failure()
302302
// was called, it will log with a deny decision.
303303
func (d *GetDecisionV2Event) Log(ctx context.Context) {
304-
d.deferred.log(ctx)
304+
d.log(ctx)
305305
}

0 commit comments

Comments
 (0)