device_profile

package
v1.2.2-dev.71 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAddDeviceProfileExecutor

func NewAddDeviceProfileExecutor(deviceProfile contracts.DeviceProfile, adder DeviceProfileAdder) addProfileExecutor

NewGetModelExecutor creates a new GetProfilesExecutor for retrieving device profiles by model.

Types

type DeleteExecutor

type DeleteExecutor interface {
	Execute() error
}

DeleteExecutor handles the deletion of a device profile. Returns ErrDeviceProfileNotFound if a device profile could not be found with a matching ID nor name Returns ErrDeviceProfileInvalidState if the device profile has one or more devices or provision watchers associated with it

func NewDeleteByIDExecutor

func NewDeleteByIDExecutor(db DeviceProfileDeleter, did string) DeleteExecutor

NewDeleteByIDExecutor creates a new DeleteExecutor which deletes a device profile based on a device profile name.

func NewDeleteByNameExecutor

func NewDeleteByNameExecutor(db DeviceProfileDeleter, dn string) DeleteExecutor

NewDeleteByNameExecutor creates a new DeleteExecutor which deletes a device profile based on a device profile ID.

type DeviceLoader

type DeviceLoader interface {
	GetAllDevices() ([]contract.Device, error)
	GetDevicesByProfileId(pid string) ([]contract.Device, error)
}

DeviceLoader retrieves devices as needed from the perspective of device profiles.

type DeviceProfileAdder

type DeviceProfileAdder interface {
	AddDeviceProfile(d contract.DeviceProfile) (string, error)
}

DeviceProfileAdder adds DeviceProfiles to the database

type DeviceProfileDeleter

type DeviceProfileDeleter interface {
	DeleteDeviceProfileById(id string) error

	// Functionality needed to perform validation and check state of DeviceProfile
	DeviceProfileLoader
	DeviceLoader
	ProvisionWatcherLoader
}

DeviceProfileDeleter deletes device profiles. Also provides other functionality for validating the device profile before deletion. Such as loading other entities to ensure there are no other dependencies on the device profile before deletion.

type DeviceProfileLoader

type DeviceProfileLoader interface {
	GetDeviceProfileById(id string) (contract.DeviceProfile, error)
	GetDeviceProfileByName(n string) (contract.DeviceProfile, error)
	GetAllDeviceProfiles() ([]contract.DeviceProfile, error)
	GetDeviceProfilesByModel(m string) ([]contract.DeviceProfile, error)
	GetDeviceProfilesWithLabel(l string) ([]contract.DeviceProfile, error)
	GetDeviceProfilesByManufacturerModel(man string, mod string) ([]contract.DeviceProfile, error)
	GetDeviceProfilesByManufacturer(man string) ([]contract.DeviceProfile, error)
}

DeviceProfileLoader retrieves device profiles.

type DeviceProfileUpdater

type DeviceProfileUpdater interface {
	GetProvisionWatchersByProfileId(id string) ([]contract.ProvisionWatcher, error)
	UpdateDeviceProfile(dp contract.DeviceProfile) error
	DeviceProfileLoader
	DeviceLoader
}

DeviceProfileUpdater updates device profiles. Also provides other functionality for validating the device profile before deletion. Such as loading other entities to ensure there are no other dependencies on the device profile before deletion.

type GetProfileExecutor

type GetProfileExecutor interface {
	Execute() (contract.DeviceProfile, error)
}

GetProfilesExecutor retrieves a profile based on some criteria.

func NewGetProfileID

func NewGetProfileID(id string, loader DeviceProfileLoader) GetProfileExecutor

NewGetProfileID creates a new GetProfileExecutor for retrieving device profiles by ID.

func NewGetProfileName

func NewGetProfileName(name string, loader DeviceProfileLoader) GetProfileExecutor

NewGetProfileName creates a new GetProfileExecutor for retrieving device profiles by name.

type GetProfilesExecutor

