-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Handle POLICY_REASSIGN action (#24616)
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
x-pack/elastic-agent/pkg/agent/application/handler_action_policy_reassign.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package application | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger" | ||
) | ||
|
||
// handlerPolicyReassign handles policy reassign change coming from fleet. | ||
type handlerPolicyReassign struct { | ||
log *logger.Logger | ||
} | ||
|
||
// Handle handles POLICY_REASSIGN action. | ||
func (h *handlerPolicyReassign) Handle(ctx context.Context, a action, acker fleetAcker) error { | ||
h.log.Debugf("handlerPolicyReassign: action '%+v' received", a) | ||
|
||
if err := acker.Ack(ctx, a); err != nil { | ||
h.log.Errorf("failed to acknowledge POLICY_REASSIGN action with id '%s'", a.ID) | ||
} else if err := acker.Commit(ctx); err != nil { | ||
h.log.Errorf("failed to commit acker after acknowledging action with id '%s'", a.ID) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters