mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 05:37:43 +00:00
fix: remove action feature flag and include execution (#9727)
# Which Problems Are Solved Actions v2 is not a feature flag anymore, include functionality on executions is not used and json tags of proto messages are handled incorrectly. # How the Problems Are Solved - Remove actions from the feature flags on system and instance level - Remove include type on executions, only in the API, later maybe in the handling logic as well - Use protojson in request and response handling of actions v2 # Additional Changes - Correct integration tests for request and response handling - Use json.RawMessage for events, so that the event payload is not base64 encoded - Added separate context for async webhook calls, that executions are not cancelled when called async # Additional Context Related to #9759 Closes #9710 --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -14,22 +14,10 @@ import (
|
||||
)
|
||||
|
||||
func (s *Server) SetExecution(ctx context.Context, req *action.SetExecutionRequest) (*action.SetExecutionResponse, error) {
|
||||
if err := checkActionsEnabled(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqTargets := req.GetTargets()
|
||||
targets := make([]*execution.Target, len(reqTargets))
|
||||
for i, target := range reqTargets {
|
||||
switch t := target.GetType().(type) {
|
||||
case *action.ExecutionTargetType_Include:
|
||||
include, err := conditionToInclude(t.Include)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
targets[i] = &execution.Target{Type: domain.ExecutionTargetTypeInclude, Target: include}
|
||||
case *action.ExecutionTargetType_Target:
|
||||
targets[i] = &execution.Target{Type: domain.ExecutionTargetTypeTarget, Target: t.Target}
|
||||
}
|
||||
targets[i] = &execution.Target{Type: domain.ExecutionTargetTypeTarget, Target: target}
|
||||
}
|
||||
set := &command.SetExecution{
|
||||
Targets: targets,
|
||||
@@ -60,59 +48,19 @@ func (s *Server) SetExecution(ctx context.Context, req *action.SetExecutionReque
|
||||
}, nil
|
||||
}
|
||||
|
||||
func conditionToInclude(cond *action.Condition) (string, error) {
|
||||
switch t := cond.GetConditionType().(type) {
|
||||
case *action.Condition_Request:
|
||||
cond := executionConditionFromRequest(t.Request)
|
||||
if err := cond.IsValid(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return cond.ID(domain.ExecutionTypeRequest), nil
|
||||
case *action.Condition_Response:
|
||||
cond := executionConditionFromResponse(t.Response)
|
||||
if err := cond.IsValid(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return cond.ID(domain.ExecutionTypeRequest), nil
|
||||
case *action.Condition_Event:
|
||||
cond := executionConditionFromEvent(t.Event)
|
||||
if err := cond.IsValid(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return cond.ID(), nil
|
||||
case *action.Condition_Function:
|
||||
cond := command.ExecutionFunctionCondition(t.Function.GetName())
|
||||
if err := cond.IsValid(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return cond.ID(), nil
|
||||
default:
|
||||
return "", zerrors.ThrowInvalidArgument(nil, "ACTION-9BBob", "Errors.Execution.ConditionInvalid")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) ListExecutionFunctions(ctx context.Context, _ *action.ListExecutionFunctionsRequest) (*action.ListExecutionFunctionsResponse, error) {
|
||||
if err := checkActionsEnabled(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &action.ListExecutionFunctionsResponse{
|
||||
Functions: s.ListActionFunctions(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) ListExecutionMethods(ctx context.Context, _ *action.ListExecutionMethodsRequest) (*action.ListExecutionMethodsResponse, error) {
|
||||
if err := checkActionsEnabled(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &action.ListExecutionMethodsResponse{
|
||||
Methods: s.ListGRPCMethods(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) ListExecutionServices(ctx context.Context, _ *action.ListExecutionServicesRequest) (*action.ListExecutionServicesResponse, error) {
|
||||
if err := checkActionsEnabled(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &action.ListExecutionServicesResponse{
|
||||
Services: s.ListGRPCServices(),
|
||||
}, nil
|
||||
|
Reference in New Issue
Block a user