Versions in this module Expand all Collapse all v1 v1.0.2 Jul 4, 2025 Changes in this version + const DefaultEventLimit + const DefaultLeaseDurationSeconds + const ISO8601UTC + const MaxEventLimit + const MaxLeaseDurationSeconds + const MinEventLimit + const MinLeaseDurationSeconds + func ActionWithoutBody[T domain.Entity, R any](actionFunc func(context.Context, properties.UUID) (*T, error), ...) http.HandlerFunc + func Action[Req any, T domain.Entity, R any](actionFunc func(context.Context, properties.UUID, *Req) (*T, error), ...) http.HandlerFunc + func CommandWithoutBody(commandFunc func(context.Context, properties.UUID) error) http.HandlerFunc + func Command[Req any](commandFunc func(context.Context, properties.UUID, *Req) error) http.HandlerFunc + func CreateServiceScopeExtractor(serviceGroupQuerier domain.ServiceGroupQuerier, ...) middlewares.ObjectScopeExtractor + func CreateTokenScopeExtractor() middlewares.ObjectScopeExtractor + func Create[Req any, T domain.Entity, R any](createFunc func(context.Context, *Req) (*T, error), toResp func(*T) *R) http.HandlerFunc + func Delete[T domain.Entity](querier domain.BaseEntityQuerier[T], ...) http.HandlerFunc + func ErrDomain(err error) render.Renderer + func ErrInternal(err error) render.Renderer + func ErrInvalidRequest(err error) render.Renderer + func ErrNotFound() render.Renderer + func ErrUnauthenticated() render.Renderer + func ErrUnauthorized(err error) render.Renderer + func ErrValidation(err domain.ValidationError) render.Renderer + func Get[T domain.Entity, R any](get func(ctx context.Context, id properties.UUID) (*T, error), ...) http.HandlerFunc + func List[T domain.Entity, R any](querier domain.BaseEntityQuerier[T], toResp func(*T) *R) http.HandlerFunc + func NewMockAuthAdmin() *auth.Identity + func NewMockAuthAgent() *auth.Identity + func NewMockAuthAgentWithID(agentID properties.UUID) *auth.Identity + func NewMockAuthConsumer() *auth.Identity + func NewMockAuthParticipant() *auth.Identity + func ParsePageRequest(r *http.Request) (*domain.PageReq, error) + func UpdateWithoutID[Req any, T domain.Entity, R any](updateFunc func(context.Context, *Req) (*T, error), toResp func(*T) *R) http.HandlerFunc + func Update[Req any, T domain.Entity, R any](updateFunc func(context.Context, properties.UUID, *Req) (*T, error), ...) http.HandlerFunc + type AgentHandler struct + func NewAgentHandler(querier domain.AgentQuerier, commander domain.AgentCommander, ...) *AgentHandler + func (h *AgentHandler) Create(ctx context.Context, req *CreateAgentReq) (*domain.Agent, error) + func (h *AgentHandler) GetMe(w http.ResponseWriter, r *http.Request) + func (h *AgentHandler) Routes() func(r chi.Router) + func (h *AgentHandler) Update(ctx context.Context, id properties.UUID, req *UpdateAgentReq) (*domain.Agent, error) + func (h *AgentHandler) UpdateStatusMe(ctx context.Context, req *UpdateAgentStatusReq) (*domain.Agent, error) + type AgentRes struct + AgentType *AgentTypeRes + AgentTypeID properties.UUID + CreatedAt JSONUTCTime + ID properties.UUID + Name string + Participant *ParticipantRes + ProviderID properties.UUID + Status domain.AgentStatus + Tags []string + UpdatedAt JSONUTCTime + func AgentToRes(a *domain.Agent) *AgentRes + type AgentTypeHandler struct + func NewAgentTypeHandler(querier domain.AgentTypeQuerier, authz auth.Authorizer) *AgentTypeHandler + func (h *AgentTypeHandler) Routes() func(r chi.Router) + type AgentTypeRes struct + CreatedAt JSONUTCTime + ID properties.UUID + Name string + ServiceTypes []*ServiceTypeRes + UpdatedAt JSONUTCTime + func AgentTypeToRes(at *domain.AgentType) *AgentTypeRes + type BaseMockQuerier struct + AuthScopeFunc func(ctx context.Context, id properties.UUID) (auth.ObjectScope, error) + CountFunc func(ctx context.Context) (int64, error) + ExistsFunc func(ctx context.Context, id properties.UUID) (bool, error) + GetFunc func(ctx context.Context, id properties.UUID) (*T, error) + ListFunc func(ctx context.Context, authScope *auth.IdentityScope, req *domain.PageReq) (*domain.PageRes[T], error) + func (m *BaseMockQuerier[T]) AuthScope(ctx context.Context, id properties.UUID) (auth.ObjectScope, error) + func (m *BaseMockQuerier[T]) Count(ctx context.Context) (int64, error) + func (m *BaseMockQuerier[T]) Exists(ctx context.Context, id properties.UUID) (bool, error) + func (m *BaseMockQuerier[T]) Get(ctx context.Context, id properties.UUID) (*T, error) + func (m *BaseMockQuerier[T]) List(ctx context.Context, authScope *auth.IdentityScope, req *domain.PageReq) (*domain.PageRes[T], error) + type BaseMockRepository struct + CreateFunc func(ctx context.Context, entity *T) error + DeleteFunc func(ctx context.Context, id properties.UUID) error + SaveFunc func(ctx context.Context, entity *T) error + func (m *BaseMockRepository[T]) Create(ctx context.Context, entity *T) error + func (m *BaseMockRepository[T]) Delete(ctx context.Context, id properties.UUID) error + func (m *BaseMockRepository[T]) Save(ctx context.Context, entity *T) error + type CompleteJobReq struct + ExternalID *string + Resources *properties.JSON + type CreateAgentReq struct + AgentTypeID properties.UUID + Name string + ProviderID properties.UUID + Tags []string + func (r CreateAgentReq) ObjectScope() (auth.ObjectScope, error) + type CreateMetricEntryReq struct + EntityID properties.UUID + EntityType string + ExternalID *string + MetricTypeID properties.UUID + ResourceID string + ServiceID *properties.UUID + Timestamp time.Time + TypeName string + Value float64 + type CreateMetricTypeReq struct + EntityType domain.MetricEntityType + Name string + type CreateParticipantReq struct + Name string + Status domain.ParticipantStatus + type CreateServiceGroupReq struct + ConsumerID properties.UUID + Name string + func (r CreateServiceGroupReq) ObjectScope() (auth.ObjectScope, error) + type CreateServiceReq struct + AgentID *properties.UUID + AgentTags []string + GroupID properties.UUID + Name string + Properties properties.JSON + ServiceTypeID properties.UUID + type CreateTokenReq struct + AgentID *properties.UUID + ExpireAt *time.Time + Name string + Role auth.Role + ScopeID *properties.UUID + type ErrRes struct + Err error + ErrorText string + HTTPStatusCode int + StatusText string + func (e *ErrRes) Render(w http.ResponseWriter, r *http.Request) error + type EventAckReq struct + InstanceID string + LastEventSequenceProcessed int64 + SubscriberID string + func (req *EventAckReq) Bind(r *http.Request) error + type EventAckRes struct + LastEventSequenceProcessed int64 + type EventHandler struct + func NewEventHandler(querier domain.EventQuerier, ...) *EventHandler + func (h *EventHandler) Acknowledge(w http.ResponseWriter, r *http.Request) + func (h *EventHandler) Lease(w http.ResponseWriter, r *http.Request) + func (h *EventHandler) Routes() func(r chi.Router) + type EventLeaseReq struct + InstanceID string + LeaseDurationSeconds *int + Limit *int + SubscriberID string + func (req *EventLeaseReq) Bind(r *http.Request) error + type EventLeaseRes struct + Events []EventRes + LastEventSequenceProcessed int64 + LeaseExpiresAt JSONUTCTime + type EventRes struct + AgentID *properties.UUID + ConsumerID *properties.UUID + CreatedAt JSONUTCTime + ID properties.UUID + InitiatorID string + InitiatorType domain.InitiatorType + Properties properties.JSON + ProviderID *properties.UUID + SequenceNumber int64 + Type domain.EventType + UpdatedAt JSONUTCTime + func EventToRes(ae *domain.Event) *EventRes + type FailJobReq struct + ErrorMessage string + type JSONUTCTime time.Time + func (t *JSONUTCTime) UnmarshalJSON(data []byte) error + func (t JSONUTCTime) MarshalJSON() ([]byte, error) + type JobHandler struct + func NewJobHandler(querier domain.JobQuerier, commander domain.JobCommander, ...) *JobHandler + func (h *JobHandler) Complete(ctx context.Context, id properties.UUID, req *CompleteJobReq) error + func (h *JobHandler) Fail(ctx context.Context, id properties.UUID, req *FailJobReq) error + func (h *JobHandler) Pending(w http.ResponseWriter, r *http.Request) + func (h *JobHandler) Routes() func(r chi.Router) + type JobRes struct + Action domain.ServiceAction + AgentID properties.UUID + ClaimedAt *JSONUTCTime + CompletedAt *JSONUTCTime + ConsumerID properties.UUID + CreatedAt JSONUTCTime + ErrorMessage string + ID properties.UUID + Priority int + ProviderID properties.UUID + Service *ServiceRes + ServiceID properties.UUID + Status domain.JobStatus + UpdatedAt JSONUTCTime + func JobToRes(job *domain.Job) *JobRes + type MetricEntryHandler struct + func NewMetricEntryHandler(querier domain.MetricEntryQuerier, serviceQuerier domain.ServiceQuerier, ...) *MetricEntryHandler + func (h *MetricEntryHandler) Create(w http.ResponseWriter, r *http.Request) + func (h *MetricEntryHandler) Routes() func(r chi.Router) + type MetricEntryRes struct + Agent *AgentRes + AgentID properties.UUID + ConsumerID properties.UUID + CreatedAt JSONUTCTime + ID properties.UUID + ProviderID properties.UUID + ResourceID string + Service *ServiceRes + ServiceID properties.UUID + Type *MetricTypeRes + TypeID string + UpdatedAt JSONUTCTime + Value float64 + func MetricEntryToRes(me *domain.MetricEntry) *MetricEntryRes + type MetricTypeHandler struct + func NewMetricTypeHandler(querier domain.MetricTypeQuerier, commander domain.MetricTypeCommander, ...) *MetricTypeHandler + func (h *MetricTypeHandler) Create(ctx context.Context, req *CreateMetricTypeReq) (*domain.MetricType, error) + func (h *MetricTypeHandler) Routes() func(r chi.Router) + func (h *MetricTypeHandler) Update(ctx context.Context, id properties.UUID, req *UpdateMetricTypeReq) (*domain.MetricType, error) + type MetricTypeRes struct + CreatedAt JSONUTCTime + EntityType domain.MetricEntityType + ID properties.UUID + Name string + UpdatedAt JSONUTCTime + func MetricTypeToRes(mt *domain.MetricType) *MetricTypeRes + type MockAuthorizer struct + ShouldSucceed bool + func (m *MockAuthorizer) Authorize(identity *auth.Identity, action auth.Action, object auth.ObjectType, ...) error + type PageRes struct + CurrentPage int + HasNext bool + HasPrev bool + Items []*T + TotalItems int64 + TotalPages int + func NewPageResponse[E any, R any](result *domain.PageRes[E], conv func(*E) *R) *PageRes[R] + type ParticipantHandler struct + func NewParticipantHandler(querier domain.ParticipantQuerier, commander domain.ParticipantCommander, ...) *ParticipantHandler + func (h *ParticipantHandler) Create(ctx context.Context, req *CreateParticipantReq) (*domain.Participant, error) + func (h *ParticipantHandler) Routes() func(r chi.Router) + func (h *ParticipantHandler) Update(ctx context.Context, id properties.UUID, req *UpdateParticipantReq) (*domain.Participant, error) + type ParticipantRes struct + CreatedAt JSONUTCTime + ID properties.UUID + Name string + Status domain.ParticipantStatus + UpdatedAt JSONUTCTime + func ParticipantToRes(p *domain.Participant) *ParticipantRes + type ServiceActionReq struct + Action string + type ServiceGroupHandler struct + func NewServiceGroupHandler(querier domain.ServiceGroupQuerier, commander domain.ServiceGroupCommander, ...) *ServiceGroupHandler + func (h *ServiceGroupHandler) Create(ctx context.Context, req *CreateServiceGroupReq) (*domain.ServiceGroup, error) + func (h *ServiceGroupHandler) Routes() func(r chi.Router) + func (h *ServiceGroupHandler) Update(ctx context.Context, id properties.UUID, req *UpdateServiceGroupReq) (*domain.ServiceGroup, error) + type ServiceGroupRes struct + ConsumerID properties.UUID + CreatedAt JSONUTCTime + ID properties.UUID + Name string + UpdatedAt JSONUTCTime + func ServiceGroupToRes(sg *domain.ServiceGroup) *ServiceGroupRes + type ServiceHandler struct + func NewServiceHandler(querier domain.ServiceQuerier, agentQuerier domain.AgentQuerier, ...) *ServiceHandler + func (h *ServiceHandler) Create(w http.ResponseWriter, r *http.Request) + func (h *ServiceHandler) Delete(ctx context.Context, id properties.UUID) error + func (h *ServiceHandler) Retry(ctx context.Context, id properties.UUID) error + func (h *ServiceHandler) Routes() func(r chi.Router) + func (h *ServiceHandler) Start(ctx context.Context, id properties.UUID) error + func (h *ServiceHandler) Stop(ctx context.Context, id properties.UUID) error + func (h *ServiceHandler) Update(ctx context.Context, id properties.UUID, req *UpdateServiceReq) (*domain.Service, error) + type ServiceRes struct + AgentID properties.UUID + ConsumerID properties.UUID + CreatedAt JSONUTCTime + CurrentProperties *properties.JSON + CurrentStatus domain.ServiceStatus + ErrorMessage *string + ExternalID *string + FailedAction *domain.ServiceAction + GroupID properties.UUID + ID properties.UUID + Name string + ProviderID properties.UUID + Resources *properties.JSON + RetryCount int + ServiceTypeID properties.UUID + TargetProperties *properties.JSON + TargetStatus *domain.ServiceStatus + UpdatedAt JSONUTCTime + func ServiceToRes(s *domain.Service) *ServiceRes + type ServiceTypeHandler struct + func NewServiceTypeHandler(querier domain.ServiceTypeQuerier, authz auth.Authorizer) *ServiceTypeHandler + func (h *ServiceTypeHandler) Routes() func(r chi.Router) + func (h *ServiceTypeHandler) Validate(w http.ResponseWriter, r *http.Request) + type ServiceTypeRes struct + CreatedAt JSONUTCTime + ID properties.UUID + Name string + PropertySchema *schema.CustomSchema + UpdatedAt JSONUTCTime + func ServiceTypeToRes(st *domain.ServiceType) *ServiceTypeRes + type TokenHandler struct + func NewTokenHandler(querier domain.TokenQuerier, commander domain.TokenCommander, ...) *TokenHandler + func (h *TokenHandler) Create(ctx context.Context, req *CreateTokenReq) (*domain.Token, error) + func (h *TokenHandler) Routes() func(r chi.Router) + func (h *TokenHandler) Update(ctx context.Context, id properties.UUID, req *UpdateTokenReq) (*domain.Token, error) + type TokenRes struct + AgentID *properties.UUID + CreatedAt JSONUTCTime + ExpireAt JSONUTCTime + ID properties.UUID + Name string + ParticipantID *properties.UUID + Role auth.Role + UpdatedAt JSONUTCTime + Value string + func TokenToRes(t *domain.Token) *TokenRes + type UpdateAgentReq struct + Name *string + Status *domain.AgentStatus + Tags *[]string + type UpdateAgentStatusReq struct + Status domain.AgentStatus + type UpdateMetricTypeReq struct + Name *string + type UpdateParticipantReq struct + Name *string + Status *domain.ParticipantStatus + type UpdateServiceGroupReq struct + Name *string + type UpdateServiceReq struct + Name *string + Properties *properties.JSON + type UpdateTokenReq struct + ExpireAt *time.Time + Name *string + type ValidateReq struct + Properties map[string]any + type ValidateRes struct + Errors []schema.ValidationError + Valid bool + type ValidationErrRes struct + Err error + Errors []domain.ValidationErrorDetail + HTTPStatusCode int + StatusText string + Valid bool + func (e *ValidationErrRes) Render(w http.ResponseWriter, r *http.Request) error