Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove token from builtin rules #2550

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions internal/engine/ingester/builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ type BuiltinRuleDataIngest struct {
builtinCfg *pb.BuiltinType
ruleMethods rule_methods.Methods
method string
accessToken string
}

// NewBuiltinRuleDataIngest creates a new builtin rule data ingest engine
func NewBuiltinRuleDataIngest(
builtinCfg *pb.BuiltinType,
pbuild *providers.ProviderBuilder,
_ *providers.ProviderBuilder,
) (*BuiltinRuleDataIngest, error) {
return &BuiltinRuleDataIngest{
builtinCfg: builtinCfg,
accessToken: pbuild.GetToken(),
method: builtinCfg.GetMethod(),
ruleMethods: &rule_methods.RuleMethods{},
}, nil
Expand Down Expand Up @@ -98,8 +96,7 @@ func (idi *BuiltinRuleDataIngest) Ingest(ctx context.Context, ent protoreflect.P

// call method
// Call the method (empty parameter list)
result := method.Call([]reflect.Value{reflect.ValueOf(ctx),
reflect.ValueOf(idi.accessToken), reflect.ValueOf(ent)})
result := method.Call([]reflect.Value{reflect.ValueOf(ctx), reflect.ValueOf(ent)})
if len(result) != 2 {
return nil, fmt.Errorf("rule method should return 3 values")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rule_methods/rule_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ func (r *RuleMethods) GetMethod(mName string) (reflect.Value, error) {
}

// Passthrough is a method that passes the entity through, just marshalling it
func (_ *RuleMethods) Passthrough(_ context.Context, _ string, ent protoreflect.ProtoMessage) (json.RawMessage, error) {
func (_ *RuleMethods) Passthrough(_ context.Context, ent protoreflect.ProtoMessage) (json.RawMessage, error) {
return protojson.Marshal(ent)
}
Loading