mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 20:38:00 +00:00
cc3ec1e2a7
# Which Problems Are Solved The current v3alpha actions APIs don't exactly adhere to the [new resources API design](https://zitadel.com/docs/apis/v3#standard-resources). # How the Problems Are Solved - **Breaking**: The current v3alpha actions APIs are removed. This is breaking. - **Resource Namespace**: New v3alpha actions APIs for targets and executions are added under the namespace /resources. - **Feature Flag**: New v3alpha actions APIs still have to be activated using the actions feature flag - **Reduced Executions Overhead**: Executions are managed similar to settings according to the new API design: an empty list of targets basically makes an execution a Noop. So a single method, SetExecution is enough to cover all use cases. Noop executions are not returned in future search requests. - **Compatibility**: The executions created with previous v3alpha APIs are still available to be managed with the new executions API. # Additional Changes - Removed integration tests which test executions but rely on readable targets. They are added again with #8169 # Additional Context Closes #8168
71 lines
1.8 KiB
Go
71 lines
1.8 KiB
Go
package action
|
|
|
|
import (
|
|
"context"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
"github.com/zitadel/zitadel/internal/api/grpc/server"
|
|
"github.com/zitadel/zitadel/internal/command"
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
"github.com/zitadel/zitadel/internal/zerrors"
|
|
action "github.com/zitadel/zitadel/pkg/grpc/resources/action/v3alpha"
|
|
)
|
|
|
|
var _ action.ZITADELActionsServer = (*Server)(nil)
|
|
|
|
type Server struct {
|
|
action.UnimplementedZITADELActionsServer
|
|
command *command.Commands
|
|
query *query.Queries
|
|
ListActionFunctions func() []string
|
|
ListGRPCMethods func() []string
|
|
ListGRPCServices func() []string
|
|
}
|
|
|
|
type Config struct{}
|
|
|
|
func CreateServer(
|
|
command *command.Commands,
|
|
query *query.Queries,
|
|
listActionFunctions func() []string,
|
|
listGRPCMethods func() []string,
|
|
listGRPCServices func() []string,
|
|
) *Server {
|
|
return &Server{
|
|
command: command,
|
|
query: query,
|
|
ListActionFunctions: listActionFunctions,
|
|
ListGRPCMethods: listGRPCMethods,
|
|
ListGRPCServices: listGRPCServices,
|
|
}
|
|
}
|
|
|
|
func (s *Server) RegisterServer(grpcServer *grpc.Server) {
|
|
action.RegisterZITADELActionsServer(grpcServer, s)
|
|
}
|
|
|
|
func (s *Server) AppName() string {
|
|
return action.ZITADELActions_ServiceDesc.ServiceName
|
|
}
|
|
|
|
func (s *Server) MethodPrefix() string {
|
|
return action.ZITADELActions_ServiceDesc.ServiceName
|
|
}
|
|
|
|
func (s *Server) AuthMethods() authz.MethodMapping {
|
|
return action.ZITADELActions_AuthMethods
|
|
}
|
|
|
|
func (s *Server) RegisterGateway() server.RegisterGatewayFunc {
|
|
return action.RegisterZITADELActionsHandler
|
|
}
|
|
|
|
func checkExecutionEnabled(ctx context.Context) error {
|
|
if authz.GetInstance(ctx).Features().Actions {
|
|
return nil
|
|
}
|
|
return zerrors.ThrowPreconditionFailed(nil, "ACTION-8o6pvqfjhs", "Errors.Action.NotEnabled")
|
|
}
|