Versions in this module Expand all Collapse all v0 v0.14.0 Jan 29, 2024 Changes in this version + var ErrBootstrap = errors.New("failed to read bootstrap configuration") + var ErrExternalKey = errors.New("failed to get bootstrap configuration for given external key") + var ErrExternalKeySecure = errors.New("failed to get bootstrap configuration for given encrypted external key") + var ErrThings = errors.New("failed to receive response from Things service") + type Channel struct + CreatedAt time.Time + Description string + ID string + Metadata map[string]interface{} + Name string + Owner string + Parent string + Status clients.Status + UpdatedAt time.Time + UpdatedBy string + type Config struct + CACert string + Channels []Channel + ClientCert string + ClientKey string + Content string + ExternalID string + ExternalKey string + Name string + Owner string + State State + ThingID string + ThingKey string + type ConfigReader interface + ReadConfig func(Config, bool) (interface{}, error) + func NewConfigReader(encKey []byte) ConfigReader + type ConfigRepository interface + ChangeState func(ctx context.Context, owner, id string, state State) error + DisconnectThing func(ctx context.Context, channelID, thingID string) error + ListExisting func(ctx context.Context, owner string, ids []string) ([]Channel, error) + Remove func(ctx context.Context, owner, id string) error + RemoveChannel func(ctx context.Context, id string) error + RemoveThing func(ctx context.Context, id string) error + RetrieveAll func(ctx context.Context, owner string, filter Filter, offset, limit uint64) ConfigsPage + RetrieveByExternalID func(ctx context.Context, externalID string) (Config, error) + RetrieveByID func(ctx context.Context, owner, id string) (Config, error) + Save func(ctx context.Context, cfg Config, chsConnIDs []string) (string, error) + Update func(ctx context.Context, cfg Config) error + UpdateCert func(ctx context.Context, owner, thingID, clientCert, clientKey, caCert string) (Config, error) + UpdateChannel func(ctx context.Context, c Channel) error + UpdateConnections func(ctx context.Context, owner, id string, channels []Channel, ...) error + type ConfigsPage struct + Configs []Config + Limit uint64 + Offset uint64 + Total uint64 + type Filter struct + FullMatch map[string]string + PartialMatch map[string]string + type Service interface + Add func(ctx context.Context, token string, cfg Config) (Config, error) + Bootstrap func(ctx context.Context, externalKey, externalID string, secure bool) (Config, error) + ChangeState func(ctx context.Context, token, id string, state State) error + DisconnectThingHandler func(ctx context.Context, channelID, thingID string) error + List func(ctx context.Context, token string, filter Filter, offset, limit uint64) (ConfigsPage, error) + Remove func(ctx context.Context, token, id string) error + RemoveChannelHandler func(ctx context.Context, id string) error + RemoveConfigHandler func(ctx context.Context, id string) error + Update func(ctx context.Context, token string, cfg Config) error + UpdateCert func(ctx context.Context, token, thingID, clientCert, clientKey, caCert string) (Config, error) + UpdateChannelHandler func(ctx context.Context, channel Channel) error + UpdateConnections func(ctx context.Context, token, id string, connections []string) error + View func(ctx context.Context, token, id string) (Config, error) + func New(auth magistrala.AuthServiceClient, configs ConfigRepository, sdk mgsdk.SDK, ...) Service + type State int + const Active + const Inactive + func (s State) String() string