client

package
v0.92.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 23 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 ErrDifferentStatusCode(expected, received int) error

func ErrInvalidDeviceID added in v0.91.0

func ErrInvalidDeviceID(deviceID string) error

func WithDatacenterReplicationFactors added in v0.91.0

func WithDatacenterReplicationFactors(datacenterReplicationFactors map[string]int) realmOption

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

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

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

func New(options ...Option) (*Client, error)

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 (c *Client) GetAppengineURL() (ret *url.URL)

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 (c *Client) GetHousekeepingURL() (ret *url.URL)

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 (c *Client) GetPairingURL() (ret *url.URL)

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 (c *Client) GetRealmManagementURL() (ret *url.URL)

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

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.

func (CreateGroupResponse) Raw added in v0.91.0

func (r CreateGroupResponse) Raw(f func(*http.Response) any) any

type CreateRealmRequest added in v0.91.0

type CreateRealmRequest struct {
	// contains filtered or unexported fields
}

func (CreateRealmRequest) Run added in v0.91.0

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.

func (CreateRealmResponse) Raw added in v0.91.0

func (r CreateRealmResponse) Raw(f func(*http.Response) any) any

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

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

nolint:bodyclose

func (DeleteDeviceAttributeRequest) ToCurl added in v0.91.0

type DeleteInterfaceRequest added in v0.91.0

type DeleteInterfaceRequest struct {
	// contains filtered or unexported fields
}

func (DeleteInterfaceRequest) Run added in v0.91.0

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

nolint:bodyclose

func (DeleteTriggerDeliveryPolicyRequest) ToCurl added in v0.91.1

type DeleteTriggerRequest added in v0.91.0

type DeleteTriggerRequest struct {
	// contains filtered or unexported fields
}

func (DeleteTriggerRequest) Run added in v0.91.0

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

func (Empty) Parse added in v0.91.0

func (e Empty) Parse() (any, error)

func (Empty) Raw added in v0.91.0

func (e Empty) Raw(func(*http.Response) any) any

func (Empty) Run added in v0.91.0

func (r Empty) Run(_ *Client) (AstarteResponse, error)

func (Empty) ToCurl added in v0.91.0

func (r Empty) ToCurl(_ *Client) string

type GetDatastreamSnapshotRequest added in v0.91.0

type GetDatastreamSnapshotRequest struct {
	// contains filtered or unexported fields
}

func (GetDatastreamSnapshotRequest) Run added in v0.91.0

nolint:bodyclose

func (GetDatastreamSnapshotRequest) ToCurl added in v0.91.0

type GetDatastreamSnapshotResponse added in v0.91.0

type GetDatastreamSnapshotResponse struct {
	// contains filtered or unexported fields
}

func (GetDatastreamSnapshotResponse) Parse added in v0.91.0

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.

func (GetDatastreamSnapshotResponse) Raw added in v0.91.0

type GetDeviceDetailsRequest added in v0.91.0

type GetDeviceDetailsRequest struct {
	// contains filtered or unexported fields
}

func (GetDeviceDetailsRequest) Run added in v0.91.0

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.

func (GetDeviceDetailsResponse) Raw added in v0.91.0

func (r GetDeviceDetailsResponse) Raw(f func(*http.Response) any) any

type GetDeviceIDFromAliasRequest added in v0.91.0

type GetDeviceIDFromAliasRequest struct {
	// contains filtered or unexported fields
}

func (GetDeviceIDFromAliasRequest) Run added in v0.91.0

nolint:bodyclose

func (GetDeviceIDFromAliasRequest) ToCurl added in v0.91.0

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.

func (GetDeviceIDFromAliasResponse) Raw added in v0.91.0

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.

func (GetDeviceStatsResponse) Raw added in v0.91.0

func (r GetDeviceStatsResponse) Raw(f func(*http.Response) any) any

type GetDevicesStatsRequest added in v0.91.0

type GetDevicesStatsRequest struct {
	// contains filtered or unexported fields
}

func (GetDevicesStatsRequest) Run added in v0.91.0

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

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.

func (GetInterfaceResponse) Raw added in v0.91.0

func (r GetInterfaceResponse) Raw(f func(*http.Response) any) any

type GetNextDatastreamPageRequest added in v0.91.0

type GetNextDatastreamPageRequest struct {
	// contains filtered or unexported fields
}

func (GetNextDatastreamPageRequest) Run added in v0.91.0

nolint:bodyclose

func (GetNextDatastreamPageRequest) ToCurl added in v0.91.0

type GetNextDatastreamPageResponse added in v0.91.0

type GetNextDatastreamPageResponse struct {
	// contains filtered or unexported fields
}

func (GetNextDatastreamPageResponse) Parse added in v0.91.0

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

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

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

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

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

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

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.

func (GetPropertiesResponse) Raw added in v0.91.0

func (r GetPropertiesResponse) Raw(f func(*http.Response) any) any

type GetRealmRequest added in v0.91.0

type GetRealmRequest struct {
	// contains filtered or unexported fields
}

