metadata

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 7 Imported by: 17

README

README

This package contains the metadata client written in the Go programming language. The metadata client is used by Go services or other Go code to communicate with the EdgeX core-metadata microservice (regardless of underlying implemenation type) by sending REST requests to the service's API endpoints.

How To Use

To use the core-metadata client package you first need to import the library into your project:

import "github.com/edgexfoundry/go-mod-core-contracts/clients/metadata"

As an example of use, to find a device using the Metadata client, first create a new device client (see core-data init.go)

mdc = metadata.NewDeviceClient(params, types.Endpoint{})

And then use the device client to located a device by Device struct (see core-data event.go)

_, err := mdc.CheckForDevice(device)

Documentation

Overview

Package metadata provides clients used for integration with the core-metadata service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressableClient

type AddressableClient interface {
	// Add creates a new Addressable and returns the ID of the new item if successful.
	Add(addr *models.Addressable, ctx context.Context) (string, error)
	// Addressable returns an Addressable for the specified ID
	Addressable(id string, ctx context.Context) (models.Addressable, error)
	// Addressable returns an Addressable for the specified name
	AddressableForName(name string, ctx context.Context) (models.Addressable, error)
	// Update will update the Addressable data
	Update(addr models.Addressable, ctx context.Context) error
	// Delete will eliminate the Addressable for the specified ID
	Delete(id string, ctx context.Context) error
}

AddressableClient defines the interface for interactions with the Addressable endpoint on the EdgeX Foundry core-metadata service.

func NewAddressableClient

func NewAddressableClient(params types.EndpointParams, m clients.Endpointer) AddressableClient

NewAddressableClient creates an instance of AddressableClient

type CommandClient

type CommandClient interface {
	// Add a new command
	Add(com *models.Command, ctx context.Context) (string, error)
	// Command obtains the command for the specified ID
	Command(id string, ctx context.Context) (models.Command, error)
	// Commands lists all the commands
	Commands(ctx context.Context) ([]models.Command, error)
	// CommandsForName lists all the commands for the specified name
	CommandsForName(name string, ctx context.Context) ([]models.Command, error)
	// Delete a command for the specified ID
	Delete(id string, ctx context.Context) error
	// Update a command
	Update(com models.Command, ctx context.Context) error
}

CommandClient defines the interface for interactions with the Command endpoint on the EdgeX Foundry core-metadata service.

func NewCommandClient

func NewCommandClient(params types.EndpointParams, m clients.Endpointer) CommandClient

NewCommandClient creates an instance of CommandClient

type DeviceClient

type DeviceClient interface {
	// Add creates a new device
	Add(dev *models.Device, ctx context.Context) (string, error)
	// Delete eliminates a device for the specified ID
	Delete(id string, ctx context.Context) error
	// DeleteByName eliminates a device for the specified name
	DeleteByName(name string, ctx context.Context) error
	// CheckForDevice will return a Device if one already exists for the specified device name
	CheckForDevice(token string, ctx context.Context) (models.Device, error)
	// Device loads the device for the specified ID
	Device(id string, ctx context.Context) (models.Device, error)
	// DeviceForName loads the device for the specified name
	DeviceForName(name string, ctx context.Context) (models.Device, error)
	// Devices lists all devices
	Devices(ctx context.Context) ([]models.Device, error)
	// DevicesByLabel lists all devices for the specified label
	DevicesByLabel(label string, ctx context.Context) ([]models.Device, error)
	// DevicesForProfile lists all devices for the specified profile ID
	DevicesForProfile(profileid string, ctx context.Context) ([]models.Device, error)
	// DevicesForProfileByName lists all devices for the specified profile name
	DevicesForProfileByName(profileName string, ctx context.Context) ([]models.Device, error)
	// DevicesForService lists all devices for the specified device service ID
	DevicesForService(serviceid string, ctx context.Context) ([]models.Device, error)
	// DevicesForServiceByName lists all devices for the specified device service name
	DevicesForServiceByName(serviceName string, ctx context.Context) ([]models.Device, error)
	// Update the specified device
	Update(dev models.Device, ctx context.Context) error
	// UpdateAdminState modifies a device's AdminState for the specified device ID
	UpdateAdminState(id string, adminState string, ctx context.Context) error
	// UpdateAdminStateByName modifies a device's AdminState according to the specified device name
	UpdateAdminStateByName(name string, adminState string, ctx context.Context) error
	// UpdateLastConnected updates a device's last connected timestamp according to the specified device ID
	UpdateLastConnected(id string, time int64, ctx context.Context) error
	// UpdateLastConnectedByName updates a device's last connected timestamp according to the specified device name
	UpdateLastConnectedByName(name string, time int64, ctx context.Context) error
	// UpdateLastReported updates a device's last reported timestamp according to the specified device ID
	UpdateLastReported(id string, time int64, ctx context.Context) error
	// UpdateLastReportedByName updates a device's last reported timestamp according to the specified device name
	UpdateLastReportedByName(name string, time int64, ctx context.Context) error
	// UpdateOpState updates a device's last OperatingState according to the specified device ID
	UpdateOpState(id string, opState string, ctx context.Context) error
	// UpdateOpStateByName updates a device's last OperatingState according to the specified device name
	UpdateOpStateByName(name string, opState string, ctx context.Context) error
}