type GetProfilesExecutor interface {
	Execute() ([]contract.DeviceProfile, error)
}

GetProfilesExecutor retrieves one or more device profiles based on some criteria.

func NewGetAllExecutor

NewGetAllExecutor creates a new GetProfilesExecutor for retrieving all device profiles.

func NewGetLabelExecutor

func NewGetLabelExecutor(label string, loader DeviceProfileLoader) GetProfilesExecutor

NewGetLabelExecutor creates a new GetProfilesExecutor for retrieving device profiles by label.

func NewGetManufacturerExecutor

func NewGetManufacturerExecutor(manufacturer string, loader DeviceProfileLoader) GetProfilesExecutor

NewGetManufacturerExecutor creates a new GetProfilesExecutor for retrieving device profiles by manufacturer.

func NewGetManufacturerModelExecutor

func NewGetManufacturerModelExecutor(
	manufacturer string,
	model string,
	loader DeviceProfileLoader) GetProfilesExecutor

NewGetManufacturerModelExecutor creates a new GetProfilesExecutor for retrieving device profiles by manufacturer and model.

func NewGetModelExecutor

func NewGetModelExecutor(model string, loader DeviceProfileLoader) GetProfilesExecutor

NewGetModelExecutor creates a new GetProfilesExecutor for retrieving device profiles by model.

type ProvisionWatcherLoader

type ProvisionWatcherLoader interface {
	GetProvisionWatchersByProfileId(id string) ([]contract.ProvisionWatcher, error)
}

ProvisionWatcherLoader retrieves provision watchers.

type UpdateDeviceProfileExecutor

type UpdateDeviceProfileExecutor interface {
	Execute() (contract.DeviceProfile, error)
}

UpdateDeviceProfileExecutor provides functionality for updating and persisting device profiles. Returns ErrDeviceProfileNotFound if a device profile could not be found with a matching ID nor name Returns ErrDeviceProfileInvalidState if the device profile has one or more devices or provision watchers associated with it

func NewUpdateDeviceProfileExecutor

func NewUpdateDeviceProfileExecutor(db DeviceProfileUpdater, dp contract.DeviceProfile) UpdateDeviceProfileExecutor

NewUpdateDeviceProfileExecutor creates an UpdateDeviceProfileExecutor.

type UpdateValueDescriptorExecutor

type UpdateValueDescriptorExecutor interface {
	Execute() error
}

UpdateValueDescriptorExecutor updates a value descriptor.

func NewUpdateValueDescriptorExecutor

NewUpdateValueDescriptorExecutor creates a UpdateValueDescriptorExecutor which will update ValueDescriptors.

type ValueDescriptorAddExecutor

type ValueDescriptorAddExecutor interface {
	Execute() error
}

ValueDescriptorAddExecutor creates ValueDescriptor(s) via the operator pattern.

func NewAddValueDescriptorExecutor

func NewAddValueDescriptorExecutor(
	ctx context.Context,
	client ValueDescriptorAdder,
	lc logger.LoggingClient,
	drs ...contract.DeviceResource) ValueDescriptorAddExecutor

NewAddValueDescriptorExecutor creates a new ValueDescriptorAddExecutor.

type ValueDescriptorAdder

type ValueDescriptorAdder interface {
	Add(ctx context.Context, vdr *contract.ValueDescriptor) (string, error)
}

ValueDescriptorAdder provides the necessary functionality for creating a ValueDescriptor.

type ValueDescriptorUpdater

type ValueDescriptorUpdater interface {
	ValueDescriptorsUsage(ctx context.Context, names []string) (map[string]bool, error)
	Add(ctx context.Context, vdr *contract.ValueDescriptor) (string, error)
	Update(ctx context.Context, vdr *contract.ValueDescriptor) error
	DeleteByName(ctx context.Context, name string) error
	ValueDescriptorForName(ctx context.Context, name string) (contract.ValueDescriptor, error)
}

ValueDescriptorAdder provides the necessary functionality for updating a ValueDescriptor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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