2022-03-07 13:22:37 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-26 23:01:45 +00: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 13:22:37 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Server) GetFileSystemNotificationProvider(ctx context.Context, req *admin_pb.GetFileSystemNotificationProviderRequest) (*admin_pb.GetFileSystemNotificationProviderResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.query.NotificationProviderByIDAndType(ctx, authz.GetInstance(ctx).InstanceID(), domain.NotificationProviderTypeFile)
|
2022-03-07 13:22:37 +00: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 05:58:09 +00:00
|
|
|
result, err := s.query.NotificationProviderByIDAndType(ctx, authz.GetInstance(ctx).InstanceID(), domain.NotificationProviderTypeLog)
|
2022-03-07 13:22:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
return &admin_pb.GetLogNotificationProviderResponse{
|
|
|
|
Provider: settings.NotificationProviderToPb(result),
|
|
|
|
}, nil
|
|
|
|
}
|