2022-03-07 14:22:37 +01:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/settings"
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin"
|
2022-03-07 14:22:37 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Server) GetFileSystemNotificationProvider(ctx context.Context, req *admin_pb.GetFileSystemNotificationProviderRequest) (*admin_pb.GetFileSystemNotificationProviderResponse, error) {
|
2022-04-05 07:58:09 +02:00
|
|
|
result, err := s.query.NotificationProviderByIDAndType(ctx, authz.GetInstance(ctx).InstanceID(), domain.NotificationProviderTypeFile)
|
2022-03-07 14:22:37 +01:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
return &admin_pb.GetFileSystemNotificationProviderResponse{
|
|
|
|
Provider: settings.NotificationProviderToPb(result),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetLogNotificationProvider(ctx context.Context, req *admin_pb.GetLogNotificationProviderRequest) (*admin_pb.GetLogNotificationProviderResponse, error) {
|
2022-04-05 07:58:09 +02:00
|
|
|
result, err := s.query.NotificationProviderByIDAndType(ctx, authz.GetInstance(ctx).InstanceID(), domain.NotificationProviderTypeLog)
|
2022-03-07 14:22:37 +01:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
return &admin_pb.GetLogNotificationProviderResponse{
|
|
|
|
Provider: settings.NotificationProviderToPb(result),
|
|
|
|
}, nil
|
|
|
|
}
|