Documentation ¶
Index ¶
- Constants
- Variables
- func NewRouter(app app.App, config ...*Config) *gin.Engine
- type APIHandler
- type AzureDeviceURI
- type BulkItem
- type BulkResult
- type Config
- type InternalHandler
- type ManagementHandler
- func (h *ManagementHandler) GetDevice(c *gin.Context)
- func (h *ManagementHandler) GetDeviceModules(c *gin.Context)
- func (h *ManagementHandler) GetDeviceTwin(c *gin.Context)
- func (h *ManagementHandler) GetSettings(c *gin.Context)
- func (h *ManagementHandler) SetSettings(c *gin.Context)
- func (h *ManagementHandler) UpdateDeviceTwin(c *gin.Context)
Constants ¶
View Source
const ( ParamTenantID = "tenant_id" ParamDeviceID = "device_id" )
View Source
const ( HdrKeyAuthz = "Authorization" HdrKeyXFF = "X-Forwarded-For" HdrKeyMSRequestID = "X-Ms-Request-Id" )
View Source
const ( APIURLInternal = "/api/internal/v1/azure-iot-manager" APIURLAlive = "/alive" APIURLHealth = "/health" APIURLTenants = "/tenants" APIURLTenant = APIURLTenants + "/:tenant_id" APIURLTenantDevices = APIURLTenant + "/devices" APIURLTenantDevice = APIURLTenantDevices + "/:device_id" APIURLTenantBulkDevices = APIURLTenant + "/bulk/devices" APIURLTenantBulkStatus = APIURLTenantBulkDevices + "/status" APIURLManagement = "/api/management/v1/azure-iot-manager" APIURLSettings = "/settings" APIURLDevice = "/devices/:id" APIURLDeviceTwin = "/devices/:id/twin" APIURLDeviceModules = "/devices/:id/modules" )
API URL used by the HTTP router
Variables ¶
View Source
var ( ErrMissingUserAuthentication = errors.New( "user identity missing from authorization token", ) ErrMissingConnectionString = errors.New("connection string is not configured") )
Functions ¶
Types ¶
type APIHandler ¶
func NewAPIHandler ¶
func NewAPIHandler(app app.App, config ...*Config) *APIHandler
func (*APIHandler) Health ¶
func (h *APIHandler) Health(c *gin.Context)
Health responds to GET /health
func (*APIHandler) NoRoute ¶
func (h *APIHandler) NoRoute(c *gin.Context)
type AzureDeviceURI ¶
type AzureDeviceURI string
const ( // https://docs.microsoft.com/en-us/rest/api/iothub/service/devices AzureAPIVersion = "2021-04-12" AzureURIDeviceTwin AzureDeviceURI = "/twins/:id" AzureURIDevice AzureDeviceURI = "/devices/:id" AzureURIDeviceModules AzureDeviceURI = "/devices/:id/modules" )
func (AzureDeviceURI) URI ¶
func (s AzureDeviceURI) URI(deviceID string) string
type BulkResult ¶
type Config ¶
type InternalHandler ¶
type InternalHandler APIHandler
func (*InternalHandler) BulkSetDeviceStatus ¶
func (h *InternalHandler) BulkSetDeviceStatus(c *gin.Context)
PUT /tenants/:tenant_id/bulk/devices/status
func (*InternalHandler) DecomissionDevice ¶
func (h *InternalHandler) DecomissionDevice(c *gin.Context)
func (*InternalHandler) ProvisionDevice ¶
func (h *InternalHandler) ProvisionDevice(c *gin.Context)
POST /tenants/:tenant_id/devices code: 204 - device provisioned to iothub
500 - internal server error
type ManagementHandler ¶
type ManagementHandler APIHandler
ManagementHandler is the namespace for management API handlers.
func (*ManagementHandler) GetDevice ¶
func (h *ManagementHandler) GetDevice(c *gin.Context)
func (*ManagementHandler) GetDeviceModules ¶
func (h *ManagementHandler) GetDeviceModules(c *gin.Context)
func (*ManagementHandler) GetDeviceTwin ¶
func (h *ManagementHandler) GetDeviceTwin(c *gin.Context)
GET /device/:id/twin
func (*ManagementHandler) GetSettings ¶
func (h *ManagementHandler) GetSettings(c *gin.Context)
GET /settings
func (*ManagementHandler) SetSettings ¶
func (h *ManagementHandler) SetSettings(c *gin.Context)
PUT /settings
func (*ManagementHandler) UpdateDeviceTwin ¶
func (h *ManagementHandler) UpdateDeviceTwin(c *gin.Context)
PATCH /device/:id/twin
Click to show internal directories.
Click to hide internal directories.