Documentation
¶
Overview ¶
Package port is a package that defines the ports for the application layer.
Index ¶
- Variables
- type AdminUsecase
- type AgentGroupManageUsecase
- type AgentManageUsecase
- type AgentPackageManageUsecase
- type AgentRemoteConfigManageUsecase
- type CertificateManageUsecase
- type ContainerManageUsecase
- type HostManageUsecase
- type NamespaceManageUsecase
- type OpAMPUsecase
- type RoleBindingManageUsecase
- type RoleManageUsecase
- type TransactionRunner
- type UserManageUsecase
Constants ¶
This section is empty.
Variables ¶
var ErrAgentConnected = agentport.ErrAgentConnected
ErrAgentConnected is returned when attempting to delete an agent that is still connected. Only disconnected agents can be deleted. It aliases the domain sentinel (the guard is enforced in the domain layer) so the HTTP layer can match it without importing the domain.
var ErrAgentNamespaceMismatch = errors.New("agent does not belong to the specified namespace")
ErrAgentNamespaceMismatch is returned when an agent exists but does not belong to the requested namespace. From that namespace's perspective the agent does not exist, so callers should map this to a 404.
Functions ¶
This section is empty.
Types ¶
type AdminUsecase ¶
type AdminUsecase interface {
ListConnections(ctx context.Context, namespace string,
options *model.ListOptions) (*model.ListResponse[*agentmodel.Connection], error)
}
AdminUsecase is a use case that handles admin operations.
type AgentGroupManageUsecase ¶
type AgentGroupManageUsecase interface {
GetAgentGroup(ctx context.Context, namespace string, name string,
options *model.GetOptions) (*v1.AgentGroup, error)
ListAgentGroups(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.AgentGroup], error)
ListAgentsByAgentGroup(
ctx context.Context,
namespace string,
agentGroupName string,
options *model.ListOptions,
) (*v1.ListResponse[v1.Agent], error)
CreateAgentGroup(ctx context.Context, agentGroup *v1.AgentGroup) (*v1.AgentGroup, error)
UpdateAgentGroup(ctx context.Context, namespace string, name string,
agentGroup *v1.AgentGroup) (*v1.AgentGroup, error)
DeleteAgentGroup(ctx context.Context, namespace string, name string) error
}
AgentGroupManageUsecase is a use case that handles agent group management operations.
type AgentManageUsecase ¶
type AgentManageUsecase interface {
GetAgent(ctx context.Context, namespace string, instanceUID uuid.UUID) (*v1.Agent, error)
ListAgents(ctx context.Context, namespace string,
options *model.ListOptions) (*v1.ListResponse[v1.Agent], error)
SearchAgents(ctx context.Context, namespace string, query string,
options *model.ListOptions) (*v1.ListResponse[v1.Agent], error)
UpdateAgent(ctx context.Context, namespace string, instanceUID uuid.UUID,
agent *v1.Agent) (*v1.Agent, error)
DeleteAgent(ctx context.Context, namespace string, instanceUID uuid.UUID) error
}
AgentManageUsecase is a use case that handles agent management operations.
type AgentPackageManageUsecase ¶
type AgentPackageManageUsecase interface {
GetAgentPackage(ctx context.Context, namespace string, name string,
options *model.GetOptions) (*v1.AgentPackage, error)
ListAgentPackages(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.AgentPackage], error)
CreateAgentPackage(ctx context.Context, agentPackage *v1.AgentPackage) (*v1.AgentPackage, error)
UpdateAgentPackage(ctx context.Context, namespace string, name string,
agentPackage *v1.AgentPackage) (*v1.AgentPackage, error)
DeleteAgentPackage(ctx context.Context, namespace string, name string) error
}
AgentPackageManageUsecase is a use case that handles agent package operations.
type AgentRemoteConfigManageUsecase ¶
type AgentRemoteConfigManageUsecase interface {
GetAgentRemoteConfig(ctx context.Context, namespace string,
name string, options *model.GetOptions) (*v1.AgentRemoteConfig, error)
ListAgentRemoteConfigs(ctx context.Context,
options *model.ListOptions) (*v1.ListResponse[v1.AgentRemoteConfig], error)
CreateAgentRemoteConfig(ctx context.Context,
agentRemoteConfig *v1.AgentRemoteConfig) (*v1.AgentRemoteConfig, error)
UpdateAgentRemoteConfig(ctx context.Context, namespace string, name string,
agentRemoteConfig *v1.AgentRemoteConfig) (*v1.AgentRemoteConfig, error)
DeleteAgentRemoteConfig(ctx context.Context, namespace string, name string) error
}
AgentRemoteConfigManageUsecase is a use case that handles agent remote config management operations.
type CertificateManageUsecase ¶
type CertificateManageUsecase interface {
GetCertificate(ctx context.Context, namespace string, name string,
options *model.GetOptions) (*v1.Certificate, error)
ListCertificates(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.Certificate], error)
CreateCertificate(ctx context.Context, certificate *v1.Certificate) (*v1.Certificate, error)
UpdateCertificate(ctx context.Context, namespace string, name string,
certificate *v1.Certificate) (*v1.Certificate, error)
DeleteCertificate(ctx context.Context, namespace string, name string) error
}
CertificateManageUsecase is a use case that handles certificate management operations.
type ContainerManageUsecase ¶
type ContainerManageUsecase interface {
GetContainer(ctx context.Context, id string) (*v1.Container, error)
ListContainers(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.Container], error)
ListAgentsByContainer(ctx context.Context, id string,
options *model.ListOptions) (*v1.ListResponse[v1.Agent], error)
}
ContainerManageUsecase is a use case that handles container management operations.
type HostManageUsecase ¶
type HostManageUsecase interface {
GetHost(ctx context.Context, id string) (*v1.Host, error)
ListHosts(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.Host], error)
ListAgentsByHost(ctx context.Context, id string,
options *model.ListOptions) (*v1.ListResponse[v1.Agent], error)
}
HostManageUsecase is a use case that handles host management operations.
type NamespaceManageUsecase ¶
type NamespaceManageUsecase interface {
GetNamespace(ctx context.Context, name string,
options *model.GetOptions) (*v1.Namespace, error)
ListNamespaces(ctx context.Context,
options *model.ListOptions) (*v1.ListResponse[v1.Namespace], error)
CreateNamespace(ctx context.Context,
namespace *v1.Namespace) (*v1.Namespace, error)
UpdateNamespace(ctx context.Context, name string,
namespace *v1.Namespace) (*v1.Namespace, error)
DeleteNamespace(ctx context.Context, name string) error
}
NamespaceManageUsecase is a use case that handles namespace management operations.
type OpAMPUsecase ¶
type OpAMPUsecase interface {
OnConnected(ctx context.Context, conn opamptypes.Connection)
OnConnectedWithType(ctx context.Context, conn opamptypes.Connection, isWebSocket bool)
OnMessage(ctx context.Context, conn opamptypes.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent
OnConnectionClose(conn opamptypes.Connection)
OnReadMessageError(conn opamptypes.Connection, mt int, msgByte []byte, err error)
OnMessageResponseError(conn opamptypes.Connection, message *protobufs.ServerToAgent, err error)
}
OpAMPUsecase is a use case that handles OpAMP protocol operations. Please see github.com/open-telemetry/opamp-go/server/types/ConnectionCallbacks.
type RoleBindingManageUsecase ¶
type RoleBindingManageUsecase interface {
GetRoleBinding(ctx context.Context, namespace, name string,
options *model.GetOptions) (*v1.RoleBinding, error)
ListRoleBindings(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.RoleBinding], error)
CreateRoleBinding(ctx context.Context, rb *v1.RoleBinding) (*v1.RoleBinding, error)
UpdateRoleBinding(ctx context.Context, namespace, name string, rb *v1.RoleBinding) (*v1.RoleBinding, error)
DeleteRoleBinding(ctx context.Context, namespace, name string) error
}
RoleBindingManageUsecase is a use case that handles RoleBinding management operations.
type RoleManageUsecase ¶
type RoleManageUsecase interface {
GetRole(ctx context.Context, uid uuid.UUID, options *model.GetOptions) (*v1.Role, error)
ListRoles(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.Role], error)
CreateRole(ctx context.Context, role *v1.Role) (*v1.Role, error)
UpdateRole(ctx context.Context, uid uuid.UUID, role *v1.Role) (*v1.Role, error)
DeleteRole(ctx context.Context, uid uuid.UUID) error
}
RoleManageUsecase is a use case that handles role management operations.
type TransactionRunner ¶
type TransactionRunner interface {
// WithinTransaction starts a transaction, invokes fn with a derived
// context, and commits if fn returns nil. If fn returns an error, the
// transaction is rolled back and the error is propagated to the caller.
WithinTransaction(ctx context.Context, fn func(ctx context.Context) error) error
}
TransactionRunner runs a function within a persistence transaction.
Implementations stash transaction state (e.g. a database session) on the context passed to fn, so any repository operation performed with that context participates in the same transaction. Callers must thread the derived context through every persistence call they want to be atomic.
The interface is intentionally technology-agnostic so the application layer does not depend on a specific database driver. Persistence adapters (MongoDB, Postgres, ...) provide their own implementations.
type UserManageUsecase ¶
type UserManageUsecase interface {
GetUser(ctx context.Context, uid uuid.UUID, options *model.GetOptions) (*v1.User, error)
GetUserByEmail(ctx context.Context, email string) (*v1.User, error)
ListUsers(ctx context.Context, options *model.ListOptions) (*v1.ListResponse[v1.User], error)
CreateUser(ctx context.Context, user *v1.User) (*v1.User, error)
DeleteUser(ctx context.Context, uid uuid.UUID) error
GetMyProfile(ctx context.Context, email string) (*v1.UserProfileResponse, error)
}
UserManageUsecase is a use case that handles user management operations.