Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseConnectionString ¶
ParseConnectionString parses the given connection string into a key-value map, returns an error if at least one of required keys is missing.
Types ¶
type ConnectionAuthMethod ¶
type ConnectionAuthMethod struct {
Scope string `json:"scope"`
Type string `json:"type"`
Issuer string `json:"issuer"`
}
ConnectionAuthMethod is an authentication method of device-to-cloud communication.
type Message ¶
type Message struct {
// MessageID is a user-settable identifier for the message used for request-reply patterns.
MessageID string `json:"MessageId,omitempty"`
// To is a destination specified in cloud-to-device messages.
To string `json:"To,omitempty"`
// ExpiryTime is time of message expiration.
ExpiryTime *time.Time `json:"ExpiryTimeUtc,omitempty"`
// EnqueuedTime is time the Cloud-to-Device message was received by IoT Hub.
EnqueuedTime *time.Time `json:"EnqueuedTime,omitempty"`
// CorrelationID is a string property in a response message that typically
// contains the MessageId of the request, in request-reply patterns.
CorrelationID string `json:"CorrelationId,omitempty"`
// UserID is an ID used to specify the origin of messages.
UserID string `json:"UserId,omitempty"`
// ConnectionDeviceID is an ID set by IoT Hub on device-to-cloud messages.
// It contains the deviceId of the device that sent the message.
ConnectionDeviceID string `json:"ConnectionDeviceId,omitempty"`
// ConnectionDeviceGenerationID is an ID set by IoT Hub on device-to-cloud messages.
// It contains the generationId (as per Device identity properties)
// of the device that sent the message.
ConnectionDeviceGenerationID string `json:"ConnectionDeviceGenerationId,omitempty"`
// ConnectionAuthMethod is an authentication method set by IoT Hub on
// device-to-cloud messages. This property contains information about
// the authentication method used to authenticate the device sending the message.
ConnectionAuthMethod *ConnectionAuthMethod `json:"ConnectionAuthMethod,omitempty"`
// MessageSource determines a device-to-cloud message transport.
MessageSource string `json:"MessageSource,omitempty"`
// Payload is message data.
Payload []byte `json:"Payload,omitempty"`
// Properties are custom message properties (property bags).
Properties map[string]string `json:"Properties,omitempty"`
// TransportOptions transport specific options.
TransportOptions map[string]interface{} `json:"-"`
}
Message is a common message format for all device-facing protocols. This message format is used for both device-to-cloud and cloud-to-device messages. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-construct
type SharedAccessKey ¶
type SharedAccessKey struct {
}
SharedAccessKey is SAS token generator.
func NewSharedAccessKey ¶
func NewSharedAccessKey(hostname, policy, key string) *SharedAccessKey
NewSharedAccessKey creates new shared access key for subsequent token generation.
func (*SharedAccessKey) Token ¶
func (c *SharedAccessKey) Token( resource string, lifetime time.Duration, ) (*SharedAccessSignature, error)
Token generates a shared access signature for the named resource and lifetime.
type SharedAccessSignature ¶
type SharedAccessSignature struct {
}
SharedAccessSignature is a shared access signature instance.
func NewSharedAccessSignature ¶
func NewSharedAccessSignature( resource, policy, key string, expiry time.Time, ) (*SharedAccessSignature, error)
NewSharedAccessSignature initialized a new shared access signature and generates signature fields based on the given input.
func (*SharedAccessSignature) String ¶
func (sas *SharedAccessSignature) String() string
String converts the signature to a token string.