func (GetRealmRequest) Run added in v0.91.0

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.

func (GetRealmResponse) Raw added in v0.91.0

func (r GetRealmResponse) Raw(f func(*http.Response) any) any

type GetTriggerDeliveryPolicyRequest added in v0.91.1

type GetTriggerDeliveryPolicyRequest struct {
	// contains filtered or unexported fields
}

func (GetTriggerDeliveryPolicyRequest) Run added in v0.91.1

nolint:bodyclose

func (GetTriggerDeliveryPolicyRequest) ToCurl added in v0.91.1

type GetTriggerDeliveryPolicyResponse added in v0.91.1

type GetTriggerDeliveryPolicyResponse struct {
	// contains filtered or unexported fields
}

func (GetTriggerDeliveryPolicyResponse) Parse added in v0.91.1

Parses data obtained by performing a request to retrieve a trigger delivery policy. Returns the trigger delivery policy payload as a map[string]any.

func (GetTriggerDeliveryPolicyResponse) Raw added in v0.91.1

type GetTriggerRequest added in v0.91.0

type GetTriggerRequest struct {
	// contains filtered or unexported fields
}

func (GetTriggerRequest) Run added in v0.91.0

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.

func (GetTriggerResponse) Raw added in v0.91.0

func (r GetTriggerResponse) Raw(f func(*http.Response) any) any

type InhibitDeviceRequest added in v0.91.0

type InhibitDeviceRequest struct {
	// contains filtered or unexported fields
}

func (InhibitDeviceRequest) Run added in v0.91.0

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

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.

func (InstallInterfaceResponse) Raw added in v0.91.0

func (r InstallInterfaceResponse) Raw(f func(*http.Response) any) any

type InstallTriggerDeliveryPolicyRequest added in v0.91.1

type InstallTriggerDeliveryPolicyRequest struct {
	// contains filtered or unexported fields
}

func (InstallTriggerDeliveryPolicyRequest) Run added in v0.91.1

nolint:bodyclose

func (InstallTriggerDeliveryPolicyRequest) ToCurl added in v0.91.1

type InstallTriggerDeliveryPolicyResponse added in v0.91.1

type InstallTriggerDeliveryPolicyResponse struct {
	// contains filtered or unexported fields
}

func (InstallTriggerDeliveryPolicyResponse) Parse added in v0.91.1

Parses data obtained by performing a request to install a trigger delivery policy. Returns the trigger delivery policy payload as a map[string]any.

func (InstallTriggerDeliveryPolicyResponse) Raw added in v0.91.1

type InstallTriggerRequest added in v0.91.0

type InstallTriggerRequest struct {
	// contains filtered or unexported fields
}

func (InstallTriggerRequest) Run added in v0.91.0

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.

func (InstallTriggerResponse) Raw added in v0.91.0

func (r InstallTriggerResponse) Raw(f func(*http.Response) any) any
type Links struct {
	Self string `json:"self,omitempty"`
	Next string `json:"next,omitempty"`
}

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

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.

func (ListDeviceAliasesResponse) Raw added in v0.91.0

func (r ListDeviceAliasesResponse) Raw(f func(*http.Response) any) any

type ListDeviceAttributesRequest added in v0.91.0

type ListDeviceAttributesRequest struct {
	// contains filtered or unexported fields
}

func (ListDeviceAttributesRequest) Run added in v0.91.0

nolint:bodyclose

func (ListDeviceAttributesRequest) ToCurl added in v0.91.0

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.

func (ListDeviceAttributesResponse) Raw added in v0.91.0

type ListDeviceInterfacesRequest added in v0.91.0

type ListDeviceInterfacesRequest struct {
	// contains filtered or unexported fields
}

func (ListDeviceInterfacesRequest) Run added in v0.91.0

nolint:bodyclose

func (ListDeviceInterfacesRequest) ToCurl added in v0.91.0

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.

func (ListDeviceInterfacesResponse) Raw added in v0.91.0

type ListGroupsRequest added in v0.91.0

type ListGroupsRequest struct {
	// contains filtered or unexported fields
}

func (ListGroupsRequest) Run added in v0.91.0

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.

func (ListGroupsResponse) Raw added in v0.91.0

func (r ListGroupsResponse) Raw(f func(*http.Response) any) any

type ListInterfaceMajorVersionsRequest added in v0.91.0

type ListInterfaceMajorVersionsRequest struct {
	// contains filtered or unexported fields
}

func (ListInterfaceMajorVersionsRequest) Run added in v0.91.0

nolint:bodyclose

func (ListInterfaceMajorVersionsRequest) ToCurl added in v0.91.0

type ListInterfaceMajorVersionsResponse added in v0.91.0

type ListInterfaceMajorVersionsResponse struct {
	// contains filtered or unexported fields
}

func (ListInterfaceMajorVersionsResponse) Parse added in v0.91.0

Parses data obtained by performing a request to list an interface's major versions. Returns the list of versions as an array of ints.

