Documentation
¶
Overview ¶
Package namespace provides the NamespaceManageService for managing namespaces.
Index ¶
- Variables
- type Service
- func (s *Service) CreateNamespace(ctx context.Context, apiModel *v1.Namespace) (*v1.Namespace, error)
- func (s *Service) DeleteNamespace(ctx context.Context, name string) error
- func (s *Service) GetNamespace(ctx context.Context, name string, options *model.GetOptions) (*v1.Namespace, error)
- func (s *Service) ListNamespaces(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.Namespace], error)
- func (s *Service) UpdateNamespace(ctx context.Context, name string, apiModel *v1.Namespace) (*v1.Namespace, error)
Constants ¶
This section is empty.
Variables ¶
var ErrDefaultNamespaceUndeletable = errors.New(
"default namespace cannot be deleted",
)
ErrDefaultNamespaceUndeletable is returned when trying to delete the default namespace.
var ErrNamespaceAlreadyExists = errors.New("namespace already exists")
ErrNamespaceAlreadyExists is returned when a namespace with the same name already exists.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a service for managing namespaces.
func NewNamespaceService ¶
func NewNamespaceService( namespaceUsecase agentport.NamespaceUsecase, agentGroupUsecase agentport.AgentGroupUsecase, certificateUsecase agentport.CertificateUsecase, agentPackageUsecase agentport.AgentPackageUsecase, agentRemoteConfigUsecase agentport.AgentRemoteConfigUsecase, txRunner port.TransactionRunner, logger *slog.Logger, ) *Service
NewNamespaceService creates a new namespace manage service. txRunner must be non-nil; FX wires the MongoDB implementation in production. Tests should pass an explicit fake (see [testutil] or per-package recordingTxRunner).
func (*Service) CreateNamespace ¶
func (s *Service) CreateNamespace( ctx context.Context, apiModel *v1.Namespace, ) (*v1.Namespace, error)
CreateNamespace implements port.NamespaceManageUsecase.
func (*Service) DeleteNamespace ¶
DeleteNamespace implements port.NamespaceManageUsecase. Cascade deletes all agent groups, certificates, agent packages, and agent remote configs in the namespace, then the namespace itself. The whole cascade runs inside a single transaction so a mid-cascade failure rolls every soft-delete back, preventing a zombie namespace with partially deleted children.
func (*Service) GetNamespace ¶
func (s *Service) GetNamespace( ctx context.Context, name string, options *model.GetOptions, ) (*v1.Namespace, error)
GetNamespace implements port.NamespaceManageUsecase.
func (*Service) ListNamespaces ¶
func (s *Service) ListNamespaces( ctx context.Context, options *model.ListOptions, ) (*v1.ListResponse[v1.Namespace], error)
ListNamespaces implements port.NamespaceManageUsecase.