DeviceClient defines the interface for interactions with the Device endpoint on the EdgeX Foundry core-metadata service.

func NewDeviceClient

func NewDeviceClient(params types.EndpointParams, m clients.Endpointer) DeviceClient

NewDeviceClient creates an instance of DeviceClient

type DeviceProfileClient

type DeviceProfileClient interface {
	// Add a new device profile
	Add(dp *models.DeviceProfile, ctx context.Context) (string, error)
	// Delete eliminates a device profile for the specified ID
	Delete(id string, ctx context.Context) error
	// DeleteByName eliminates a device profile for the specified name
	DeleteByName(name string, ctx context.Context) error
	// DeviceProfile loads the device profile for the specified ID
	DeviceProfile(id string, ctx context.Context) (models.DeviceProfile, error)
	// DeviceProfiles lists all device profiles
	DeviceProfiles(ctx context.Context) ([]models.DeviceProfile, error)
	// DeviceProfileForName loads the device profile for the specified name
	DeviceProfileForName(name string, ctx context.Context) (models.DeviceProfile, error)
	// Update a device profile
	Update(dp models.DeviceProfile, ctx context.Context) error
	// Upload a new device profile using raw YAML content
	Upload(yamlString string, ctx context.Context) (string, error)
	// Upload a new device profile using a file in YAML format
	UploadFile(yamlFilePath string, ctx context.Context) (string, error)
}

DeviceProfileClient defines the interface for interactions with the DeviceProfile endpoint on the EdgeX Foundry core-metadata service.

func NewDeviceProfileClient

func NewDeviceProfileClient(params types.EndpointParams, m clients.Endpointer) DeviceProfileClient

Return an instance of DeviceProfileClient

type DeviceServiceClient

type DeviceServiceClient interface {
	// Add a new device service
	Add(ds *models.DeviceService, ctx context.Context) (string, error)
	// DeviceServiceForName loads a device service for the specified name
	DeviceServiceForName(name string, ctx context.Context) (models.DeviceService, error)
	// UpdateLastConnected updates a device service's last connected timestamp for the specified service ID
	UpdateLastConnected(id string, time int64, ctx context.Context) error
	// UpdateLastReported updates a device service's last reported timestamp for the specified service ID
	UpdateLastReported(id string, time int64, ctx context.Context) error
}

DeviceServiceClient defines the interface for interactions with the DeviceService endpoint on the EdgeX Foundry core-metadata service.

func NewDeviceServiceClient

func NewDeviceServiceClient(params types.EndpointParams, m clients.Endpointer) DeviceServiceClient

NewDeviceServiceClient creates an instance of DeviceServiceClient

type ProvisionWatcherClient

type ProvisionWatcherClient interface {
	// Add a new provision watcher
	Add(dev *models.ProvisionWatcher, ctx context.Context) (string, error)
	// Delete a provision watcher for the specified ID
	Delete(id string, ctx context.Context) error
	// ProvisionWatcher loads an instance of a provision watcher for the specified ID
	ProvisionWatcher(id string, ctx context.Context) (models.ProvisionWatcher, error)
	// ProvisionWatcherForName loads an instance of a provision watcher for the specified name
	ProvisionWatcherForName(name string, ctx context.Context) (models.ProvisionWatcher, error)
	// ProvisionWatchers lists all provision watchers.
	ProvisionWatchers(ctx context.Context) ([]models.ProvisionWatcher, error)
	// ProvisionWatchersForService lists all provision watchers associated with the specified device service id
	ProvisionWatchersForService(serviceId string, ctx context.Context) ([]models.ProvisionWatcher, error)
	// ProvisionWatchersForServiceByName lists all provision watchers associated with the specified device service name
	ProvisionWatchersForServiceByName(serviceName string, ctx context.Context) ([]models.ProvisionWatcher, error)
	// ProvisionWatchersForProfile lists all provision watchers associated with the specified device profile ID
	ProvisionWatchersForProfile(profileid string, ctx context.Context) ([]models.ProvisionWatcher, error)
	// ProvisionWatchersForProfileByName lists all provision watchers associated with the specified device profile name
	ProvisionWatchersForProfileByName(profileName string, ctx context.Context) ([]models.ProvisionWatcher, error)
	// Update the provision watcher
	Update(dev models.ProvisionWatcher, ctx context.Context) error
}

ProvisionWatcherClient defines the interface for interactions with the ProvisionWatcher endpoint on the EdgeX Foundry core-metadata service.

func NewProvisionWatcherClient

func NewProvisionWatcherClient(params types.EndpointParams, m clients.Endpointer) ProvisionWatcherClient

NewProvisionWatcherClient creates an instance of ProvisionWatcherClient

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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