model

package
v0.0.0-...-d8d72a7 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionStringTooLong = errors.New(
		"connection string can be no longer than 4096 characters",
	)
)

Functions

This section is empty.

Types

type ConnectionString

type ConnectionString struct {
	HostName        string `cs:"HostName" bson:"hostname"`
	GatewayHostName string `cs:"GatewayHostName" bson:"gateway_hostname,omitempty"`
	Name            string `cs:"SharedAccessKeyName" bson:"name,omitempty"`
	DeviceID        string `cs:"DeviceId" bson:"device_id,omitempty"`
	ModuleID        string `cs:"ModuleId" bson:"module_id,omitempty"`
	Key             []byte `cs:"SharedAccessKey" bson:"access_key"`
	Signature       string `cs:"SharedAccessSignature" bson:"-"`
}

ConnectionString implements the Azure connection string format and the SharedAccessSignature authz algorithm. The implementation is based on the official python SDK. https://github.com/Azure/azure-iot-sdk-python

func ParseConnectionString

func ParseConnectionString(connection string) (*ConnectionString, error)

func (ConnectionString) Authorization

func (cs ConnectionString) Authorization(expireAt time.Time) string

func (ConnectionString) IsZero

func (cs ConnectionString) IsZero() bool

func (ConnectionString) MarshalText

func (cs ConnectionString) MarshalText() ([]byte, error)

func (ConnectionString) String

func (cs ConnectionString) String() string

func (*ConnectionString) UnmarshalText

func (cs *ConnectionString) UnmarshalText(b []byte) error

func (ConnectionString) Validate

func (cs ConnectionString) Validate() error

type Settings

type Settings struct {
	ConnectionString *ConnectionString `json:"connection_string,omitempty" bson:"connection_string,omitempty"`
}

func (Settings) Validate

func (s Settings) Validate() error

Jump to

Keyboard shortcuts

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