Documentation
¶
Index ¶
- Variables
- func ErrDifferentStatusCode(expected, received int) error
- func ErrInvalidDeviceID(deviceID string) error
- func WithDatacenterReplicationFactors(datacenterReplicationFactors map[string]int) realmOption
- func WithRealmName(name string) realmOption
- func WithRealmPublicKey(publicKey string) realmOption
- func WithReplicationFactor(replicationFactor int) realmOption
- type AddDeviceAliasRequest
- type AddDeviceAliasResponse
- type AddDeviceToGroupRequest
- type AstarteMQTTv1ProtocolInformation
- type AstarteRequest
- type AstarteResponse
- type Client
- func (c *Client) AddDeviceAlias(realm string, deviceID string, aliasTag string, deviceAlias string) (AstarteRequest, error)
- func (c *Client) AddDeviceToGroup(realm, groupName, deviceID string) (AstarteRequest, error)
- func (c *Client) CreateGroup(realm, groupName string, deviceIDList []string) (AstarteRequest, error)
- func (c *Client) CreateRealm(opts ...realmOption) (AstarteRequest, error)
- func (c *Client) DeleteDeviceAlias(realm string, deviceID string, aliasTag string) (AstarteRequest, error)
- func (c *Client) DeleteDeviceAttribute(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (AstarteRequest, error)
- func (c *Client) DeleteInterface(realm string, interfaceName string, interfaceMajor int) (AstarteRequest, error)
- func (c *Client) DeleteTrigger(realm string, triggerName string) (AstarteRequest, error)
- func (c *Client) DeleteTriggerDeliveryPolicy(realm string, policyName string) (AstarteRequest, error)
- func (c *Client) GetAllProperties(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) GetAppengineURL() (ret *url.URL)
- func (c *Client) GetDatastreamIndividualPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (Paginator, error)
- func (c *Client) GetDatastreamIndividualSnapshot(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) GetDatastreamIndividualTimeWindowPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (Paginator, error)
- func (c *Client) GetDatastreamObjectPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (Paginator, error)
- func (c *Client) GetDatastreamObjectSnapshot(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) GetDatastreamObjectTimeWindowPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (Paginator, error)
- func (c *Client) GetDeviceDetails(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) GetDeviceIDFromAlias(realm string, deviceAlias string) (AstarteRequest, error)
- func (c *Client) GetDeviceListPaginator(realm string, pageSize int, format DeviceResultFormat) (Paginator, error)
- func (c *Client) GetDevicesStats(realm string) (AstarteRequest, error)
- func (c *Client) GetHousekeepingURL() (ret *url.URL)
- func (c *Client) GetInterface(realm string, interfaceName string, interfaceMajor int) (AstarteRequest, error)
- func (c *Client) GetMQTTv1ProtocolInformationForDevice(realm, deviceID string) (AstarteRequest, error)
- func (c *Client) GetPairingURL() (ret *url.URL)
- func (c *Client) GetProperty(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) GetRealm(realm string) (AstarteRequest, error)
- func (c *Client) GetRealmManagementURL() (ret *url.URL)
- func (c *Client) GetTrigger(realm string, triggerName string) (AstarteRequest, error)
- func (c *Client) GetTriggerDeliveryPolicy(realm string, policyName string) (AstarteRequest, error)
- func (c *Client) InstallInterface(realm string, interfacePayload interfaces.AstarteInterface, isAsync bool) (AstarteRequest, error)
- func (c *Client) InstallTrigger(realm string, triggerPayload any) (AstarteRequest, error)
- func (c *Client) InstallTriggerDeliveryPolicy(realm string, policyPayload any) (AstarteRequest, error)
- func (c *Client) ListDeviceAliases(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) ListDeviceAttributes(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType) (AstarteRequest, error)
- func (c *Client) ListDeviceInterfaces(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) ListGroupDevices(realm, groupName string, pageSize int, format DeviceResultFormat) (Paginator, error)
- func (c *Client) ListGroups(realm string) (AstarteRequest, error)
- func (c *Client) ListInterfaceMajorVersions(realm string, interfaceName string) (AstarteRequest, error)
- func (c *Client) ListInterfaces(realm string) (AstarteRequest, error)
- func (c *Client) ListRealms() (AstarteRequest, error)
- func (c *Client) ListTriggerDeliveryPolicies(realm string) (AstarteRequest, error)
- func (c *Client) ListTriggers(realm string) (AstarteRequest, error)
- func (c *Client) ObtainNewMQTTv1CertificateForDevice(realm, deviceID, csr string) (AstarteRequest, error)
- func (c *Client) RegisterDevice(realm string, deviceID string) (AstarteRequest, error)
- func (c *Client) RemoveDeviceFromGroup(realm, groupName, deviceID string) (AstarteRequest, error)
- func (c *Client) SendData(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (AstarteRequest, error)
- func (c *Client) SendDatastream(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (AstarteRequest, error)
- func (c *Client) SetDeviceAttribute(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (AstarteRequest, error)
- func (c *Client) SetDeviceInhibited(realm string, deviceIdentifier string, ...) (AstarteRequest, error)
- func (c *Client) SetProperty(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (AstarteRequest, error)
- func (c *Client) UnregisterDevice(realm string, deviceID string) (AstarteRequest, error)
- func (c *Client) UnsetProperty(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, ...) (AstarteRequest, error)
- func (c *Client) UpdateInterface(realm string, interfaceName string, interfaceMajor int, ...) (AstarteRequest, error)
- type CreateGroupRequest
- type CreateGroupResponse
- type CreateRealmRequest
- type CreateRealmResponse
- type DatastreamIndividualValue
- type DatastreamObjectValue
- type DatastreamPaginator
- type DeleteDeviceAliasRequest
- type DeleteDeviceAttributeRequest
- type DeleteInterfaceRequest
- type DeleteTriggerDeliveryPolicyRequest
- type DeleteTriggerRequest
- type DeviceDetails
- type DeviceIdentifierType
- type DeviceInterfaceIntrospection
- type DeviceListPaginator
- type DeviceResultFormat
- type DevicesAndGroup
- type DevicesStats
- type Empty
- type GetDatastreamSnapshotRequest
- type GetDatastreamSnapshotResponse
- type GetDeviceDetailsRequest
- type GetDeviceDetailsResponse
- type GetDeviceIDFromAliasRequest
- type GetDeviceIDFromAliasResponse
- type GetDeviceStatsResponse
- type GetDevicesStatsRequest
- type GetInterfaceRequest
- type GetInterfaceResponse
- type GetNextDatastreamPageRequest
- type GetNextDatastreamPageResponse
- type GetNextDeviceListPageRequest
- type GetNextDeviceListPageResponse
- type GetPropertiesRequest
- type GetPropertiesResponse
- type GetRealmRequest
- type GetRealmResponse
- type GetTriggerDeliveryPolicyRequest
- type GetTriggerDeliveryPolicyResponse
- type GetTriggerRequest
- type GetTriggerResponse
- type InhibitDeviceRequest
- type InstallInterfaceRequest
- type InstallInterfaceResponse
- type InstallTriggerDeliveryPolicyRequest
- type InstallTriggerDeliveryPolicyResponse
- type InstallTriggerRequest
- type InstallTriggerResponse
- type Links
- type ListDeviceAliasesRequest
- type ListDeviceAliasesResponse
- type ListDeviceAttributesRequest
- type ListDeviceAttributesResponse
- type ListDeviceInterfacesRequest
- type ListDeviceInterfacesResponse
- type ListGroupsRequest
- type ListGroupsResponse
- type ListInterfaceMajorVersionsRequest
- type ListInterfaceMajorVersionsResponse
- type ListInterfacesRequest
- type ListInterfacesResponse
- type ListRealmsRequest
- type ListRealmsResponse
- type ListTriggerDeliveryPoliciesRequest
- type ListTriggerDeliveryPoliciesResponse
- type ListTriggersRequest
- type ListTriggersResponse
- type Mqttv1DeviceInformationRequest
- type Mqttv1DeviceInformationResponse
- type NewDeviceCertificateRequest
- type NewDeviceCertificateResponse
- type NoDataResponse
- type Option
- func WithAppEngineURL(appEngineURL string) Option
- func WithBaseURL(baseURL string) Option
- func WithExpiry(expirySeconds int) Option
- func WithHTTPClient(httpClient *http.Client) Option
- func WithHousekeepingURL(housekeepingURL string) Option
- func WithJWT(token string) Option
- func WithPairingURL(pairingURL string) Option
- func WithPrivateKey[T privateKeyProvider](privateKey T) Option
- func WithRealmManagementURL(realmManagementURL string) Option
- func WithUserAgent(userAgent string) Option
- type Paginator
- type PropertyValue
- type RealmDetails
- type RegisterDeviceRequest
- type RegisterDeviceResponse
- type RemoveDeviceFromGroupRequest
- type ResultSetOrder
- type SendDatastreamRequest
- type SetDeviceAttributeRequest
- type SetPropertyRequest
- type UnregisterDeviceRequest
- type UnsetPropertyRequest
- type UpdateInterfaceRequest
Constants ¶
This section is empty.
Variables ¶
var ( ErrConflictingUrls = errors.New("Conflicting URLs provided") ErrNoUrlsProvided = errors.New("No Astarte URL(s) provided") ErrNoPrivateKeyProvided = errors.New("No Astarte private key provided") ErrRealmNameNotProvided = errors.New("Realm name was not provided") ErrRealmPublicKeyNotProvided = errors.New("Realm public key was not provided") ErrTooManyReplicationFactors = errors.New("Can't have both replication factor and datacenter replication factors") ErrNegativeReplicationFactor = errors.New("Replication factor must be a strictly positive integer") ErrTooHighExpiry = errors.New("Expiry for tokens generated from a private key must be less than 5 minutes") ErrNoAuthProvided = errors.New("Neither an Astarte JWT nor an Astarte private key were provided") ErrBothJWTAndPrivateKey = errors.New("Can't provide both an Astarte JWT and an Astarte private key") ErrExpiryButNoPrivateKeyProvided = errors.New("Expiry was set, but no Astarte private key provided") )
Functions ¶
func ErrDifferentStatusCode ¶ added in v0.91.0
func ErrInvalidDeviceID ¶ added in v0.91.0
func WithDatacenterReplicationFactors ¶ added in v0.91.0
Sets the per-datacenter Replication Factor for a new realm. This is the way to go for production deployments. nolint:golint,revive
func WithRealmName ¶ added in v0.91.0
func WithRealmName(name string) realmOption
Sets the name for a new Realm. nolint:golint,revive
func WithRealmPublicKey ¶ added in v0.91.0
func WithRealmPublicKey(publicKey string) realmOption
Sets the public key for a new Realm. nolint:golint,revive
func WithReplicationFactor ¶ added in v0.91.0
func WithReplicationFactor(replicationFactor int) realmOption
Sets the Replication factor for a new Realm in a single datacenter. Production-ready deployments usually are replicated on more datacenters, but if you need to use just one, set a value at least higher than 1. nolint:golint,revive
Types ¶
type AddDeviceAliasRequest ¶ added in v0.91.0
type AddDeviceAliasRequest struct {
// contains filtered or unexported fields
}
func (AddDeviceAliasRequest) Run ¶ added in v0.91.0
func (r AddDeviceAliasRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (AddDeviceAliasRequest) ToCurl ¶ added in v0.91.0
func (r AddDeviceAliasRequest) ToCurl(_ *Client) string
type AddDeviceAliasResponse ¶ added in v0.91.0
type AddDeviceAliasResponse struct {
// contains filtered or unexported fields
}
type AddDeviceToGroupRequest ¶ added in v0.91.0
type AddDeviceToGroupRequest struct {
// contains filtered or unexported fields
}
func (AddDeviceToGroupRequest) Run ¶ added in v0.91.0
func (r AddDeviceToGroupRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (AddDeviceToGroupRequest) ToCurl ¶ added in v0.91.0
func (r AddDeviceToGroupRequest) ToCurl(_ *Client) string
type AstarteMQTTv1ProtocolInformation ¶
type AstarteMQTTv1ProtocolInformation struct {
BrokerURL string `json:"broker_url"`
}
type AstarteRequest ¶ added in v0.91.0
type AstarteRequest interface { // Run executes an astarteRequest that was built using functions from this package. // To retrieve the result, see the Parse function. Run(c *Client) (AstarteResponse, error) // ToCurl returns the curl command equivalent to the provided astarteRequest. // This does not execute neither the request nor the command. ToCurl(_ *Client) string }
type AstarteResponse ¶ added in v0.91.0
type AstarteResponse interface { // Parse reads the AstarteResponse returned by Run and returns either a well-typed // response payload or an error. Parse() (any, error) // Raw allows to supply a custom http Response handling function for the Astarte // response. The function does not need to close the response body. // Raw simply returns the value returned by the handling function. Raw(func(*http.Response) any) any }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.91.0
The New function creates a new Astarte API client. You must provide at least an Astarte base URL and an auth resource (JWT or private key). If no other options are specified, the following is assumed: - standard Astarte URL hierarchy - standard HTTP client - "astarte-go" as user agent
func (*Client) AddDeviceAlias ¶ added in v0.91.0
func (c *Client) AddDeviceAlias(realm string, deviceID string, aliasTag string, deviceAlias string) (AstarteRequest, error)
AddDeviceAlias builds a request to add an Alias to a Device
func (*Client) AddDeviceToGroup ¶ added in v0.91.0
func (c *Client) AddDeviceToGroup(realm, groupName, deviceID string) (AstarteRequest, error)
AddDeviceToGroup builds a request to add a device to a group. Only valid Astarte device IDs can be used when adding a device to a group.
func (*Client) CreateGroup ¶ added in v0.91.0
func (c *Client) CreateGroup(realm, groupName string, deviceIDList []string) (AstarteRequest, error)
CreateGroup builds a request to create a group with the given deviceIDList in the Realm. Only valid Astarte device IDs can be used when adding devices to a group.
func (*Client) CreateRealm ¶ added in v0.91.0
func (c *Client) CreateRealm(opts ...realmOption) (AstarteRequest, error)
CreateRealm builds a request to create a new Realm in the Cluster with default parameters. When running in production, it is advised to use a NetworkTopologyStrategy, or at least a replication factor > 1. You can create a realm with: c.NewRealm(client.WithRealmName("test"), client.WithRealmPublicKey("YOUR_REALM_PUBLIC_KEY"), client.WithReplicationFactor(3))
func (*Client) DeleteDeviceAlias ¶ added in v0.91.0
func (c *Client) DeleteDeviceAlias(realm string, deviceID string, aliasTag string) (AstarteRequest, error)
DeleteDeviceAlias builds a request to delete an Alias from a Device based on the Alias' tag.
func (*Client) DeleteDeviceAttribute ¶ added in v0.91.0
func (c *Client) DeleteDeviceAttribute(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, attributeKey string) (AstarteRequest, error)
DeleteDeviceAttribute builds a request to delete an Attribute key and its value from a Device
func (*Client) DeleteInterface ¶ added in v0.91.0
func (c *Client) DeleteInterface(realm string, interfaceName string, interfaceMajor int) (AstarteRequest, error)
DeleteInterface builds a request to delete a major version of an Interface into the Realm.
func (*Client) DeleteTrigger ¶ added in v0.91.0
func (c *Client) DeleteTrigger(realm string, triggerName string) (AstarteRequest, error)
DeleteTrigger builds a request to delete a Trigger from the Realm.
func (*Client) DeleteTriggerDeliveryPolicy ¶ added in v0.91.1
func (c *Client) DeleteTriggerDeliveryPolicy(realm string, policyName string) (AstarteRequest, error)
DeleteTriggerDeliveryPolicy builds a request to delete a Trigger delivery policy from the Realm.
func (*Client) GetAllProperties ¶ added in v0.91.0
func (c *Client) GetAllProperties(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string) (AstarteRequest, error)
GetAllProperties builds a request to return all the currently set Properties on a given interface.
func (*Client) GetAppengineURL ¶ added in v0.91.0
func (*Client) GetDatastreamIndividualPaginator ¶ added in v0.91.0
func (c *Client) GetDatastreamIndividualPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName, interfacePath string, resultSetOrder ResultSetOrder, pageSize int) (Paginator, error)
GetDatastreamIndividualPaginator returns a Paginator for all the values on a path for a Datastream interface with individual aggregation.
func (*Client) GetDatastreamIndividualSnapshot ¶ added in v0.91.0
func (c *Client) GetDatastreamIndividualSnapshot(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string) (AstarteRequest, error)
GetDatastreamIndividualSnapshot builds a request to return all the last values on all paths for a Datastream individual aggregate interface.
func (*Client) GetDatastreamIndividualTimeWindowPaginator ¶ added in v0.91.0
func (c *Client) GetDatastreamIndividualTimeWindowPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName, interfacePath string, since, to time.Time, resultSetOrder ResultSetOrder, pageSize int) (Paginator, error)
GetDatastreamIndividualTimeWindowPaginator returns a Paginator for all the values on a path in a specified time window for a Datastream interface with individual aggregation.
func (*Client) GetDatastreamObjectPaginator ¶ added in v0.91.0
func (c *Client) GetDatastreamObjectPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName, interfacePath string, resultSetOrder ResultSetOrder, pageSize int) (Paginator, error)
GetDatastreamObjectPaginator returns a Paginator for all the values on a path for a Datastream interface with object aggregation.
func (*Client) GetDatastreamObjectSnapshot ¶ added in v0.91.0
func (c *Client) GetDatastreamObjectSnapshot(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string) (AstarteRequest, error)
GetDatastreamObjectSnapshot builds a request to return the last value for a Datastream object aggregate interface
func (*Client) GetDatastreamObjectTimeWindowPaginator ¶ added in v0.91.0
func (c *Client) GetDatastreamObjectTimeWindowPaginator(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName, interfacePath string, since, to time.Time, resultSetOrder ResultSetOrder, pageSize int) (Paginator, error)
GetDatastreamObjectTimeWindowPaginator returns a Paginator for all the values on a path in a specified time window for a Datastream interface with object aggregation.
func (*Client) GetDeviceDetails ¶ added in v0.91.0
func (c *Client) GetDeviceDetails(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType) (AstarteRequest, error)
GetDevice builds a request to return the DeviceDetails of a single Device in the Realm.
func (*Client) GetDeviceIDFromAlias ¶ added in v0.91.0
func (c *Client) GetDeviceIDFromAlias(realm string, deviceAlias string) (AstarteRequest, error)
GetDeviceIDFromAlias builds a request to return the Device ID of a device given one of its aliases.
func (*Client) GetDeviceListPaginator ¶ added in v0.91.0
func (c *Client) GetDeviceListPaginator(realm string, pageSize int, format DeviceResultFormat) (Paginator, error)
GetDeviceListPaginator returns a Paginator for all the Devices in the realm. The paginator can return different result formats depending on the format parameter.
func (*Client) GetDevicesStats ¶ added in v0.91.0
func (c *Client) GetDevicesStats(realm string) (AstarteRequest, error)
GetDevicesStats builds a request to return the DevicesStats of a Realm.
func (*Client) GetHousekeepingURL ¶ added in v0.91.0
func (*Client) GetInterface ¶ added in v0.91.0
func (c *Client) GetInterface(realm string, interfaceName string, interfaceMajor int) (AstarteRequest, error)
GetInterface builds a request retrieve an interface, identified by a Major version, in a Realm.
func (*Client) GetMQTTv1ProtocolInformationForDevice ¶ added in v0.91.0
func (c *Client) GetMQTTv1ProtocolInformationForDevice(realm, deviceID string) (AstarteRequest, error)
GetMQTTv1ProtocolInformationForDevice builds a request for retrieving protocol information (such as the broker URL) for devices running on astarte_mqtt_v1. This API is meant to be called by the device, and the Client that executes (Runs) the request needs to have the Device's Credentials Secret as its token.
func (*Client) GetPairingURL ¶ added in v0.91.0
func (*Client) GetProperty ¶ added in v0.91.0
func (c *Client) GetProperty(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, interfacePath string) (AstarteRequest, error)
GetProperty builds a request to return the currently set Property on a given Interface at a given path.
func (*Client) GetRealm ¶ added in v0.91.0
func (c *Client) GetRealm(realm string) (AstarteRequest, error)
GetRealm builds a request to get data about a single Realm.
func (*Client) GetRealmManagementURL ¶ added in v0.91.0
func (*Client) GetTrigger ¶ added in v0.91.0
func (c *Client) GetTrigger(realm string, triggerName string) (AstarteRequest, error)
GetTrigger builds a request to return a trigger installed in a Realm.
func (*Client) GetTriggerDeliveryPolicy ¶ added in v0.91.1
func (c *Client) GetTriggerDeliveryPolicy(realm string, policyName string) (AstarteRequest, error)
GetTriggerDeliveryPolicy builds a request to return a trigger delivery policy installed in a Realm.
func (*Client) InstallInterface ¶ added in v0.91.0
func (c *Client) InstallInterface(realm string, interfacePayload interfaces.AstarteInterface, isAsync bool) (AstarteRequest, error)
InstallInterface builds a request to install a new major version of an Interface into the Realm.
func (*Client) InstallTrigger ¶ added in v0.91.0
func (c *Client) InstallTrigger(realm string, triggerPayload any) (AstarteRequest, error)
InstallTrigger builds a request to install a Trigger into the Realm.
func (*Client) InstallTriggerDeliveryPolicy ¶ added in v0.91.1
func (c *Client) InstallTriggerDeliveryPolicy(realm string, policyPayload any) (AstarteRequest, error)
InstallTriggerDeliveryPolicy builds a request to install a Trigger delivery policy into the Realm.
func (*Client) ListDeviceAliases ¶ added in v0.91.0
func (c *Client) ListDeviceAliases(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType) (AstarteRequest, error)
ListDeviceAliases builds a request to list all aliases of a Device.
func (*Client) ListDeviceAttributes ¶ added in v0.91.0
func (c *Client) ListDeviceAttributes(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType) (AstarteRequest, error)
ListDeviceAttributes builds a request to list all Attributes of a Device.
func (*Client) ListDeviceInterfaces ¶ added in v0.91.0
func (c *Client) ListDeviceInterfaces(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType) (AstarteRequest, error)
ListDeviceInterfaces builds a request to retrieve the list of interfaces exposed by the Device's introspection.
func (*Client) ListGroupDevices ¶ added in v0.91.0
func (c *Client) ListGroupDevices(realm, groupName string, pageSize int, format DeviceResultFormat) (Paginator, error)
ListGroupDevices builds a paginator to request a list of the devices that belong to a group.
func (*Client) ListGroups ¶ added in v0.91.0
func (c *Client) ListGroups(realm string) (AstarteRequest, error)
ListGroups builds a request to list the groups in a Realm.
func (*Client) ListInterfaceMajorVersions ¶ added in v0.91.0
func (c *Client) ListInterfaceMajorVersions(realm string, interfaceName string) (AstarteRequest, error)
ListInterfaceMajorVersions builds a request to return all available major versions for a given Interface in a Realm.
func (*Client) ListInterfaces ¶ added in v0.91.0
func (c *Client) ListInterfaces(realm string) (AstarteRequest, error)
ListInterfaces builds a request to return all interfaces in a Realm.
func (*Client) ListRealms ¶ added in v0.91.0
func (c *Client) ListRealms() (AstarteRequest, error)
ListRealms builds a request to list all realms in the cluster.
func (*Client) ListTriggerDeliveryPolicies ¶ added in v0.91.1
func (c *Client) ListTriggerDeliveryPolicies(realm string) (AstarteRequest, error)
ListTriggerDeliveryPolicies builds a request to return all triggers delivery policies in a Realm.
func (*Client) ListTriggers ¶ added in v0.91.0
func (c *Client) ListTriggers(realm string) (AstarteRequest, error)
ListTriggers builds a request to return all triggers in a Realm.
func (*Client) ObtainNewMQTTv1CertificateForDevice ¶ added in v0.91.0
func (c *Client) ObtainNewMQTTv1CertificateForDevice(realm, deviceID, csr string) (AstarteRequest, error)
ObtainNewMQTTv1CertificateForDevice builds a request for retrieving a valid SSL Certificate for Devices running on astarte_mqtt_v1. This API is meant to be called by the device, and the Client that executes (Runs) the request needs to have the Device's Credentials Secret as its token.
func (*Client) RegisterDevice ¶ added in v0.91.0
func (c *Client) RegisterDevice(realm string, deviceID string) (AstarteRequest, error)
RegisterDevice builds a request to register a new device into the Realm. TODO: add support for initial_introspection
func (*Client) RemoveDeviceFromGroup ¶ added in v0.91.0
func (c *Client) RemoveDeviceFromGroup(realm, groupName, deviceID string) (AstarteRequest, error)
RemoveDeviceFromGroup builds a request to removes a device from the group. Only valid Astarte device IDs can be used when removing a device from a group.
func (*Client) SendData ¶ added in v0.91.0
func (c *Client) SendData(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, astarteInterface interfaces.AstarteInterface, interfacePath string, payload any) (AstarteRequest, error)
SendData builds a request to send data on the specified interface. It performs all validity checks on the Interface object before moving forward with the operation, as such it is assumed that the operation will be always validated on the client side. If you have access to a native Interface object, accessing this method rather than the lower level ones is advised. payload must match a compatible type for the Interface path. In case of an aggregate interface, payload *must* be a map[string]interface{}, and each payload will be individually checked.
func (*Client) SendDatastream ¶ added in v0.91.0
func (c *Client) SendDatastream(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName, interfacePath string, payload any) (AstarteRequest, error)
SendDatastream builds a request to send a datastream to the given interface without additional checks. payload must be of a type compatible with the interface's endpoint. Any errors will be returned on the server side or in payload marshaling. If you have a native AstarteInterface object, calling SendData is advised
func (*Client) SetDeviceAttribute ¶ added in v0.91.0
func (c *Client) SetDeviceAttribute(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, attributeKey, attributeValue string) (AstarteRequest, error)
SetDeviceAttribute builds a request to set an Attribute key to a certain value for a Device
func (*Client) SetDeviceInhibited ¶ added in v0.91.0
func (c *Client) SetDeviceInhibited(realm string, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, inhibit bool) (AstarteRequest, error)
SetDeviceInhibited builds a request to set the Credentials Inhibition state of a Device.
func (*Client) SetProperty ¶ added in v0.91.0
func (c *Client) SetProperty(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName, interfacePath string, payload any) (AstarteRequest, error)
SetProperty builds a request to set a property on the given interface without additional checks. payload must be of a type compatible with the interface's endpoint. Any errors will be returned on the server side or in payload marshaling. If you have a native AstarteInterface object, calling SendData is advised
func (*Client) UnregisterDevice ¶ added in v0.91.0
func (c *Client) UnregisterDevice(realm string, deviceID string) (AstarteRequest, error)
UnregisterDevice builds a request to reset the registration state of a device. Once the request is run, this makes it possible to register it again. All data belonging to the device will be left as is in Astarte.
func (*Client) UnsetProperty ¶ added in v0.91.0
func (c *Client) UnsetProperty(realm, deviceIdentifier string, deviceIdentifierType DeviceIdentifierType, interfaceName string, interfacePath string) (AstarteRequest, error)
UnsetProperty builds a request to delete a property on the given interface without additional checks.
func (*Client) UpdateInterface ¶ added in v0.91.0
func (c *Client) UpdateInterface(realm string, interfaceName string, interfaceMajor int, interfacePayload interfaces.AstarteInterface, isAsync bool) (AstarteRequest, error)
UpdateInterface builds a request to update an existing major version of an Interface to a new minor.
type CreateGroupRequest ¶ added in v0.91.0
type CreateGroupRequest struct {
// contains filtered or unexported fields
}
func (CreateGroupRequest) Run ¶ added in v0.91.0
func (r CreateGroupRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (CreateGroupRequest) ToCurl ¶ added in v0.91.0
func (r CreateGroupRequest) ToCurl(_ *Client) string
type CreateGroupResponse ¶ added in v0.91.0
type CreateGroupResponse struct {
// contains filtered or unexported fields
}
func (CreateGroupResponse) Parse ¶ added in v0.91.0
func (r CreateGroupResponse) Parse() (any, error)
Parses data obtained by performing a request create a new group. Returns the group's details as a DevicesAndGroup struct.
type CreateRealmRequest ¶ added in v0.91.0
type CreateRealmRequest struct {
// contains filtered or unexported fields
}
func (CreateRealmRequest) Run ¶ added in v0.91.0
func (r CreateRealmRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (CreateRealmRequest) ToCurl ¶ added in v0.91.0
func (r CreateRealmRequest) ToCurl(_ *Client) string
type CreateRealmResponse ¶ added in v0.91.0
type CreateRealmResponse struct {
// contains filtered or unexported fields
}
func (CreateRealmResponse) Parse ¶ added in v0.91.0
func (r CreateRealmResponse) Parse() (any, error)
Parses data obtained by performing a request to create a realm. Returns the realm's details as a RealmDetails struct.
type DatastreamIndividualValue ¶ added in v0.91.0
type DatastreamIndividualValue struct { Value interface{} `json:"value"` Timestamp time.Time `json:"timestamp"` ReceptionTimestamp time.Time `json:"reception_timestamp,omitempty"` }
DatastreamIndividualValue represent one single Datastream value on an interface with Individual aggregation.
type DatastreamObjectValue ¶ added in v0.91.0
type DatastreamObjectValue struct { Values orderedmap.OrderedMap Timestamp time.Time }
DatastreamIndividualValue represent one Datastream value on an interface with Object aggregation.
func (*DatastreamObjectValue) UnmarshalJSON ¶ added in v0.91.0
func (s *DatastreamObjectValue) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a quoted json string to a DatastreamObjectValue
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.
func (*DatastreamPaginator) GetNextPage ¶
func (d *DatastreamPaginator) GetNextPage() (AstarteRequest, error)
GetNextPage returns a request to get the next result page from the paginator. If no more results are available, HasNextPage will return false. GetNextPage throws an error if no more pages are available or if an invalid parameter is specified.
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 paginator to the first page. GetNextPage will then return the first page of the call.
type DeleteDeviceAliasRequest ¶ added in v0.91.0
type DeleteDeviceAliasRequest struct {
// contains filtered or unexported fields
}
func (DeleteDeviceAliasRequest) Run ¶ added in v0.91.0
func (r DeleteDeviceAliasRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (DeleteDeviceAliasRequest) ToCurl ¶ added in v0.91.0
func (r DeleteDeviceAliasRequest) ToCurl(_ *Client) string
type DeleteDeviceAttributeRequest ¶ added in v0.91.0
type DeleteDeviceAttributeRequest struct {
// contains filtered or unexported fields
}
func (DeleteDeviceAttributeRequest) Run ¶ added in v0.91.0
func (r DeleteDeviceAttributeRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (DeleteDeviceAttributeRequest) ToCurl ¶ added in v0.91.0
func (r DeleteDeviceAttributeRequest) ToCurl(_ *Client) string
type DeleteInterfaceRequest ¶ added in v0.91.0
type DeleteInterfaceRequest struct {
// contains filtered or unexported fields
}
func (DeleteInterfaceRequest) Run ¶ added in v0.91.0
func (r DeleteInterfaceRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (DeleteInterfaceRequest) ToCurl ¶ added in v0.91.0
func (r DeleteInterfaceRequest) ToCurl(_ *Client) string
type DeleteTriggerDeliveryPolicyRequest ¶ added in v0.91.1
type DeleteTriggerDeliveryPolicyRequest struct {
// contains filtered or unexported fields
}
func (DeleteTriggerDeliveryPolicyRequest) Run ¶ added in v0.91.1
func (r DeleteTriggerDeliveryPolicyRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (DeleteTriggerDeliveryPolicyRequest) ToCurl ¶ added in v0.91.1
func (r DeleteTriggerDeliveryPolicyRequest) ToCurl(_ *Client) string
type DeleteTriggerRequest ¶ added in v0.91.0
type DeleteTriggerRequest struct {
// contains filtered or unexported fields
}
func (DeleteTriggerRequest) Run ¶ added in v0.91.0
func (r DeleteTriggerRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (DeleteTriggerRequest) ToCurl ¶ added in v0.91.0
func (r DeleteTriggerRequest) ToCurl(_ *Client) string
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"` CredentialsInhibited bool `json:"credentials_inhibited"` Connected bool `json:"connected"` Introspection map[string]DeviceInterfaceIntrospection `json:"introspection"` Aliases map[string]string `json:"aliases"` PreviousInterfaces []DeviceInterfaceIntrospection `json:"previous_interfaces,omitempty"` Attributes map[string]string `json:"attributes,omitempty"` }
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 ¶
type DeviceInterfaceIntrospection struct { Name string `json:"name,omitempty"` Major int `json:"major"` Minor int `json:"minor"` ExchangedMessages uint64 `json:"exchanged_msgs,omitempty"` ExchangedBytes uint64 `json:"exchanged_bytes,omitempty"` }
DeviceInterfaceIntrospection represents a single entry in a Device Introspection array retrieved from DeviceDetails.
type DeviceListPaginator ¶
type DeviceListPaginator struct {
// contains filtered or unexported fields
}
DeviceListPaginator 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 DeviceListPaginator rather than direct API calls if you expect your result set to be particularly large.
func (*DeviceListPaginator) GetNextPage ¶
func (d *DeviceListPaginator) GetNextPage() (AstarteRequest, error)
GetNextPage returns a request to get the next result page from the paginator. If no more results are available, HasNextPage will return false. GetNextPage throws an error if no more pages are available.
func (*DeviceListPaginator) GetPageSize ¶
func (d *DeviceListPaginator) GetPageSize() int
GetPageSize returns the page size for this paginator
func (*DeviceListPaginator) HasNextPage ¶
func (d *DeviceListPaginator) HasNextPage() bool
HasNextPage returns whether this paginator can return more pages
func (*DeviceListPaginator) Rewind ¶
func (d *DeviceListPaginator) Rewind()
Rewind rewinds the simulator to the first page. GetNextPage will then return the first page of the call.
type DeviceResultFormat ¶
type DeviceResultFormat int
DeviceResultFormat represents the format of the Device returned in the Device list.
const ( // DeviceIDFormat means the Paginator will return a list of strings // representing the Device ID of the Devices. DeviceIDFormat DeviceResultFormat = iota // DeviceDetailsFormat means the Paginator will return a list of // DeviceDetails structs DeviceDetailsFormat )
type DevicesAndGroup ¶ added in v0.91.0
type DevicesAndGroup struct { GroupName string `json:"group_name"` Devices []string `json:"devices"` }
DevicesAndGroup maps to the JSON object returned by a Create Group call to AppEngine API.
type DevicesStats ¶
type DevicesStats struct { TotalDevices int64 `json:"total_devices"` ConnectedDevices int64 `json:"connected_devices"` }
DevicesStats maps to the JSON object returned by a Device Stats call to AppEngine API.
type Empty ¶ added in v0.91.0
type Empty struct{}
The Empty struct represent errors, method implementations are bogus
type GetDatastreamSnapshotRequest ¶ added in v0.91.0
type GetDatastreamSnapshotRequest struct {
// contains filtered or unexported fields
}
func (GetDatastreamSnapshotRequest) Run ¶ added in v0.91.0
func (r GetDatastreamSnapshotRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetDatastreamSnapshotRequest) ToCurl ¶ added in v0.91.0
func (r GetDatastreamSnapshotRequest) ToCurl(_ *Client) string
type GetDatastreamSnapshotResponse ¶ added in v0.91.0
type GetDatastreamSnapshotResponse struct {
// contains filtered or unexported fields
}
func (GetDatastreamSnapshotResponse) Parse ¶ added in v0.91.0
func (r GetDatastreamSnapshotResponse) Parse() (any, error)
Parses data obtained by performing a request for a Datastream interface snapshot. Returns the snapshot as a map of strings (endpoints) to DatastreamIndividualValues or DatastreamObjectValue, depending on the requested interface's aggregation.
type GetDeviceDetailsRequest ¶ added in v0.91.0
type GetDeviceDetailsRequest struct {
// contains filtered or unexported fields
}
func (GetDeviceDetailsRequest) Run ¶ added in v0.91.0
func (r GetDeviceDetailsRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetDeviceDetailsRequest) ToCurl ¶ added in v0.91.0
func (r GetDeviceDetailsRequest) ToCurl(_ *Client) string
type GetDeviceDetailsResponse ¶ added in v0.91.0
type GetDeviceDetailsResponse struct {
// contains filtered or unexported fields
}
func (GetDeviceDetailsResponse) Parse ¶ added in v0.91.0
func (r GetDeviceDetailsResponse) Parse() (any, error)
Parses data obtained by performing a request device details. Returns details as a DeviceDetails structure.
type GetDeviceIDFromAliasRequest ¶ added in v0.91.0
type GetDeviceIDFromAliasRequest struct {
// contains filtered or unexported fields
}
func (GetDeviceIDFromAliasRequest) Run ¶ added in v0.91.0
func (r GetDeviceIDFromAliasRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetDeviceIDFromAliasRequest) ToCurl ¶ added in v0.91.0
func (r GetDeviceIDFromAliasRequest) ToCurl(_ *Client) string
type GetDeviceIDFromAliasResponse ¶ added in v0.91.0
type GetDeviceIDFromAliasResponse struct {
// contains filtered or unexported fields
}
func (GetDeviceIDFromAliasResponse) Parse ¶ added in v0.91.0
func (r GetDeviceIDFromAliasResponse) Parse() (any, error)
Parses data obtained by performing a request a Device ID from alias. Returns the device ID as a string.
type GetDeviceStatsResponse ¶ added in v0.91.0
type GetDeviceStatsResponse struct {
// contains filtered or unexported fields
}
func (GetDeviceStatsResponse) Parse ¶ added in v0.91.0
func (r GetDeviceStatsResponse) Parse() (any, error)
Parses data obtained by performing a request for devices stats. Returns the stats as a DevicesStats struct.
type GetDevicesStatsRequest ¶ added in v0.91.0
type GetDevicesStatsRequest struct {
// contains filtered or unexported fields
}
func (GetDevicesStatsRequest) Run ¶ added in v0.91.0
func (r GetDevicesStatsRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetDevicesStatsRequest) ToCurl ¶ added in v0.91.0
func (r GetDevicesStatsRequest) ToCurl(_ *Client) string
type GetInterfaceRequest ¶ added in v0.91.0
type GetInterfaceRequest struct {
// contains filtered or unexported fields
}
func (GetInterfaceRequest) Run ¶ added in v0.91.0
func (r GetInterfaceRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetInterfaceRequest) ToCurl ¶ added in v0.91.0
func (r GetInterfaceRequest) ToCurl(_ *Client) string
type GetInterfaceResponse ¶ added in v0.91.0
type GetInterfaceResponse struct {
// contains filtered or unexported fields
}
func (GetInterfaceResponse) Parse ¶ added in v0.91.0
func (r GetInterfaceResponse) Parse() (any, error)
Parses data obtained by performing a request to retrieve an interface. Returns the interface as an interfaces.AstarteInterface.
type GetNextDatastreamPageRequest ¶ added in v0.91.0
type GetNextDatastreamPageRequest struct {
// contains filtered or unexported fields
}
func (GetNextDatastreamPageRequest) Run ¶ added in v0.91.0
func (r GetNextDatastreamPageRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetNextDatastreamPageRequest) ToCurl ¶ added in v0.91.0
func (r GetNextDatastreamPageRequest) ToCurl(_ *Client) string
type GetNextDatastreamPageResponse ¶ added in v0.91.0
type GetNextDatastreamPageResponse struct {
// contains filtered or unexported fields
}
func (GetNextDatastreamPageResponse) Parse ¶ added in v0.91.0
func (r GetNextDatastreamPageResponse) Parse() (any, error)
Parses data obtained by performing a request for a DatastreamPaginator page and sets up the paginator for retrieving the next page. According to the interface's aggregation and path, the return value can be one of: []DatastreamObjectValue, map[string][]DatastreamObjectValue, []DatastreamIndividualValue, map[string]DatastreamIndividualValue.
func (GetNextDatastreamPageResponse) Raw ¶ added in v0.91.0
func (r GetNextDatastreamPageResponse) Raw(f func(*http.Response) any) any
Raw allows to supply a custom http Response handling function for the Astarte response. The handling function must not close the body of the response. Moreover, Raw sets up the paginator for retrieving the next page. Raw simply returns the value returned by the handling function.
type GetNextDeviceListPageRequest ¶ added in v0.91.0
type GetNextDeviceListPageRequest struct {
// contains filtered or unexported fields
}
func (GetNextDeviceListPageRequest) Run ¶ added in v0.91.0
func (r GetNextDeviceListPageRequest) Run(c *Client) (AstarteResponse, error)
Performs a request to get the next page. Returns either a response that can be parsed with Parse() or an error if the request failed. nolint:bodyclose
func (GetNextDeviceListPageRequest) ToCurl ¶ added in v0.91.0
func (r GetNextDeviceListPageRequest) ToCurl(_ *Client) string
Returns the curl command corresponding to the request to get the next page.
type GetNextDeviceListPageResponse ¶ added in v0.91.0
type GetNextDeviceListPageResponse struct {
// contains filtered or unexported fields
}
func (GetNextDeviceListPageResponse) Parse ¶ added in v0.91.0
func (r GetNextDeviceListPageResponse) Parse() (any, error)
Parses data obtained by performing a request a DeviceListPaginator page and sets up the paginator for retrieving the next page. Returns the page as an array of strings or DeviceDetails, depending on the format specified in the paginator.
func (GetNextDeviceListPageResponse) Raw ¶ added in v0.91.0
func (r GetNextDeviceListPageResponse) Raw(f func(*http.Response) any) any
Raw allows to supply a custom http Response handling function for the Astarte response. The handling function must not close the body of the response. Moreover, Raw sets up the paginator for retrieving the next page. Raw simply returns the value returned by the handling function.
type GetPropertiesRequest ¶ added in v0.91.0
type GetPropertiesRequest struct {
// contains filtered or unexported fields
}
func (GetPropertiesRequest) Run ¶ added in v0.91.0
func (r GetPropertiesRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetPropertiesRequest) ToCurl ¶ added in v0.91.0
func (r GetPropertiesRequest) ToCurl(_ *Client) string
type GetPropertiesResponse ¶ added in v0.91.0
type GetPropertiesResponse struct {
// contains filtered or unexported fields
}
func (GetPropertiesResponse) Parse ¶ added in v0.91.0
func (r GetPropertiesResponse) Parse() (any, error)
Parses data obtained by performing a request for a property value. Returns the value as a PropertyValue.
type GetRealmRequest ¶ added in v0.91.0
type GetRealmRequest struct {
// contains filtered or unexported fields
}
func (GetRealmRequest) Run ¶ added in v0.91.0
func (r GetRealmRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetRealmRequest) ToCurl ¶ added in v0.91.0
func (r GetRealmRequest) ToCurl(_ *Client) string
type GetRealmResponse ¶ added in v0.91.0
type GetRealmResponse struct {
// contains filtered or unexported fields
}
func (GetRealmResponse) Parse ¶ added in v0.91.0
func (r GetRealmResponse) Parse() (any, error)
Parses data obtained by performing a request to get a realm's details. Returns the details as a RealmDetails struct.
type GetTriggerDeliveryPolicyRequest ¶ added in v0.91.1
type GetTriggerDeliveryPolicyRequest struct {
// contains filtered or unexported fields
}
func (GetTriggerDeliveryPolicyRequest) Run ¶ added in v0.91.1
func (r GetTriggerDeliveryPolicyRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetTriggerDeliveryPolicyRequest) ToCurl ¶ added in v0.91.1
func (r GetTriggerDeliveryPolicyRequest) ToCurl(_ *Client) string
type GetTriggerDeliveryPolicyResponse ¶ added in v0.91.1
type GetTriggerDeliveryPolicyResponse struct {
// contains filtered or unexported fields
}
func (GetTriggerDeliveryPolicyResponse) Parse ¶ added in v0.91.1
func (r GetTriggerDeliveryPolicyResponse) Parse() (any, error)
Parses data obtained by performing a request to retrieve a trigger delivery policy. Returns the trigger delivery policy payload as a map[string]any.
type GetTriggerRequest ¶ added in v0.91.0
type GetTriggerRequest struct {
// contains filtered or unexported fields
}
func (GetTriggerRequest) Run ¶ added in v0.91.0
func (r GetTriggerRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (GetTriggerRequest) ToCurl ¶ added in v0.91.0
func (r GetTriggerRequest) ToCurl(_ *Client) string
type GetTriggerResponse ¶ added in v0.91.0
type GetTriggerResponse struct {
// contains filtered or unexported fields
}
func (GetTriggerResponse) Parse ¶ added in v0.91.0
func (r GetTriggerResponse) Parse() (any, error)
Parses data obtained by performing a request to retrieve a trigger. Returns the trigger payload as a map[string]any.
type InhibitDeviceRequest ¶ added in v0.91.0
type InhibitDeviceRequest struct {
// contains filtered or unexported fields
}
func (InhibitDeviceRequest) Run ¶ added in v0.91.0
func (r InhibitDeviceRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (InhibitDeviceRequest) ToCurl ¶ added in v0.91.0
func (r InhibitDeviceRequest) ToCurl(_ *Client) string
type InstallInterfaceRequest ¶ added in v0.91.0
type InstallInterfaceRequest struct {
// contains filtered or unexported fields
}
func (InstallInterfaceRequest) Run ¶ added in v0.91.0
func (r InstallInterfaceRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (InstallInterfaceRequest) ToCurl ¶ added in v0.91.0
func (r InstallInterfaceRequest) ToCurl(_ *Client) string
type InstallInterfaceResponse ¶ added in v0.91.0
type InstallInterfaceResponse struct {
// contains filtered or unexported fields
}
func (InstallInterfaceResponse) Parse ¶ added in v0.91.0
func (r InstallInterfaceResponse) Parse() (any, error)
Parses data obtained by performing a request to install an interface. Returns the interface as an interfaces.AstarteInterface.
type InstallTriggerDeliveryPolicyRequest ¶ added in v0.91.1
type InstallTriggerDeliveryPolicyRequest struct {
// contains filtered or unexported fields
}
func (InstallTriggerDeliveryPolicyRequest) Run ¶ added in v0.91.1
func (r InstallTriggerDeliveryPolicyRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (InstallTriggerDeliveryPolicyRequest) ToCurl ¶ added in v0.91.1
func (r InstallTriggerDeliveryPolicyRequest) ToCurl(_ *Client) string
type InstallTriggerDeliveryPolicyResponse ¶ added in v0.91.1
type InstallTriggerDeliveryPolicyResponse struct {
// contains filtered or unexported fields
}
func (InstallTriggerDeliveryPolicyResponse) Parse ¶ added in v0.91.1
func (r InstallTriggerDeliveryPolicyResponse) Parse() (any, error)
Parses data obtained by performing a request to install a trigger delivery policy. Returns the trigger delivery policy payload as a map[string]any.
type InstallTriggerRequest ¶ added in v0.91.0
type InstallTriggerRequest struct {
// contains filtered or unexported fields
}
func (InstallTriggerRequest) Run ¶ added in v0.91.0
func (r InstallTriggerRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (InstallTriggerRequest) ToCurl ¶ added in v0.91.0
func (r InstallTriggerRequest) ToCurl(_ *Client) string
type InstallTriggerResponse ¶ added in v0.91.0
type InstallTriggerResponse struct {
// contains filtered or unexported fields
}
func (InstallTriggerResponse) Parse ¶ added in v0.91.0
func (r InstallTriggerResponse) Parse() (any, error)
Parses data obtained by performing a request to install a trigger. Returns the trigger payload as a map[string]any.
type Links ¶
Links is a struct that represent the links metadata returned by Astarte API. This metadata is used in Astarte APIs to perform pagination, allowing the user to simply follow the Next link, if any, to fetch the next page.
type ListDeviceAliasesRequest ¶ added in v0.91.0
type ListDeviceAliasesRequest struct {
// contains filtered or unexported fields
}
func (ListDeviceAliasesRequest) Run ¶ added in v0.91.0
func (r ListDeviceAliasesRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListDeviceAliasesRequest) ToCurl ¶ added in v0.91.0
func (r ListDeviceAliasesRequest) ToCurl(_ *Client) string
type ListDeviceAliasesResponse ¶ added in v0.91.0
type ListDeviceAliasesResponse struct {
// contains filtered or unexported fields
}
func (ListDeviceAliasesResponse) Parse ¶ added in v0.91.0
func (r ListDeviceAliasesResponse) Parse() (any, error)
Parses data obtained by performing a request device's aliases. Returns the list of aliases as an array of strings.
type ListDeviceAttributesRequest ¶ added in v0.91.0
type ListDeviceAttributesRequest struct {
// contains filtered or unexported fields
}
func (ListDeviceAttributesRequest) Run ¶ added in v0.91.0
func (r ListDeviceAttributesRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListDeviceAttributesRequest) ToCurl ¶ added in v0.91.0
func (r ListDeviceAttributesRequest) ToCurl(_ *Client) string
type ListDeviceAttributesResponse ¶ added in v0.91.0
type ListDeviceAttributesResponse struct {
// contains filtered or unexported fields
}
func (ListDeviceAttributesResponse) Parse ¶ added in v0.91.0
func (r ListDeviceAttributesResponse) Parse() (any, error)
Parses data obtained by performing a request device's attributes. Returns the attributes as a map strings to strings.
type ListDeviceInterfacesRequest ¶ added in v0.91.0
type ListDeviceInterfacesRequest struct {
// contains filtered or unexported fields
}
func (ListDeviceInterfacesRequest) Run ¶ added in v0.91.0
func (r ListDeviceInterfacesRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListDeviceInterfacesRequest) ToCurl ¶ added in v0.91.0
func (r ListDeviceInterfacesRequest) ToCurl(_ *Client) string
type ListDeviceInterfacesResponse ¶ added in v0.91.0
type ListDeviceInterfacesResponse struct {
// contains filtered or unexported fields
}
func (ListDeviceInterfacesResponse) Parse ¶ added in v0.91.0
func (r ListDeviceInterfacesResponse) Parse() (any, error)
Parses data obtained by performing a request a device introspection. Returns the list of interface names as an array of strings.
type ListGroupsRequest ¶ added in v0.91.0
type ListGroupsRequest struct {
// contains filtered or unexported fields
}
func (ListGroupsRequest) Run ¶ added in v0.91.0
func (r ListGroupsRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListGroupsRequest) ToCurl ¶ added in v0.91.0
func (r ListGroupsRequest) ToCurl(_ *Client) string
type ListGroupsResponse ¶ added in v0.91.0
type ListGroupsResponse struct {
// contains filtered or unexported fields
}
func (ListGroupsResponse) Parse ¶ added in v0.91.0
func (r ListGroupsResponse) Parse() (any, error)
Parses data obtained by performing a request to list groups for a device. Returns the list of groups as an array of strings.
type ListInterfaceMajorVersionsRequest ¶ added in v0.91.0
type ListInterfaceMajorVersionsRequest struct {
// contains filtered or unexported fields
}
func (ListInterfaceMajorVersionsRequest) Run ¶ added in v0.91.0
func (r ListInterfaceMajorVersionsRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListInterfaceMajorVersionsRequest) ToCurl ¶ added in v0.91.0
func (r ListInterfaceMajorVersionsRequest) ToCurl(_ *Client) string
type ListInterfaceMajorVersionsResponse ¶ added in v0.91.0
type ListInterfaceMajorVersionsResponse struct {
// contains filtered or unexported fields
}
func (ListInterfaceMajorVersionsResponse) Parse ¶ added in v0.91.0
func (r ListInterfaceMajorVersionsResponse) Parse() (any, error)
Parses data obtained by performing a request to list an interface's major versions. Returns the list of versions as an array of ints.
type ListInterfacesRequest ¶ added in v0.91.0
type ListInterfacesRequest struct {
// contains filtered or unexported fields
}
func (ListInterfacesRequest) Run ¶ added in v0.91.0
func (r ListInterfacesRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListInterfacesRequest) ToCurl ¶ added in v0.91.0
func (r ListInterfacesRequest) ToCurl(_ *Client) string
type ListInterfacesResponse ¶ added in v0.91.0
type ListInterfacesResponse struct {
// contains filtered or unexported fields
}
func (ListInterfacesResponse) Parse ¶ added in v0.91.0
func (r ListInterfacesResponse) Parse() (any, error)
Parses data obtained by performing a request to list interfaces in a realm. Returns the list of interface names as an array of strings.
type ListRealmsRequest ¶ added in v0.91.0
type ListRealmsRequest struct {
// contains filtered or unexported fields
}
func (ListRealmsRequest) Run ¶ added in v0.91.0
func (r ListRealmsRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListRealmsRequest) ToCurl ¶ added in v0.91.0
func (r ListRealmsRequest) ToCurl(_ *Client) string
type ListRealmsResponse ¶ added in v0.91.0
type ListRealmsResponse struct {
// contains filtered or unexported fields
}
func (ListRealmsResponse) Parse ¶ added in v0.91.0
func (r ListRealmsResponse) Parse() (any, error)
Parses data obtained by performing a request to list realms. Returns the list of realms as an array of strings.
type ListTriggerDeliveryPoliciesRequest ¶ added in v0.91.1
type ListTriggerDeliveryPoliciesRequest struct {
// contains filtered or unexported fields
}
func (ListTriggerDeliveryPoliciesRequest) Run ¶ added in v0.91.1
func (r ListTriggerDeliveryPoliciesRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListTriggerDeliveryPoliciesRequest) ToCurl ¶ added in v0.91.1
func (r ListTriggerDeliveryPoliciesRequest) ToCurl(_ *Client) string
type ListTriggerDeliveryPoliciesResponse ¶ added in v0.91.1
type ListTriggerDeliveryPoliciesResponse struct {
// contains filtered or unexported fields
}
func (ListTriggerDeliveryPoliciesResponse) Parse ¶ added in v0.91.1
func (r ListTriggerDeliveryPoliciesResponse) Parse() (any, error)
Parses data obtained by performing a request to list trigger delivery policies in a realm. Returns the list of trigger delivery policy names as an array of strings.
type ListTriggersRequest ¶ added in v0.91.0
type ListTriggersRequest struct {
// contains filtered or unexported fields
}
func (ListTriggersRequest) Run ¶ added in v0.91.0
func (r ListTriggersRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (ListTriggersRequest) ToCurl ¶ added in v0.91.0
func (r ListTriggersRequest) ToCurl(_ *Client) string
type ListTriggersResponse ¶ added in v0.91.0
type ListTriggersResponse struct {
// contains filtered or unexported fields
}
func (ListTriggersResponse) Parse ¶ added in v0.91.0
func (r ListTriggersResponse) Parse() (any, error)
Parses data obtained by performing a request to list triggers in a realm. Returns the list of triggers names as an array of strings.
type Mqttv1DeviceInformationRequest ¶ added in v0.91.0
type Mqttv1DeviceInformationRequest struct {
// contains filtered or unexported fields
}
func (Mqttv1DeviceInformationRequest) Run ¶ added in v0.91.0
func (r Mqttv1DeviceInformationRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (Mqttv1DeviceInformationRequest) ToCurl ¶ added in v0.91.0
func (r Mqttv1DeviceInformationRequest) ToCurl(_ *Client) string
type Mqttv1DeviceInformationResponse ¶ added in v0.91.0
type Mqttv1DeviceInformationResponse struct {
// contains filtered or unexported fields
}
func (Mqttv1DeviceInformationResponse) Parse ¶ added in v0.91.0
func (r Mqttv1DeviceInformationResponse) Parse() (any, error)
Parses data obtained by performing a request for connection information for a newly registered device. Returns the information as an AstarteMQTTv1ProtocolInformation struct.
type NewDeviceCertificateRequest ¶ added in v0.91.0
type NewDeviceCertificateRequest struct {
// contains filtered or unexported fields
}
func (NewDeviceCertificateRequest) Run ¶ added in v0.91.0
func (r NewDeviceCertificateRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (NewDeviceCertificateRequest) ToCurl ¶ added in v0.91.0
func (r NewDeviceCertificateRequest) ToCurl(_ *Client) string
type NewDeviceCertificateResponse ¶ added in v0.91.0
type NewDeviceCertificateResponse struct {
// contains filtered or unexported fields
}
func (NewDeviceCertificateResponse) Parse ¶ added in v0.91.0
func (r NewDeviceCertificateResponse) Parse() (any, error)
Parses data obtained by performing a request to for a new device certificate. Returns the new device certificate as a PEM-encoded string.
type NoDataResponse ¶ added in v0.91.0
type NoDataResponse struct {
// contains filtered or unexported fields
}
func (NoDataResponse) Parse ¶ added in v0.91.0
func (r NoDataResponse) Parse() (any, error)
Parses data obtained by performing a request to Astarte which does not return data. The returned values do not matter.
type Option ¶ added in v0.91.0
func WithAppEngineURL ¶ added in v0.91.0
The WithAppEngineURL function allows to specify an AppEngine URL different from the standard one (e.g. http://localhost:4000). This is not recommendend in production.
func WithBaseURL ¶ added in v0.91.0
The WithBaseURL function allows to specify the Astarte base URL (e.g. api.your-astarte.org)
func WithExpiry ¶ added in v0.91.0
The WithExpiry function allows to specify the expiry (in seconds) for the generated JWT token used internally for communication with all Astarte APIs. The expiry must be less than 5 minutes.
func WithHTTPClient ¶ added in v0.91.0
The WithHTTPClient function allows to specify an httpClient with custom options, e.g. different timeout, or skipTLSVerify
func WithHousekeepingURL ¶ added in v0.91.0
The WithHousekeepingURL function allows to specify an Housekeeping URL different from the standard one (e.g. http://localhost:4001). This is not recommendend in production.
func WithJWT ¶ added in v0.91.0
The WithJWT function allows to specify a JWT token that the client will use to interact with Astarte.
func WithPairingURL ¶ added in v0.91.0
The WithPairingURL function allows to specify an Pairing URL different from the standard one (e.g. http://localhost:4002). This is not recommendend in production.
func WithPrivateKey ¶ added in v0.91.0
func WithPrivateKey[T privateKeyProvider](privateKey T) Option
The WithPrivateKey function allows to specify a realm private key, used internally to generate a valid JWT token to all Astarte APIs with 5 minutes expiry. The client will use that token to interact with Astarte. You can provide either a path (a string) to the key file, or the key itself (a []byte).
func WithRealmManagementURL ¶ added in v0.91.0
The WithRealmManagementURL function allows to specify an RealmManagement URL different from the standard one (e.g. http://localhost:4003). This is not recommendend in production.
func WithUserAgent ¶ added in v0.91.0
The WithUserAgent function allows to specify the User Agent that the client will use when making http requests.
type Paginator ¶ added in v0.91.0
type Paginator interface { GetNextPage() (AstarteRequest, error) GetPageSize() int HasNextPage() bool Rewind() // contains filtered or unexported methods }
type PropertyValue ¶ added in v0.91.0
type PropertyValue any
PropertyValue represent the Property value on a properties interface.
type RealmDetails ¶
type RealmDetails struct { Name string `json:"realm_name"` JwtPublicKeyPEM string `json:"jwt_public_key_pem"` ReplicationClass string `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 RegisterDeviceRequest ¶ added in v0.91.0
type RegisterDeviceRequest struct {
// contains filtered or unexported fields
}
func (RegisterDeviceRequest) Run ¶ added in v0.91.0
func (r RegisterDeviceRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (RegisterDeviceRequest) ToCurl ¶ added in v0.91.0
func (r RegisterDeviceRequest) ToCurl(_ *Client) string
type RegisterDeviceResponse ¶ added in v0.91.0
type RegisterDeviceResponse struct {
// contains filtered or unexported fields
}
func (RegisterDeviceResponse) Parse ¶ added in v0.91.0
func (r RegisterDeviceResponse) Parse() (any, error)
Parses data obtained by performing a request to register a device. Returns the new credentials secret as a string.
type RemoveDeviceFromGroupRequest ¶ added in v0.91.0
type RemoveDeviceFromGroupRequest struct {
// contains filtered or unexported fields
}
func (RemoveDeviceFromGroupRequest) Run ¶ added in v0.91.0
func (r RemoveDeviceFromGroupRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (RemoveDeviceFromGroupRequest) ToCurl ¶ added in v0.91.0
func (r RemoveDeviceFromGroupRequest) ToCurl(_ *Client) string
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 newest. DescendingOrder )
type SendDatastreamRequest ¶ added in v0.91.0
type SendDatastreamRequest struct {
// contains filtered or unexported fields
}
func (SendDatastreamRequest) Run ¶ added in v0.91.0
func (r SendDatastreamRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (SendDatastreamRequest) ToCurl ¶ added in v0.91.0
func (r SendDatastreamRequest) ToCurl(_ *Client) string
type SetDeviceAttributeRequest ¶ added in v0.91.0
type SetDeviceAttributeRequest struct {
// contains filtered or unexported fields
}
func (SetDeviceAttributeRequest) Run ¶ added in v0.91.0
func (r SetDeviceAttributeRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (SetDeviceAttributeRequest) ToCurl ¶ added in v0.91.0
func (r SetDeviceAttributeRequest) ToCurl(_ *Client) string
type SetPropertyRequest ¶ added in v0.91.0
type SetPropertyRequest struct {
// contains filtered or unexported fields
}
func (SetPropertyRequest) Run ¶ added in v0.91.0
func (r SetPropertyRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (SetPropertyRequest) ToCurl ¶ added in v0.91.0
func (r SetPropertyRequest) ToCurl(_ *Client) string
type UnregisterDeviceRequest ¶ added in v0.91.0
type UnregisterDeviceRequest struct {
// contains filtered or unexported fields
}
func (UnregisterDeviceRequest) Run ¶ added in v0.91.0
func (r UnregisterDeviceRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (UnregisterDeviceRequest) ToCurl ¶ added in v0.91.0
func (r UnregisterDeviceRequest) ToCurl(_ *Client) string
type UnsetPropertyRequest ¶ added in v0.91.0
type UnsetPropertyRequest struct {
// contains filtered or unexported fields
}
func (UnsetPropertyRequest) Run ¶ added in v0.91.0
func (r UnsetPropertyRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (UnsetPropertyRequest) ToCurl ¶ added in v0.91.0
func (r UnsetPropertyRequest) ToCurl(_ *Client) string
type UpdateInterfaceRequest ¶ added in v0.91.0
type UpdateInterfaceRequest struct {
// contains filtered or unexported fields
}
func (UpdateInterfaceRequest) Run ¶ added in v0.91.0
func (r UpdateInterfaceRequest) Run(c *Client) (AstarteResponse, error)
nolint:bodyclose
func (UpdateInterfaceRequest) ToCurl ¶ added in v0.91.0
func (r UpdateInterfaceRequest) ToCurl(_ *Client) string
Source Files
¶
- appengine.go
- appengine_data.go
- appengine_data_paginator.go
- appengine_device_paginator.go
- appengine_groups.go
- appengine_internal.go
- appengine_stream.go
- astarte_mock.go
- client.go
- data.go
- errors.go
- housekeeping.go
- housekeeping_data.go
- http.go
- pairing.go
- pairing_data.go
- realm_management.go
- realm_management_data.go