Documentation ¶
Overview ¶
Package things contains the domain concept definitions needed to support Magistrala things service functionality.
This package defines the core domain concepts and types necessary to handle things in the context of a Magistrala things service. It abstracts the underlying complexities of user management and provides a structured approach to working with things.
Copyright (c) Abstract Machines SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Save stores pair thing secret, thing id. Save(ctx context.Context, thingSecret, thingID string) error // ID returns thing ID for given thing secret. ID(ctx context.Context, thingSecret string) (string, error) // Removes thing from cache. Remove(ctx context.Context, thingID string) error }
Cache contains thing caching interface.
type ChannelListResponse ¶
type Service ¶
type Service interface { // CreateThings creates new client. In case of the failed registration, a // non-nil error value is returned. CreateThings(ctx context.Context, token string, client ...clients.Client) ([]clients.Client, error) // ViewClient retrieves client info for a given client ID and an authorized token. ViewClient(ctx context.Context, token, id string) (clients.Client, error) // ViewClientPerms retrieves permissions on the client id for the given authorized token. ViewClientPerms(ctx context.Context, token, id string) ([]string, error) // ListClients retrieves clients list for a valid auth token. ListClients(ctx context.Context, token string, reqUserID string, pm clients.Page) (clients.ClientsPage, error) // ListClientsByGroup retrieves data about subset of things that are // connected or not connected to specified channel and belong to the user identified by // the provided key. ListClientsByGroup(ctx context.Context, token, groupID string, pm clients.Page) (clients.MembersPage, error) // UpdateClient updates the client's name and metadata. UpdateClient(ctx context.Context, token string, client clients.Client) (clients.Client, error) // UpdateClientTags updates the client's tags. UpdateClientTags(ctx context.Context, token string, client clients.Client) (clients.Client, error) // UpdateClientSecret updates the client's secret UpdateClientSecret(ctx context.Context, token, id, key string) (clients.Client, error) // EnableClient logically enableds the client identified with the provided ID EnableClient(ctx context.Context, token, id string) (clients.Client, error) // DisableClient logically disables the client identified with the provided ID DisableClient(ctx context.Context, token, id string) (clients.Client, error) Share(ctx context.Context, token, id string, relation string, userids ...string) error Unshare(ctx context.Context, token, id string, relation string, userids ...string) error // Identify returns thing ID for given thing key. Identify(ctx context.Context, key string) (string, error) // Authorize used for AuthZ gRPC server implementation and Things authorization. Authorize(ctx context.Context, req *magistrala.AuthorizeReq) (string, error) // DeleteClient deletes client with given ID. DeleteClient(ctx context.Context, token, id string) error }
Service specifies an API that must be fullfiled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func NewService ¶
func NewService(uauth magistrala.AuthServiceClient, c postgres.Repository, grepo mggroups.Repository, tcache Cache, idp magistrala.IDProvider) Service
NewService returns a new Clients service implementation.
Directories ¶
Path | Synopsis |
---|---|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations. |
grpc
Package grpc contains implementation of Auth service gRPC API.
|
Package grpc contains implementation of Auth service gRPC API. |
Package cache contains the domain concept definitions needed to support Magistrala things cache service functionality.
|
Package cache contains the domain concept definitions needed to support Magistrala things cache service functionality. |
Package events provides the domain concept definitions needed to support things clients events functionality.
|
Package events provides the domain concept definitions needed to support things clients events functionality. |
Package mocks contains mocks for testing purposes.
|
Package mocks contains mocks for testing purposes. |
Package postgres contains the database implementation of clients repository layer.
|
Package postgres contains the database implementation of clients repository layer. |
Package standalone contains implementation for auth service in single-user scenario.
|
Package standalone contains implementation for auth service in single-user scenario. |
Package tracing provides tracing instrumentation for Magistrala things clients service.
|
Package tracing provides tracing instrumentation for Magistrala things clients service. |