service

package
v0.0.0-...-87de96b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanCreate

func CanCreate(user *dbm.User) bool

CanCreate checks if the user can create user resources

func CanDelete

func CanDelete(user *dbm.User) bool

CanDelete checks if the user can delete user resources

func CanRead

func CanRead(user *dbm.User) bool

CanRead checks if the user can read user resources

func CanUpdate

func CanUpdate(user *dbm.User) bool

CanUpdate checks if the user can update user resources

func DecodeCursor

func DecodeCursor(after *string) (*string, error)

DecodeCursor creates a string representation for a GraphQL cursor

func EncodeCursor

func EncodeCursor(i *string) graphql.ID

EncodeCursor creates a GraphQL cursor ID

Types

type BrokerService

type BrokerService struct {
	// contains filtered or unexported fields
}

BrokerService is used to communicate with network message brokers

func NewBrokerService

func NewBrokerService(config *gcontext.MasterConfig) *BrokerService

NewBrokerService returns a new BrokerService instance

func (*BrokerService) GetModule

func (b *BrokerService) GetModule(serviceName string, moduleID string) (*model.Module, error)

GetModule : Sends a GRPC request to the broker for all the properties of the Module

func (*BrokerService) GetModuleActiveJob

func (b *BrokerService) GetModuleActiveJob(serviceName string, moduleID string) (*model.Job, error)

GetModuleActiveJob : Sends a gRPC request for the active module job rpc GetModuleActiveJob(ModuleRequest) returns (JobResponse);

func (*BrokerService) GetModuleConfiguration

func (b *BrokerService) GetModuleConfiguration(serviceName string, moduleID string) (*model.Configuration, error)

GetModuleConfiguration : Sends a gRPC request for a module configuration rpc GetModuleConfiguration(ModuleRequest) returns (ConfigurationResponse);

func (*BrokerService) GetModuleJob

func (b *BrokerService) GetModuleJob(serviceName string, moduleID string, jobID string) (*model.Job, error)

GetModuleJob : Sends a gRPC request for a module job rpc GetModuleJob(ModuleRequest) returns (JobResponse);

func (*BrokerService) GetModuleJobs

func (b *BrokerService) GetModuleJobs(serviceName string, moduleID string) (*[]*model.Job, error)

GetModuleJobs : Sends a gRPC request for a list of module jobs rpc GetModuleJobs(ModuleRequest) returns (JobsResponse);

func (*BrokerService) GetModuleProperties

func (b *BrokerService) GetModuleProperties(
	serviceName string,
	moduleID string,
	properties []*pb.Property,
) ([]*model.Property, error)

GetModuleProperties : Sends a gRPC request to get a list of properties from a module rpc GetModuleProperties(PropertyRequest) returns (PropertiesResponse);

func (*BrokerService) GetModuleProperty

func (b *BrokerService) GetModuleProperty(
	serviceName string,
	moduleID string,
	propertyName string,
) (*model.Property, error)

GetModuleProperty : Sends a gRPC request to get a property from a module rpc GetModuleProperty(PropertyRequest) returns (PropertyResponse);

func (*BrokerService) GetModuleSettings

func (b *BrokerService) GetModuleSettings(serviceName string, moduleID string) (*[]*model.Property, error)

GetModuleSettings : Sends a gRPC request for the settings of a module rpc GetModuleSettings(ModuleRequest) returns (SettingsResponse);

func (*BrokerService) GetModuleStatus

func (b *BrokerService) GetModuleStatus(serviceName string, moduleID string) (*model.Status, error)

GetModuleStatus : Sends a gRPC request to the broker and expects a response that matches the Status model rpc GetModuleStatus(ModuleRequest) returns (StatusResponse);

func (*BrokerService) GetModules

func (b *BrokerService) GetModules(serviceName string) (*[]*model.Module, error)

GetModules : Sends a gRPC request for the information about a module rpc GetModules(Empty) return (ModulesResponse);

func (*BrokerService) Module

func (b *BrokerService) Module(ctx context.Context, moduleName string) (*model.Module, error)

Module returns module information retrieved for the name provided

func (*BrokerService) ModuleAvailableEvents

func (b *BrokerService) ModuleAvailableEvents(serviceName string, moduleID string) (*[]*model.Event, error)

ModuleAvailableEvents : Sends a gRPC request to return a list of available events rpc ModuleAvailableEvents(ModuleRequest) returns (EventsResponse);

func (*BrokerService) ModuleCancelJob

func (b *BrokerService) ModuleCancelJob(serviceName string, moduleID string, jobID string) (*model.Job, error)

ModuleCancelJob : Sends a gRPC request to cancel a module job rpc ModuleCancelJob(ModuleJobRequest) returns (JobResponse);

