Documentation
¶
Index ¶
- func GetEdgeModuleEnvironmentVariables() (map[string]string, error)
- func ParseConnectionString(cs string, require ...string) (map[string]string, error)
- func RootCAs() *x509.CertPool
- func TrustBundle(workloadURI string) (*x509.CertPool, error)
- type ConnectionAuthMethod
- type EdgeSignRequestPayload
- type EdgeSignRequestResponse
- type Message
- type SharedAccessKey
- type SharedAccessSignature
- type TrustBundleResponse
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 EdgeSignRequestPayload ¶
type EdgeSignRequestPayload struct {
KeyID string `json:"keyId"`
Algo string `json:"algo"`
Data string `json:"data"`
}
EdgeSignRequestPayload is a placeholder object for sign requests.
func (*EdgeSignRequestPayload) Validate ¶
func (esrp *EdgeSignRequestPayload) Validate() error
Validate the properties on EdgeSignRequestPayload
type EdgeSignRequestResponse ¶
type EdgeSignRequestResponse struct {
Digest string `json:"digest"`
Message string `json:"message"`
}
EdgeSignRequestResponse is a container struct for the response.
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.
func (*SharedAccessKey) TokenFromEdge ¶
func (c *SharedAccessKey) TokenFromEdge( workloadURI, module, genid, resource string, lifetime time.Duration, ) (*SharedAccessSignature, error)
TokenFromEdge generates a shared access signature for the named resource and lifetime using the Workload API sign endpoint
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 NewSharedAccessSignatureFromEdge ¶
func NewSharedAccessSignatureFromEdge( workloadURI, module, genid, resource string, expiry time.Time, ) (*SharedAccessSignature, error)
NewSharedAccessSignatureFromEdge 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.
type TrustBundleResponse ¶
type TrustBundleResponse struct {
Certificate string `json:"certificate"`
}
TrustBundleResponse aids parsing the response from the edge.