Documentation ¶
Overview ¶
Package iotagentsdk provides an SDK for communicating with Fiware IoT Agents.
Index ¶
- func SetLogLevel(ll string)
- type ApiError
- type Apikey
- type Attribute
- type Command
- type ConfigGroup
- type DeciveId
- type Device
- type FiwareService
- type IoTA
- func (i IoTA) Client() *http.Client
- func (i IoTA) ConfigGroupExists(fs FiwareService, r Resource, a Apikey) bool
- func (i IoTA) CreateConfigGroup(fs FiwareService, sg ConfigGroup) error
- func (i IoTA) CreateConfigGroupWSE(fs FiwareService, sg *ConfigGroup) error
- func (i IoTA) CreateConfigGroups(fs FiwareService, sgs []ConfigGroup) error
- func (i IoTA) CreateDevice(fs FiwareService, d Device) error
- func (i IoTA) CreateDeviceWSE(fs FiwareService, d *Device) error
- func (i IoTA) CreateDevices(fs FiwareService, ds []Device) error
- func (i IoTA) DeleteConfigGroup(fs FiwareService, r Resource, a Apikey) error
- func (i IoTA) DeleteDevice(fs FiwareService, id DeciveId) error
- func (i IoTA) DeviceExists(fs FiwareService, id DeciveId) bool
- func (i IoTA) GetAllServicePathsForService(service string) ([]string, error)
- func (i IoTA) Healthcheck() (*RespHealthcheck, error)
- func (i IoTA) ListConfigGroups(fs FiwareService) (*RespReadConfigGroup, error)
- func (i IoTA) ListDevices(fs FiwareService) (*respListDevices, error)
- func (i IoTA) ReadConfigGroup(fs FiwareService, r Resource, a Apikey) (*RespReadConfigGroup, error)
- func (i IoTA) ReadDevice(fs FiwareService, id DeciveId) (*Device, error)
- func (i IoTA) UpdateConfigGroup(fs FiwareService, r Resource, a Apikey, sg ConfigGroup) error
- func (i IoTA) UpdateDevice(fs FiwareService, d Device) error
- func (i IoTA) UpsertConfigGroup(fs FiwareService, sg ConfigGroup) error
- func (i IoTA) UpsertDevice(fs FiwareService, d Device) error
- type LazyAttribute
- type Metadata
- type MissingFields
- type ReqCreateConfigGroup
- type Resource
- type RespHealthcheck
- type RespReadConfigGroup
- type StaticAttribute
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLogLevel ¶
func SetLogLevel(ll string)
SetLogLevel sets the global logging level based on the given value. Possible values are: "trace", "debug", "info", "warning", "error", "fatal", "panic".
Types ¶
type Attribute ¶
type Attribute struct { ObjectID string `json:"object_id,omitempty" form:"object_id"` Name string `json:"name" form:"name"` Type string `json:"type" form:"type"` Expression string `json:"expression,omitempty" form:"expression"` SkipValue string `json:"skipValue,omitempty" form:"skipValue"` EntityName string `json:"entity_name,omitempty" form:"entity_name"` EntityType string `json:"entity_type,omitempty" form:"entity_type"` Metadata map[string]Metadata `json:"metadata,omitempty" form:"metadata"` }
Attribute represents an attribute in the data model.
type Command ¶
type Command struct { ObjectID string `json:"object_id,omitempty" form:"object_id"` Name string `json:"name" form:"name"` Type string `json:"type" form:"type"` Expression string `json:"expression,omitempty" form:"expression"` PayloadType string `json:"payloadType,omitempty" form:"payloadType"` ContentType string `json:"contentType,omitempty" form:"contentType"` Metadata map[string]Metadata `json:"metadata,omitempty" form:"metadata"` }
Command represents a command in the data model.
type ConfigGroup ¶
type ConfigGroup struct { Service string `json:"service,omitempty" form:"service"` ServicePath string `json:"subservice,omitempty" form:"subservice"` Resource Resource `json:"resource" form:"resource"` Apikey Apikey `json:"apikey" form:"apikey"` Timestamp *bool `json:"timestamp,omitempty" form:"timestamp"` EntityType string `json:"entity_type,omitempty" form:"entity_type"` Trust string `json:"trust,omitempty" form:"trust"` CbHost string `json:"cbHost,omitempty" form:"cbHost"` Lazy []LazyAttribute `json:"lazy,omitempty" form:"lazy"` Commands []Command `json:"commands,omitempty" form:"commands"` Attributes []Attribute `json:"attributes,omitempty" form:"attributes"` StaticAttributes []StaticAttribute `json:"static_attributes,omitempty" form:"static_attributes"` InternalAttributes []interface{} `json:"internal_attributes,omitempty" form:"internal_attributes"` ExplicitAttrs string `json:"explicitAttrs,omitempty" form:"explicitAttrs"` EntityNameExp string `json:"entityNameExp,omitempty" form:"entityNameExp"` NgsiVersion string `json:"ngsiVersion,omitempty" form:"ngsiVersion"` DefaultEntityNameConjunction string `json:"defaultEntityNameConjunction,omitempty" form:"defaultEntityNameConjunction"` Autoprovision bool `json:"autoprovision,omitempty" form:"autoprovision"` PayloadType string `json:"payloadType,omitempty" form:"payloadType"` Transport string `json:"transport,omitempty" form:"transport"` Endpoint string `json:"endpoint,omitempty" form:"endpoint"` }
ConfigGroup represents a configuration group. See datamodel [Config Group]: https://iotagent-node-lib.readthedocs.io/en/latest/api.html#service-group-datamodel
func (ConfigGroup) Validate ¶
func (sg ConfigGroup) Validate() error
Function to validate the ConfigGroup
type Device ¶
type Device struct { Id DeciveId `json:"device_id,omitempty" form:"device_id"` Service string `json:"service,omitempty" form:"service"` ServicePath string `json:"service_path,omitempty" form:"service_path"` EntityName string `json:"entity_name,omitempty" form:"entity_name"` EntityType string `json:"entity_type,omitempty" form:"entity_type"` Timezone string `json:"timezon,omitempty" form:"timezone"` Timestamp *bool `json:"timestamp,omitempty" form:"timestamp"` Apikey Apikey `json:"apikey,omitempty" form:"apikey"` Endpoint string `json:"endpoint,omitempty" form:"endpoint"` Protocol string `json:"protocol,omitempty" form:"protocol"` Transport string `json:"transport,omitempty" form:"transport"` Attributes []Attribute `json:"attributes,omitempty" form:"attributes"` Commands []Command `json:"commands,omitempty" form:"commands"` Lazy []LazyAttribute `json:"lazy,omitempty" form:"lazy"` StaticAttributes []StaticAttribute `json:"static_attributes,omitempty" form:"static_attributes"` InternalAttributes []interface{} `json:"internal_attributes,omitempty" form:"internal_attributes"` ExplicitAttrs any `json:"explicitAttrs,omitempty" form:"explicitAttrs"` NgsiVersion string `json:"ngsiVersion,omitempty" form:"ngsiVersion"` PayloadType string `json:"payloadType,omitempty" form:"payloadType"` }
Device represents a device. See datamodel Device: https://iotagent-node-lib.readthedocs.io/en/3.3.0/api.html#device-datamodel
func (*Device) MarshalJSON ¶ added in v1.1.7
type FiwareService ¶
FiwareService represents a Fiware service and its associated service path.
type IoTA ¶
IoTA represents an IoT Agent instance.
func NewIoTAgent ¶ added in v1.1.0
NewIoTAgent creates a new instance of the IoT Agent.
func (IoTA) Client ¶
Client returns the HTTP client used for communication with the IoT Agent. If no client is present, a new one is created.
func (IoTA) ConfigGroupExists ¶
func (i IoTA) ConfigGroupExists(fs FiwareService, r Resource, a Apikey) bool
Method to check if a ConfigGroup exists
func (IoTA) CreateConfigGroup ¶
func (i IoTA) CreateConfigGroup(fs FiwareService, sg ConfigGroup) error
Method to create a ConfigGroup
func (IoTA) CreateConfigGroupWSE ¶
func (i IoTA) CreateConfigGroupWSE(fs FiwareService, sg *ConfigGroup) error
Method to create a ConfigGroup, getting the created ConfigGroup and setting it.
func (IoTA) CreateConfigGroups ¶
func (i IoTA) CreateConfigGroups(fs FiwareService, sgs []ConfigGroup) error
Method to create multiple ConfigGroups
func (IoTA) CreateDevice ¶
func (i IoTA) CreateDevice(fs FiwareService, d Device) error
Method to create a device
func (IoTA) CreateDeviceWSE ¶
func (i IoTA) CreateDeviceWSE(fs FiwareService, d *Device) error
Creates a device an updates the given Device
func (IoTA) CreateDevices ¶
func (i IoTA) CreateDevices(fs FiwareService, ds []Device) error
Method to create a device
func (IoTA) DeleteConfigGroup ¶
func (i IoTA) DeleteConfigGroup(fs FiwareService, r Resource, a Apikey) error
Method to delete a ConfigGroup
func (IoTA) DeleteDevice ¶
func (i IoTA) DeleteDevice(fs FiwareService, id DeciveId) error
Method to delete a device
func (IoTA) DeviceExists ¶
func (i IoTA) DeviceExists(fs FiwareService, id DeciveId) bool
Method to check if a device exists
func (IoTA) GetAllServicePathsForService ¶
GetAllServicePathsForService returns all service paths for the specified service.
func (IoTA) Healthcheck ¶
func (i IoTA) Healthcheck() (*RespHealthcheck, error)
Healthcheck performs a health check of the IoT Agent and returns the result.
func (IoTA) ListConfigGroups ¶
func (i IoTA) ListConfigGroups(fs FiwareService) (*RespReadConfigGroup, error)
Method to list ConfigGroups
func (IoTA) ListDevices ¶
func (i IoTA) ListDevices(fs FiwareService) (*respListDevices, error)
Method to list devices
func (IoTA) ReadConfigGroup ¶
func (i IoTA) ReadConfigGroup(fs FiwareService, r Resource, a Apikey) (*RespReadConfigGroup, error)
Method to read a ConfigGroup
func (IoTA) ReadDevice ¶
func (i IoTA) ReadDevice(fs FiwareService, id DeciveId) (*Device, error)
Method to read a device
func (IoTA) UpdateConfigGroup ¶
func (i IoTA) UpdateConfigGroup(fs FiwareService, r Resource, a Apikey, sg ConfigGroup) error
Method to update a ConfigGroup
func (IoTA) UpdateDevice ¶
func (i IoTA) UpdateDevice(fs FiwareService, d Device) error
Method to update a device
func (IoTA) UpsertConfigGroup ¶
func (i IoTA) UpsertConfigGroup(fs FiwareService, sg ConfigGroup) error
Method to upsert a ConfigGroup
func (IoTA) UpsertDevice ¶
func (i IoTA) UpsertDevice(fs FiwareService, d Device) error
Method to upsert a device
type LazyAttribute ¶
type LazyAttribute struct { ObjectID string `json:"object_id,omitempty" form:"object_id"` Name string `json:"name" form:"name"` Type string `json:"type" form:"type"` Metadata map[string]Metadata `json:"metadata,omitempty" form:"metadata"` }
LazyAttribute represents a lazy attribute in the data model.
type Metadata ¶
type Metadata struct { Type string `json:"type" form:"type"` Value string `json:"value" form:"value"` }
Metadata represents metadata for attributes and commands.
type MissingFields ¶
type MissingFields struct { Fields vector.StringVector Message string }
type ReqCreateConfigGroup ¶
type ReqCreateConfigGroup struct {
Services []ConfigGroup `json:"services"`
}
Request struct for creating ConfigGroup
type RespHealthcheck ¶
type RespHealthcheck struct { LibVersion string `json:"libVersion"` Port string `json:"port"` BaseRoot string `json:"baseRoot"` Version string `json:"version"` }
RespHealthcheck represents the response of a health check request.
type RespReadConfigGroup ¶
type RespReadConfigGroup struct { Count int `json:"count"` Services []ConfigGroup `json:"services"` }
Response struct for reading ConfigGroup
type StaticAttribute ¶
type StaticAttribute struct { ObjectID string `json:"object_id,omitempty" form:"object_id"` Name string `json:"name" form:"name"` Type string `json:"type" form:"type"` Value any `json:"value" form:"value"` Metadata map[string]Metadata `json:"metadata,omitempty" form:"metadata"` }
StaticAttribute represents a static attribute in the data model.
func (*StaticAttribute) MarshalJSON ¶ added in v1.1.8
func (sa *StaticAttribute) MarshalJSON() ([]byte, error)