func (*BrokerService) ModuleSubmitEvent

func (b *BrokerService) ModuleSubmitEvent(serviceName string, moduleID string) (*model.Job, error)

ModuleSubmitEvent : Sends a gRPC request to raise an event in a module rpc ModuleSubmitEvent(ModuleEventRequest) returns (JobResponse);

func (*BrokerService) ModuleSubmitJob

func (b *BrokerService) ModuleSubmitJob(
	serviceName string,
	moduleID string,
	action string,
	value string,
	properties []*pb.Property,
) (*model.Job, error)

ModuleSubmitJob : Sends a gRPC request to submit a job to a module rpc ModuleSubmitJob(ModuleJobRequest) returns (JobResponse);

func (*BrokerService) SetModuleProperties

func (b *BrokerService) SetModuleProperties(
	serviceName string,
	moduleID string,
	properties []*pb.Property,
) ([]*model.Property, error)

SetModuleProperties : Sends a gRPC request to set a list of properties in a module rpc SetModuleProperties(PropertiesRequest) returns (PropertiesResponse);

func (*BrokerService) SetModuleProperty

func (b *BrokerService) SetModuleProperty(
	serviceName string,
	moduleID string,
	property *pb.Property,
) (*model.Property, error)

SetModuleProperty : Sends a gRPC request to set a property in a module rpc SetModuleProperty(PropertyRequest) returns (PropertyResponse);

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(name string, client *mdp.Client, config *gcontext.BrokerConfig) *Endpoint

func (*Endpoint) GetChannel

func (e *Endpoint) GetChannel(ctx context.Context, in *pb.ChannelRequest) (*pb.ChannelResponse, error)

GetChannel <- ChannelRequest -> ChannelResponse

func (*Endpoint) GetChannels

func (e *Endpoint) GetChannels(ctx context.Context, in *pb.Empty) (*pb.ChannelsResponse, error)

GetChannels <- Empty -> ChannelsResponse

func (*Endpoint) GetConfiguration

func (e *Endpoint) GetConfiguration(
	ctx context.Context,
	in *pb.ConfigurationRequest,
) (*pb.ConfigurationResponse, error)

GetConfiguration <- ConfigurationRequest -> ConfigurationResponse

func (*Endpoint) GetJob

func (e *Endpoint) GetJob(ctx context.Context, in *pb.JobRequest) (*pb.JobResponse, error)

GetJob <- JobRequest -> JobResponse

func (*Endpoint) GetJobStatus

func (e *Endpoint) GetJobStatus(ctx context.Context, in *pb.JobRequest) (*pb.JobStatusResponse, error)

GetJobStatus <- JobRequest -> JobStatusResponse

func (*Endpoint) GetJobs

func (e *Endpoint) GetJobs(ctx context.Context, in *pb.Empty) (*pb.JobsResponse, error)

GetJobs <- Empty -> JobsResponse

func (*Endpoint) GetModule

func (e *Endpoint) GetModule(ctx context.Context, in *pb.ModuleRequest) (*pb.ModuleResponse, error)

GetModule <- ModuleRequest -> ModuleResponse

func (*Endpoint) GetModuleActiveJob