func (ListInterfaceMajorVersionsResponse) Raw added in v0.91.0

type ListInterfacesRequest added in v0.91.0

type ListInterfacesRequest struct {
	// contains filtered or unexported fields
}

func (ListInterfacesRequest) Run added in v0.91.0

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.

func (ListInterfacesResponse) Raw added in v0.91.0

func (r ListInterfacesResponse) Raw(f func(*http.Response) any) any

type ListRealmsRequest added in v0.91.0

type ListRealmsRequest struct {
	// contains filtered or unexported fields
}

func (ListRealmsRequest) Run added in v0.91.0

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.

func (ListRealmsResponse) Raw added in v0.91.0

func (r ListRealmsResponse) Raw(f func(*http.Response) any) any

type ListTriggerDeliveryPoliciesRequest added in v0.91.1

type ListTriggerDeliveryPoliciesRequest struct {
	// contains filtered or unexported fields
}

func (ListTriggerDeliveryPoliciesRequest) Run added in v0.91.1

nolint:bodyclose

func (ListTriggerDeliveryPoliciesRequest) ToCurl added in v0.91.1

type ListTriggerDeliveryPoliciesResponse added in v0.91.1

type ListTriggerDeliveryPoliciesResponse struct {
	// contains filtered or unexported fields
}

func (ListTriggerDeliveryPoliciesResponse) Parse added in v0.91.1

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.

func (ListTriggerDeliveryPoliciesResponse) Raw added in v0.91.1

type ListTriggersRequest added in v0.91.0

type ListTriggersRequest struct {
	// contains filtered or unexported fields
}

func (ListTriggersRequest) Run added in v0.91.0

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.

func (ListTriggersResponse) Raw added in v0.91.0

func (r ListTriggersResponse) Raw(f func(*http.Response) any) any

type Mqttv1DeviceInformationRequest added in v0.91.0

type Mqttv1DeviceInformationRequest struct {
	// contains filtered or unexported fields
}

func (Mqttv1DeviceInformationRequest) Run added in v0.91.0

nolint:bodyclose

func (Mqttv1DeviceInformationRequest) ToCurl added in v0.91.0

type Mqttv1DeviceInformationResponse added in v0.91.0

type Mqttv1DeviceInformationResponse struct {
	// contains filtered or unexported fields
}

func (Mqttv1DeviceInformationResponse) Parse added in v0.91.0

Parses data obtained by performing a request for connection information for a newly registered device. Returns the information as an AstarteMQTTv1ProtocolInformation struct.

func (Mqttv1DeviceInformationResponse) Raw added in v0.91.0

type NewDeviceCertificateRequest added in v0.91.0

type NewDeviceCertificateRequest struct {
	// contains filtered or unexported fields
}

func (NewDeviceCertificateRequest) Run added in v0.91.0

nolint:bodyclose

func (NewDeviceCertificateRequest) ToCurl added in v0.91.0

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.

func (NewDeviceCertificateResponse) Raw added in v0.91.0

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.

func (NoDataResponse) Raw added in v0.91.0

func (r NoDataResponse) Raw(f func(*http.Response) any) any

type Option added in v0.91.0

type Option = func(c *Client) error

func WithAppEngineURL added in v0.91.0

func WithAppEngineURL(appEngineURL string) Option

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

func WithBaseURL(baseURL string) Option

The WithBaseURL function allows to specify the Astarte base URL (e.g. api.your-astarte.org)

func WithExpiry added in v0.91.0

func WithExpiry(expirySeconds int) Option

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

func WithHTTPClient(httpClient *http.Client) Option

The WithHTTPClient function allows to specify an httpClient with custom options, e.g. different timeout, or skipTLSVerify

func WithHousekeepingURL added in v0.91.0

func WithHousekeepingURL(housekeepingURL string) Option

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

func WithJWT(token string) Option

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

func WithPairingURL(pairingURL string) Option

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

func WithRealmManagementURL(realmManagementURL string) Option

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

func WithUserAgent(userAgent string) Option

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

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.

func (RegisterDeviceResponse) Raw added in v0.91.0

func (r RegisterDeviceResponse) Raw(f func(*http.Response) any) any

type RemoveDeviceFromGroupRequest added in v0.91.0

type RemoveDeviceFromGroupRequest struct {
	// contains filtered or unexported fields
}

func (RemoveDeviceFromGroupRequest) Run added in v0.91.0

nolint:bodyclose

func (RemoveDeviceFromGroupRequest) ToCurl added in v0.91.0

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

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

nolint:bodyclose

func (SetDeviceAttributeRequest) ToCurl added in v0.91.0

type SetPropertyRequest added in v0.91.0

type SetPropertyRequest struct {
	// contains filtered or unexported fields
}

func (SetPropertyRequest) Run added in v0.91.0

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

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

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

nolint:bodyclose

func (UpdateInterfaceRequest) ToCurl added in v0.91.0

func (r UpdateInterfaceRequest) ToCurl(_ *Client) string

Jump to

Keyboard shortcuts

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