Documentation
¶
Index ¶
- type AppEngineService
- func (s *AppEngineService) AddDeviceAlias(realm string, deviceID string, aliasTag string, deviceAlias string, ...) error
- func (s *AppEngineService) DeleteDeviceAlias(realm string, deviceID string, aliasTag string, token string) error
- func (s *AppEngineService) GetAggregateDatastreamSnapshot(realm string, deviceIdentifier string, ...) (DatastreamAggregateValue, error)
- func (s *AppEngineService) GetAggregateDatastreamsTimeWindow(realm string, deviceIdentifier string, ...) ([]DatastreamAggregateValue, error)
- func (s *AppEngineService) GetAggregateParametricDatastreamSnapshot(realm string, deviceIdentifier string, ...) (map[string]DatastreamAggregateValue, error)
- func (s *AppEngineService) GetDatastreamSnapshot(realm string, deviceIdentifier string, ...) (map[string]DatastreamValue, error)
- func (s *AppEngineService) GetDatastreamsPaginator(realm string, deviceIdentifier string, ...) DatastreamPaginator
- func (s *AppEngineService) GetDatastreamsTimeWindowPaginator(realm string, deviceIdentifier string, ...) DatastreamPaginator
- func (s *AppEngineService) GetDevice(realm string, deviceIdentifier string, ...) (DeviceDetails, error)
- func (s *AppEngineService) GetDeviceIDFromAlias(realm string, deviceAlias string, token string) (string, error)
- func (s *AppEngineService) GetDeviceIDFromDeviceIdentifier(realm string, deviceIdentifier string, ...) (string, error)
- func (s *AppEngineService) GetLastAggregateDatastreams(realm string, deviceIdentifier string, ...) ([]DatastreamAggregateValue, error)
- func (s *AppEngineService) GetLastDatastreams(realm string, deviceIdentifier string, ...) ([]DatastreamValue, error)
- func (s *AppEngineService) GetProperties(realm string, deviceIdentifier string, ...) (map[string]interface{}, error)
- func (s *AppEngineService) ListDeviceAliases(realm string, deviceID string, token string) (map[string]string, error)
- func (s *AppEngineService) ListDeviceInterfaces(realm string, deviceIdentifier string, ...) ([]string, error)
- func (s *AppEngineService) ListDevices(realm string, token string) ([]string, error)
- type Client
- type DatastreamAggregateValue
- type DatastreamPaginator
- func (d *DatastreamPaginator) GetNextAggregatePage() ([]DatastreamAggregateValue, error)
- func (d *DatastreamPaginator) GetNextPage() ([]DatastreamValue, error)
- func (d *DatastreamPaginator) GetPageSize() int
- func (d *DatastreamPaginator) GetResultSetOrder() ResultSetOrder
- func (d *DatastreamPaginator) HasNextPage() bool
- func (d *DatastreamPaginator) Rewind()
- type DatastreamValue
- type DeviceDetails
- type DeviceIdentifierType
- type DeviceInterfaceIntrospection
- type HousekeepingService
- func (s *HousekeepingService) CreateRealm(realm string, publicKeyString string, token string) error
- func (s *HousekeepingService) CreateRealmWithDatacenterReplication(realm string, publicKeyString string, ...) error
- func (s *HousekeepingService) CreateRealmWithReplicationFactor(realm string, publicKeyString string, replicationFactor int, token string) error
- func (s *HousekeepingService) GetRealm(realm string, token string) (RealmDetails, error)
- func (s *HousekeepingService) ListRealms(token string) ([]string, error)
- type PairingService
- type RealmDetails
- type RealmManagementService
- func (s *RealmManagementService) DeleteInterface(realm string, interfaceName string, interfaceMajor int, token string) error
- func (s *RealmManagementService) DeleteTrigger(realm string, triggerName string, token string) error
- func (s *RealmManagementService) GetInterface(realm string, interfaceName string, interfaceMajor int, token string) (common.AstarteInterface, error)
- func (s *RealmManagementService) GetTrigger(realm string, triggerName string, token string) (map[string]interface{}, error)
- func (s *RealmManagementService) InstallInterface(realm string, interfacePayload common.AstarteInterface, token string) error
- func (s *RealmManagementService) InstallTrigger(realm string, triggerPayload interface{}, token string) error
- func (s *RealmManagementService) ListInterfaceMajorVersions(realm string, interfaceName string, token string) ([]int, error)
- func (s *RealmManagementService) ListInterfaces(realm string, token string) ([]string, error)
- func (s *RealmManagementService) ListTriggers(realm string, token string) ([]string, error)
- func (s *RealmManagementService) UpdateInterface(realm string, interfaceName string, interfaceMajor int, ...) error
- type ReplicationClass
- type ResultSetOrder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppEngineService ¶
type AppEngineService struct {
// contains filtered or unexported fields
}
AppEngineService is the API Client for AppEngine API
func (*AppEngineService) AddDeviceAlias ¶
func (s *AppEngineService) AddDeviceAlias(realm string, deviceID string, aliasTag string, deviceAlias string, token string) error
AddDeviceAlias adds an Alias to a Device
func (*AppEngineService) DeleteDeviceAlias ¶
func (s *AppEngineService) DeleteDeviceAlias(realm string, deviceID string, aliasTag string, token string) error
DeleteDeviceAlias deletes an Alias from a Device based on the Alias' tag
func (*AppEngineService) GetAggregateDatastreamSnapshot ¶
func (s *AppEngineService) GetAggregateDatastreamSnapshot(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, token string) (DatastreamAggregateValue, error)
GetAggregateDatastreamSnapshot returns the last value for a non-parametric, Datastream aggregate interface
func (*AppEngineService) GetAggregateDatastreamsTimeWindow ¶
func (s *AppEngineService) GetAggregateDatastreamsTimeWindow(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, interfacePath string, token string, since time.Time, to time.Time) ([]DatastreamAggregateValue, error)
GetAggregateDatastreamsTimeWindow returns the last count values for a Datastream aggregate interface
func (*AppEngineService) GetAggregateParametricDatastreamSnapshot ¶ added in v0.10.3
func (s *AppEngineService) GetAggregateParametricDatastreamSnapshot(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, token string) (map[string]DatastreamAggregateValue, error)
GetAggregateParametricDatastreamSnapshot returns the last value for a Parametric Datastream aggregate interface
func (*AppEngineService) GetDatastreamSnapshot ¶
func (s *AppEngineService) GetDatastreamSnapshot(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, token string) (map[string]DatastreamValue, error)
GetDatastreamSnapshot returns all the last values on all paths for a Datastream interface
func (*AppEngineService) GetDatastreamsPaginator ¶
func (s *AppEngineService) GetDatastreamsPaginator(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, interfacePath string, resultSetOrder ResultSetOrder, token string) DatastreamPaginator
GetDatastreamsPaginator returns a Paginator for all the values on a path for a Datastream interface.
func (*AppEngineService) GetDatastreamsTimeWindowPaginator ¶
func (s *AppEngineService) GetDatastreamsTimeWindowPaginator(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, interfacePath string, since time.Time, to time.Time, resultSetOrder ResultSetOrder, token string) DatastreamPaginator
GetDatastreamsTimeWindowPaginator returns a Paginator for all the values on a path in a specified time window for a Datastream interface.
func (*AppEngineService) GetDevice ¶
func (s *AppEngineService) GetDevice(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, token string) (DeviceDetails, error)
GetDevice returns the DeviceDetails of a single Device in the Realm
func (*AppEngineService) GetDeviceIDFromAlias ¶
func (s *AppEngineService) GetDeviceIDFromAlias(realm string, deviceAlias string, token string) (string, error)
GetDeviceIdFromAlias returns the Device ID of a device given one of its aliases
func (*AppEngineService) GetDeviceIDFromDeviceIdentifier ¶
func (s *AppEngineService) GetDeviceIDFromDeviceIdentifier(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, token string) (string, error)
GetDeviceIDFromDeviceIdentifier returns the DeviceID of a Device identified with a deviceIdentifier of type deviceIdentifierType.
func (*AppEngineService) GetLastAggregateDatastreams ¶
func (s *AppEngineService) GetLastAggregateDatastreams(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, interfacePath string, token string, count int) ([]DatastreamAggregateValue, error)
GetLastAggregateDatastreams returns the last count values for a Datastream aggregate interface
func (*AppEngineService) GetLastDatastreams ¶
func (s *AppEngineService) GetLastDatastreams(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, interfacePath string, limit int, token string) ([]DatastreamValue, error)
GetLastDatastreams returns all the last values on a path for a Datastream interface. If limit is <= 0, it returns all existing datastreams. Consider using a GetDatastreamsPaginator in that case.
func (*AppEngineService) GetProperties ¶
func (s *AppEngineService) GetProperties(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, token string) (map[string]interface{}, error)
GetProperties returns all the currently set Properties on a given Interface
func (*AppEngineService) ListDeviceAliases ¶
func (s *AppEngineService) ListDeviceAliases(realm string, deviceID string, token string) (map[string]string, error)
ListDeviceAliases is an helper to list all aliases of a Device
func (*AppEngineService) ListDeviceInterfaces ¶
func (s *AppEngineService) ListDeviceInterfaces(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, token string) ([]string, error)
ListDeviceInterfaces returns the list of Interfaces exposed by the Device's introspection
func (*AppEngineService) ListDevices ¶
func (s *AppEngineService) ListDevices(realm string, token string) ([]string, error)
ListDevices returns a list of Devices in the Realm
type Client ¶
type Client struct { UserAgent string AppEngine *AppEngineService Housekeeping *HousekeepingService Pairing *PairingService RealmManagement *RealmManagementService // contains filtered or unexported fields }
Client is the base Astarte API client. It provides access to all of Astarte's APIs.
func NewClientWithIndividualURLs ¶
func NewClientWithIndividualURLs(rawAppEngineURL string, rawHousekeepingURL string, rawPairingURL string, rawRealmManagementURL string, httpClient *http.Client) (*Client, error)
NewClientWithIndividualURLs creates a new Astarte API client with custom URL hierarchies. If an empty string is passed as one of the URLs, the corresponding Service will not be instantiated.
type DatastreamAggregateValue ¶
type DatastreamAggregateValue struct { Values orderedmap.OrderedMap Timestamp time.Time }
DatastreamAggregateValue represent one single Datastream Value for an Aggregate
func (*DatastreamAggregateValue) UnmarshalJSON ¶ added in v0.10.3
func (s *DatastreamAggregateValue) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a quoted json string to a DatastreamAggregateValue
type DatastreamPaginator ¶
type DatastreamPaginator struct {
// contains filtered or unexported fields
}
DatastreamPaginator handles a paginated set of results. It provides a one-directional iterator to call onto Astarte AppEngine API and handle potentially extremely large sets of results in chunk. You should prefer DatastreamPaginator rather than direct API calls if you expect your result set to be particularly large.
func (*DatastreamPaginator) GetNextAggregatePage ¶ added in v0.10.3
func (d *DatastreamPaginator) GetNextAggregatePage() ([]DatastreamAggregateValue, error)
GetNextAggregatePage retrieves the next result page from the paginator for an Aggregate interface. Returns the page as an array of DatastreamAggregateValue. If no more results are available, HasNextPage will return false. GetNextPage throws an error if no more pages are available.
func (*DatastreamPaginator) GetNextPage ¶
func (d *DatastreamPaginator) GetNextPage() ([]DatastreamValue, error)
GetNextPage retrieves the next result page from the paginator. Returns the page as an array of DatastreamValue. If no more results are available, HasNextPage will return false. GetNextPage throws an error if no more pages are available.
func (*DatastreamPaginator) GetPageSize ¶
func (d *DatastreamPaginator) GetPageSize() int
GetPageSize returns the page size for this paginator
func (*DatastreamPaginator) GetResultSetOrder ¶
func (d *DatastreamPaginator) GetResultSetOrder() ResultSetOrder
GetResultSetOrder returns the order in which samples are returned for this paginator
func (*DatastreamPaginator) HasNextPage ¶
func (d *DatastreamPaginator) HasNextPage() bool
HasNextPage returns whether this paginator can return more pages
func (*DatastreamPaginator) Rewind ¶
func (d *DatastreamPaginator) Rewind()
Rewind rewinds the simulator to the first page. GetNextPage will then return the first page of the call.
type DatastreamValue ¶
type DatastreamValue struct { Value interface{} `json:"value"` Timestamp time.Time `json:"timestamp"` ReceptionTimestamp time.Time `json:"reception_timestamp"` }
DatastreamValue represent one single Datastream Value
type DeviceDetails ¶
type DeviceDetails struct { TotalReceivedMessages int64 `json:"total_received_msgs"` TotalReceivedBytes uint64 `json:"total_received_bytes"` LastSeenIP net.IP `json:"last_seen_ip"` LastDisconnection time.Time `json:"last_disconnection"` LastCredentialsRequestIP net.IP `json:"last_credentials_request_ip"` LastConnection time.Time `json:"last_connection"` DeviceID string `json:"id"` FirstRegistration time.Time `json:"first_registration"` FirstCredentialsRequest time.Time `json:"first_credentials_request"` Connected bool `json:"connected"` Introspection map[string]DeviceInterfaceIntrospection `json:"introspection"` Aliases map[string]string `json:"aliases"` }
DeviceDetails maps to the JSON object returned by a Device Details call to AppEngine API
type DeviceIdentifierType ¶
type DeviceIdentifierType int
DeviceIdentifierType represents what kind of identifier is used for identifying a Device.
const ( // AutodiscoverDeviceIdentifier is the default, and uses heuristics to autodetermine which kind of // identifier is being used. AutodiscoverDeviceIdentifier DeviceIdentifierType = iota // AstarteDeviceID is the Device's ID in its standard format. AstarteDeviceID // AstarteDeviceAlias is one of the Device's Aliases. AstarteDeviceAlias )
type DeviceInterfaceIntrospection ¶
DeviceInterfaceIntrospection represents a single entry in a Device Introspection array retrieved from DeviceDetails
type HousekeepingService ¶
type HousekeepingService struct {
// contains filtered or unexported fields
}
HousekeepingService is the API Client for Housekeeping API
func (*HousekeepingService) CreateRealm ¶
func (s *HousekeepingService) CreateRealm(realm string, publicKeyString string, token string) error
CreateRealm creates a new Realm in the Cluster with default parameters.
func (*HousekeepingService) CreateRealmWithDatacenterReplication ¶
func (s *HousekeepingService) CreateRealmWithDatacenterReplication(realm string, publicKeyString string, datacenterReplicationFactors map[string]int, token string) error
CreateRealmWithDatacenterReplication creates a new Realm in the Cluster with a custom, per-datacenter Replication Factor. Both replicationClass and datacenterReplicationFactors must be provided.
func (*HousekeepingService) CreateRealmWithReplicationFactor ¶
func (s *HousekeepingService) CreateRealmWithReplicationFactor(realm string, publicKeyString string, replicationFactor int, token string) error
CreateRealmWithReplicationFactor creates a new Realm in the Cluster with a custom Replication Factor. The replication factor must always be > 0.
func (*HousekeepingService) GetRealm ¶
func (s *HousekeepingService) GetRealm(realm string, token string) (RealmDetails, error)
GetRealm returns data about a single Realm.
func (*HousekeepingService) ListRealms ¶
func (s *HousekeepingService) ListRealms(token string) ([]string, error)
ListRealms returns all realms in the cluster.
type PairingService ¶
type PairingService struct {
// contains filtered or unexported fields
}
PairingService is the API Client for Pairing API
func (*PairingService) RegisterDevice ¶
func (s *PairingService) RegisterDevice(realm string, deviceID string, token string) (string, error)
RegisterDevice registers a new device into the Realm. Returns the Credential Secret of the Device when successful. TODO: add support for initial_introspection
func (*PairingService) UnregisterDevice ¶ added in v0.10.4
func (s *PairingService) UnregisterDevice(realm string, deviceID string, token string) error
UnregisterDevice resets the registration state of a device. This makes it possible to register it again. All data belonging to the device will be left as is in Astarte.
type RealmDetails ¶
type RealmDetails struct { Name string `json:"realm_name"` JwtPublicKeyPEM string `json:"jwt_public_key_pem"` ReplicationClass ReplicationClass `json:"replication_class,omitempty"` ReplicationFactor int `json:"replication_factor,omitempty"` DatacenterReplicationFactors map[string]int `json:"datacenter_replication_factors,omitempty"` }
RealmDetails represents details of a single Realm
type RealmManagementService ¶
type RealmManagementService struct {
// contains filtered or unexported fields
}
RealmManagementService is the API Client for RealmManagement API
func (*RealmManagementService) DeleteInterface ¶
func (s *RealmManagementService) DeleteInterface(realm string, interfaceName string, interfaceMajor int, token string) error
DeleteInterface deletes a draft Interface from the Realm
func (*RealmManagementService) DeleteTrigger ¶
func (s *RealmManagementService) DeleteTrigger(realm string, triggerName string, token string) error
DeleteTrigger deletes a Trigger from the Realm
func (*RealmManagementService) GetInterface ¶
func (s *RealmManagementService) GetInterface(realm string, interfaceName string, interfaceMajor int, token string) (common.AstarteInterface, error)
GetInterface returns an interface, identified by a Major version, in a Realm
func (*RealmManagementService) GetTrigger ¶
func (s *RealmManagementService) GetTrigger(realm string, triggerName string, token string) (map[string]interface{}, error)
GetTrigger returns a trigger installed in a Realm
func (*RealmManagementService) InstallInterface ¶
func (s *RealmManagementService) InstallInterface(realm string, interfacePayload common.AstarteInterface, token string) error
InstallInterface installs a new major version of an Interface into the Realm
func (*RealmManagementService) InstallTrigger ¶
func (s *RealmManagementService) InstallTrigger(realm string, triggerPayload interface{}, token string) error
InstallTrigger installs a Trigger into the Realm
func (*RealmManagementService) ListInterfaceMajorVersions ¶
func (s *RealmManagementService) ListInterfaceMajorVersions(realm string, interfaceName string, token string) ([]int, error)
ListInterfaceMajorVersions returns all available major versions for a given Interface in a Realm.
func (*RealmManagementService) ListInterfaces ¶
func (s *RealmManagementService) ListInterfaces(realm string, token string) ([]string, error)
ListInterfaces returns all interfaces in a Realm.
func (*RealmManagementService) ListTriggers ¶
func (s *RealmManagementService) ListTriggers(realm string, token string) ([]string, error)
ListTriggers returns all triggers in a Realm.
func (*RealmManagementService) UpdateInterface ¶
func (s *RealmManagementService) UpdateInterface(realm string, interfaceName string, interfaceMajor int, interfacePayload common.AstarteInterface, token string) error
UpdateInterface updates an existing major version of an Interface to a new minor.
type ReplicationClass ¶
type ReplicationClass int
ReplicationClass represents different Replication Strategies for a Realm.
const ( // SimpleStrategy represents a Simple Replication Class, with a single Replication Factor SimpleStrategy ReplicationClass = iota // NetworkTopologyStrategy represents a Replication spread across DataCenters, with individual Replication Factors. NetworkTopologyStrategy )
func (ReplicationClass) MarshalJSON ¶
func (s ReplicationClass) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (ReplicationClass) String ¶
func (s ReplicationClass) String() string
func (*ReplicationClass) UnmarshalJSON ¶
func (s *ReplicationClass) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type ResultSetOrder ¶
type ResultSetOrder int
ResultSetOrder represents the order of the samples.
const ( // AscendingOrder means the Paginator will return results starting from the oldest. AscendingOrder ResultSetOrder = iota // DescendingOrder means the Paginator will return results starting from the oldest. DescendingOrder )