func (e *Endpoint) GetModuleActiveJob(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

GetModuleActiveJob <- ModuleRequest -> JobResponse

func (*Endpoint) GetModuleConfiguration

func (e *Endpoint) GetModuleConfiguration(ctx context.Context, in *pb.ModuleRequest) (*pb.ConfigurationResponse, error)

GetModuleConfiguration <- ModuleRequest -> ConfigurationResponse

func (*Endpoint) GetModuleJob

func (e *Endpoint) GetModuleJob(ctx context.Context, in *pb.ModuleJobRequest) (*pb.JobResponse, error)

GetModuleJob <- ModuleRequest -> JobResponse

func (*Endpoint) GetModuleJobs

func (e *Endpoint) GetModuleJobs(ctx context.Context, in *pb.ModuleRequest) (*pb.JobsResponse, error)

GetModuleJobs <- ModuleRequest -> JobsResponse

func (*Endpoint) GetModuleProperties

func (e *Endpoint) GetModuleProperties(ctx context.Context, in *pb.PropertiesRequest) (*pb.PropertiesResponse, error)

GetModuleProperties <- PropertiesRequest -> PropertiesResponse

func (*Endpoint) GetModuleProperty

func (e *Endpoint) GetModuleProperty(ctx context.Context, in *pb.PropertyRequest) (*pb.PropertyResponse, error)

GetModuleProperty <- PropertyRequest -> PropertyResponse

func (*Endpoint) GetModuleSettings

func (e *Endpoint) GetModuleSettings(ctx context.Context, in *pb.ModuleRequest) (*pb.SettingsResponse, error)

GetModuleSettings <- ModuleRequest -> SettingsResponse

func (*Endpoint) GetModuleStatus

func (e *Endpoint) GetModuleStatus(ctx context.Context, in *pb.ModuleRequest) (*pb.StatusResponse, error)

GetModuleStatus <- ModuleRequest -> StatusResponse

func (*Endpoint) GetModules

func (e *Endpoint) GetModules(ctx context.Context, in *pb.Empty) (*pb.ModulesResponse, error)

GetModules <- Empty -> ModulesResponse

func (*Endpoint) GetSettings

func (e *Endpoint) GetSettings(ctx context.Context, in *pb.SettingsRequest) (*pb.SettingsResponse, error)

GetSettings <- SettingsRequest -> SettingsResponse

func (*Endpoint) GetStatus

func (e *Endpoint) GetStatus(ctx context.Context, in *pb.StatusRequest) (*pb.StatusResponse, error)

GetStatus <- StatusRequest -> StatusResponse

func (*Endpoint) GetUnitConfiguration

func (e *Endpoint) GetUnitConfiguration(ctx context.Context, in *pb.Empty) (*pb.ConfigurationResponse, error)

GetUnitConfiguration <- Empty -> ConfigurationResponse

func (*Endpoint) ModuleAvailableEvents

func (e *Endpoint) ModuleAvailableEvents(ctx context.Context, in *pb.ModuleRequest) (*pb.EventsResponse, error)

ModuleAvailableEvents <- ModuleRequest -> EventsResponse

func (*Endpoint) ModuleCancelJob

func (e *Endpoint) ModuleCancelJob(ctx context.Context, in *pb.ModuleJobRequest) (*pb.JobResponse, error)

ModuleCancelJob <- ModuleJobRequest -> JobResponse

func (*Endpoint) ModuleSubmitEvent

func (e *Endpoint) ModuleSubmitEvent(ctx context.Context, in *pb.ModuleEventRequest) (*pb.JobResponse, error)

ModuleSubmitEvent <- ModuleEventRequest -> JobResponse

func (*Endpoint) ModuleSubmitJob

func (e *Endpoint) ModuleSubmitJob(ctx context.Context, in *pb.ModuleJobRequest) (*pb.JobResponse, error)

ModuleSubmitJob <- ModuleJobRequest -> JobResponse

func (*Endpoint) SetModuleProperties

func (e *Endpoint) SetModuleProperties(ctx context.Context, in *pb.PropertiesRequest) (*pb.PropertiesResponse, error)

SetModuleProperties <- PropertiesRequest -> PropertiesResponse

func (*Endpoint) SetModuleProperty

func (e *Endpoint) SetModuleProperty(ctx context.Context, in *pb.PropertyRequest) (*pb.PropertyResponse, error)

SetModuleProperty <- PropertyRequest -> PropertyResponse

func (*Endpoint) TryModuleConnect

func (e *Endpoint) TryModuleConnect(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

TryModuleConnect <- ModuleRequest -> JobResponse

func (*Endpoint) TryModuleDisable

func (e *Endpoint) TryModuleDisable(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

TryModuleDisable <- ModuleRequest -> JobResponse

func (*Endpoint) TryModuleDisconnect

func (e *Endpoint) TryModuleDisconnect(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

TryModuleDisconnect <- ModuleRequest -> JobResponse

func (*Endpoint) TryModuleEnable

func (e *Endpoint) TryModuleEnable(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

TryModuleEnable <- ModuleRequest -> JobResponse

func (*Endpoint) TryModuleLoad

func (e *Endpoint) TryModuleLoad(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

TryModuleLoad <- ModuleRequest -> JobResponse

func (*Endpoint) TryModuleReload

func (e *Endpoint) TryModuleReload(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

TryModuleReload <- ModuleRequest -> JobResponse

func (*Endpoint) TryModuleUnload

func (e *Endpoint) TryModuleUnload(ctx context.Context, in *pb.ModuleRequest) (*pb.JobResponse, error)

TryModuleUnload <- ModuleRequest -> JobResponse

type ManagerService

type ManagerService struct {
	// contains filtered or unexported fields
}

ManagerService is an interface to the plantctl gRPC service

func NewManagerService

func NewManagerService(client pb.ManagerClient) *ManagerService

NewManagerService returns a new ManagerService instances

func (*ManagerService) Install

func (c *ManagerService) Install() (*model.Response, error)

Install a plantd system

func (*ManagerService) Restart

func (c *ManagerService) Restart() (*model.Response, error)

Restart configured plantd services

func (*ManagerService) Start

func (c *ManagerService) Start() (*model.Response, error)

Start configured plantd services

func (*ManagerService) Status

func (c *ManagerService) Status() (*[]*model.Property, error)

Status checks configured plantd services rpc Status (Empty) returns (ServiceResponse) {}

func (*ManagerService) Stop

func (c *ManagerService) Stop() (*model.Response, error)

Stop configured plantd services

func (*ManagerService) Uninstall

func (c *ManagerService) Uninstall() (*model.Response, error)

Uninstall a plantd system

func (*ManagerService) Upgrade

func (c *ManagerService) Upgrade() (*model.Response, error)

Upgrade a plantd system

type NetworkService

type NetworkService struct {
	// contains filtered or unexported fields
}

NetworkService is used to work with network records in the database

func NewNetworkService

func NewNetworkService(db *gorm.DB) *NetworkService

NewNetworkService returns a new NetworkService instance

func (*NetworkService) Count

func (n *NetworkService) Count() (int, error)

Count returns the number of network records that exist in the database

func (*NetworkService) CreateNetwork

func (n *NetworkService) CreateNetwork(network *dbm.Network) (*dbm.Network, error)

CreateNetwork inserts a new network record into the database

func (*NetworkService) Delete

func (n *NetworkService) Delete(network *dbm.Network) *dbm.Network

Delete a network record if it exists in the database

func (*NetworkService) FindByDomain

func (n *NetworkService) FindByDomain(domain string) (*dbm.Network, error)

FindByDomain returns a network record with the domain provided

func (*NetworkService) FindByName

func (n *NetworkService) FindByName(name string) (*dbm.Network, error)

FindByName returns a network record with the name provided

func (*NetworkService) FindByUserID

func (n *NetworkService) FindByUserID(userID *string) ([]*dbm.Network, error)

FindByUserID returns all networks associated with a user ID

func (*NetworkService) List

func (n *NetworkService) List(first *int32, after *string) ([]*dbm.Network, error)

List returns all network records that exist in the database

func (*NetworkService) Update

func (n *NetworkService) Update(network *dbm.Network) *dbm.Network

Update a network record if it exists in the database

type RoleService

type RoleService struct {
	// contains filtered or unexported fields
}

RoleService is used to work with role records in the database

func NewRoleService

func NewRoleService(db *gorm.DB) *RoleService

NewRoleService returns a new RoleService instance

func (*RoleService) Count

func (r *RoleService) Count() (int, error)

Count returns the number of role records that exist in the database

func (*RoleService) CreateRole

func (r *RoleService) CreateRole(role *model.Role) (*model.Role, error)

CreateRole inserts a new role record into the database

func (*RoleService) Delete

func (r *RoleService) Delete(role *model.Role) *model.Role

Delete a role record if it exists in the database

func (*RoleService) FindByName

func (r *RoleService) FindByName(name string) (*model.Role, error)

FindByName returns a role record with the name provided

func (*RoleService) FindByUserID

func (r *RoleService) FindByUserID(userID *string) ([]*model.Role, error)

FindByUserID returns all roles associated with a user ID

func (*RoleService) List

func (r *RoleService) List(first *int, after *string) ([]*model.Role, error)

List returns all role records that exist in the database

func (*RoleService) Update

func (r *RoleService) Update(role *model.Role) *model.Role

Update a role record if it exists in the database

type Service

type Service struct{}

Service is the base type for others add

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService is used to work with user records in the database

func NewUserService

func NewUserService(db *gorm.DB, roleService *RoleService) *UserService

NewUserService returns a new UserService instance

func (*UserService) ComparePassword

func (u *UserService) ComparePassword(userCredentials *model.UserCredentials) (*orm.User, error)

ComparePassword checks if a user exists with the provided credentials and returns it if one does

func (*UserService) Count

func (u *UserService) Count() (int, error)

Count returns the number of user records that exist in the database

func (*UserService) Create

func (u *UserService) Create(user *orm.User) (*orm.User, error)

Create inserts a new user record into the database

func (*UserService) Delete

func (r *UserService) Delete(user *orm.User) *orm.User

Delete a user record if it exists in the database

func (*UserService) FindByEmail

func (u *UserService) FindByEmail(email string) (*orm.User, error)

FindByEmail returns a user record for the given email

func (*UserService) FindByID

func (u *UserService) FindByID(id string) (*orm.User, error)

FindByID returns a user record for the given ID

func (*UserService) List

func (u *UserService) List(first *int32, after *string) ([]*orm.User, error)

List returns all user records that exist in the database

func (*UserService) Update

func (r *UserService) Update(user *orm.User) *orm.User

Update a user record if it exists in the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL