Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllowedOrders = map[string]string{
"id": "id",
"name": "name",
}
Functions ¶
This section is empty.
Types ¶
type Backup ¶
type Backup struct {
OrgsConfigs []OrgConfig
ThingsConfigs []ThingConfig
}
type OrgConfigBackup ¶
type OrgConfigBackup struct {
OrgsConfigs []OrgConfig
}
type OrgConfigPage ¶
type OrgConfigRepository ¶
type OrgConfigRepository interface {
// Save creates a new organization config record in the database.
Save(ctx context.Context, oc OrgConfig) (OrgConfig, error)
// RetrieveByOrg returns the organization config associated with the given org ID
RetrieveByOrg(ctx context.Context, orgID string) (OrgConfig, error)
// RetrieveAll retrieves all organization configs.
RetrieveAll(ctx context.Context, pm apiutil.PageMetadata) (OrgConfigPage, error)
// Update performs an update to the existing organization config.
Update(ctx context.Context, oc OrgConfig) (OrgConfig, error)
// Remove removes the organization configs with the provided identifier.
Remove(ctx context.Context, orgID string) error
// BackupAll retrieves all org configs.
BackupAll(ctx context.Context) (OrgConfigBackup, error)
}
type Service ¶
type Service interface {
// ViewOrgConfig retrieves the org config for the authenticated user and org.
ViewOrgConfig(ctx context.Context, token, orgID string) (OrgConfig, error)
// ListOrgsConfigs retrieves all org configs.
ListOrgsConfigs(ctx context.Context, token string, pm apiutil.PageMetadata) (OrgConfigPage, error)
// UpdateOrgConfig updates an existing org config for the authenticated user.
UpdateOrgConfig(ctx context.Context, token string, orgConfig OrgConfig) (OrgConfig, error)
// RemoveOrgConfig removes the org config by org id.
RemoveOrgConfig(ctx context.Context, orgID string) error
// BackupOrgsConfigs retrieves all org configs.
BackupOrgsConfigs(ctx context.Context, token string) (OrgConfigBackup, error)
// ViewThingConfig retrieves the thing config for the authenticated user and thing.
ViewThingConfig(ctx context.Context, token, thingID string) (ThingConfig, error)
// ListThingsConfigs retrieves all thing configs.
ListThingsConfigs(ctx context.Context, token string, pm apiutil.PageMetadata) (ThingConfigPage, error)
// UpdateThingConfig updates an existing thing config for the authenticated user.
UpdateThingConfig(ctx context.Context, token string, thingConfig ThingConfig) (ThingConfig, error)
// RemoveThingConfig removes the thing config by thing id.
RemoveThingConfig(ctx context.Context, thingID string) error
// RemoveThingConfigByGroup removes the thing config by group id.
RemoveThingConfigByGroup(ctx context.Context, groupID string) error
// BackupThingsConfigs retrieves all thing configs.
BackupThingsConfigs(ctx context.Context, token string) (ThingConfigBackup, error)
// Backup retrieves all org and thing configs.
Backup(ctx context.Context, token string) (Backup, error)
// Restore adds all orgs and things configs from a backup.
Restore(ctx context.Context, token string, backup Backup) error
}
Service specifies an API that must be fullfiled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func New ¶
func New(orgConfigs OrgConfigRepository, thingConfigs ThingConfigRepository, things domain.ThingsClient, auth domain.AuthClient, idp uuid.IDProvider, logger logger.Logger) Service
type ThingConfig ¶
type ThingConfigBackup ¶
type ThingConfigBackup struct {
ThingsConfigs []ThingConfig
}
type ThingConfigPage ¶
type ThingConfigPage struct {
Total uint64
ThingsConfigs []ThingConfig
}
type ThingConfigRepository ¶
type ThingConfigRepository interface {
// Save creates a new thing config record in the database.
Save(ctx context.Context, tc ThingConfig) (ThingConfig, error)
// RetrieveByThing returns the thing config associated with the given thing ID.
RetrieveByThing(ctx context.Context, thingID string) (ThingConfig, error)
// RetrieveAll retrieves all thing configs.
RetrieveAll(ctx context.Context, pm apiutil.PageMetadata) (ThingConfigPage, error)
// Update performs an update to the existing thing config.
Update(ctx context.Context, tc ThingConfig) (ThingConfig, error)
// Remove removes the thing configs with the given thing ID.
Remove(ctx context.Context, thingID string) error
// RemoveByGroup deletes all thing configs that belong to the given group ID
RemoveByGroup(ctx context.Context, groupID string) error
// BackupAll retrieves all thing configs.
BackupAll(ctx context.Context) (ThingConfigBackup, error)
}
Click to show internal directories.
Click to hide internal directories.