controller

package
v0.0.0-...-623860c Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ping

func Ping(c *gin.Context)

Types

type DeviceManagementController

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

func (*DeviceManagementController) AddDeviceSubDevices

func (dmc *DeviceManagementController) AddDeviceSubDevices(c *gin.Context)

@Summary Add device subdevices in batches. @Description AddDeviceSubDevices is responsible for adding device subDevices in batches. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device ID." @Param body body models.DeviceSubDeviceList true "Subdevice list." @Success 201 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId}/subdevices [post]

func (*DeviceManagementController) CreateDevice

func (dmc *DeviceManagementController) CreateDevice(c *gin.Context)

@Summary Create device. @Description CreateDevice is responsible for creating device. @Param modelId path string true "Device model ID." @Param body body models.DeviceReq true "Device body." @Success 201 {object} models.DeviceResponse OK @Failure 400 {object} models.DeviceResponse Bad Request @Failure 401 {object} models.DeviceResponse Unauthorized @Failure 403 {object} models.DeviceResponse Forbidden @Failure 500 {object} models.DeviceResponse Internal Server Error @router /devicemodels/{modelId}/devices [post]

func (*DeviceManagementController) CreateDeviceModel

func (dmc *DeviceManagementController) CreateDeviceModel(c *gin.Context)

@Summary Create device model. @Description CreateDeviceModel is responsible for creating device model. @Param body body models.DeviceModelReq true "Device model." @Success 201 {object} models.DeviceModelResponse OK @Failure 400 {object} models.DeviceModelResponse Bad Request @Failure 401 {object} models.DeviceModelResponse Unauthorized @Failure 403 {object} models.DeviceModelResponse Forbidden @Failure 500 {object} models.DeviceModelResponse Internal Server Error @router /devicemodels [post]

func (*DeviceManagementController) CreateDeviceModelFeature

func (dmc *DeviceManagementController) CreateDeviceModelFeature(c *gin.Context)

@Summary Create device model feature. @Description CreateDeviceModelFeature is responsible for creating device model feature. @Param modelId path string true "Device model ID." @Param body body models.DeviceModelFeature true "Device model feature." @Success 201 {object} models.DeviceModelResponse OK @Failure 400 {object} models.DeviceModelResponse Bad Request @Failure 401 {object} models.DeviceModelResponse Unauthorized @Failure 403 {object} models.DeviceModelResponse Forbidden @Failure 500 {object} models.DeviceModelResponse Internal Server Error @router /devicemodels/{modelId}/features [post]

func (*DeviceManagementController) DeleteDevice

func (dmc *DeviceManagementController) DeleteDevice(c *gin.Context)

@Summary Delete Device. @Description DeleteDevice is responsible for deleting device. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device ID." @Success 200 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId} [delete]

func (*DeviceManagementController) DeleteDeviceModel

func (dmc *DeviceManagementController) DeleteDeviceModel(c *gin.Context)

@Summary Delete device model. @Description DeleteDeviceModel is responsible for deleting device model. @Param modelId path string true "Device model ID." @Success 200 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/{modelId} [delete]

func (*DeviceManagementController) DeleteDeviceModelFeature

func (dmc *DeviceManagementController) DeleteDeviceModelFeature(c *gin.Context)

@Summary Delete device model feature. @Description DeleteDeviceModelFeature is responsible for deleting device model feature. @Param modelId path string true "Device model ID." @Param featureId path string true "Feature ID." @Success 200 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/{modelId}/features/{featureId} [delete]

func (*DeviceManagementController) DeleteDeviceModelPlugin

func (dmc *DeviceManagementController) DeleteDeviceModelPlugin(c *gin.Context)

@Summary Delete device model plugin. @Description DeleteDeviceModelPlugin is responsible for deleting device model plugin. @Param modelId path string true "Device model ID." @Param pluginName path string true "Device model plugin name." @Success 200 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/{modelId}/plugins/{pluginName} [delete]

func (*DeviceManagementController) DeleteDeviceSubDevices

func (dmc *DeviceManagementController) DeleteDeviceSubDevices(c *gin.Context)

@Summary Delete subdevices in batches. @Description DeleteDeviceSubDevices is responsible for deleting device subDevices. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device Id." @Param body body models.DeviceSubDeviceList true "Subdevice list." @Success 200 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId}/subdevices [delete]

func (*DeviceManagementController) ExportDeviceModels

func (dmc *DeviceManagementController) ExportDeviceModels(c *gin.Context)

@Summary Export device models. @Description ExportDeviceModels exports device models. @Param action query string false "Action(search)" @Param query query string false "Device model name keyword" @Success 200 {object} models.DeviceModelImport2ExportListResponse OK @Failure 400 {object} models.DeviceModelImport2ExportListResponse Bad Request @Failure 401 {object} models.DeviceModelImport2ExportListResponse Unauthorized @Failure 403 {object} models.DeviceModelImport2ExportListResponse Forbidden @Failure 500 {object} models.DeviceModelImport2ExportListResponse Internal Server Error @router /export [get]

func (*DeviceManagementController) ExportDevices

func (dmc *DeviceManagementController) ExportDevices(c *gin.Context)

@Summary Export devices. @Description ExportDevices exports devices. @Param modelId path string true "Device model ID." @Param action query string false "Action(search)" @Param query query string false "Device name keyword" @Success 200 {object} models.DeviceImport2ExportListResponse OK @Failure 400 {object} models.DeviceImport2ExportListResponse Bad Request @Failure 401 {object} models.DeviceImport2ExportListResponse Unauthorized @Failure 403 {object} models.DeviceImport2ExportListResponse Forbidden @Failure 500 {object} models.DeviceImport2ExportListResponse Internal Server Error @router /devicemodels/{modelId}/export [get]

func (*DeviceManagementController) GetDevice

func (dmc *DeviceManagementController) GetDevice(c *gin.Context)

@Summary Get device information. @Description GetDevice gets details of the device. @Param modelId path string true "device model ID." @Param deviceId path string true "device ID." @Success 200 {object} models.DeviceResponse OK @Failure 400 {object} models.DeviceResponse Bad Request @Failure 401 {object} models.DeviceResponse Unauthorized @Failure 403 {object} models.DeviceResponse Forbidden @Failure 500 {object} models.DeviceResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId} [get]

func (*DeviceManagementController) GetDeviceModel

func (dmc *DeviceManagementController) GetDeviceModel(c *gin.Context)

@Summary Get device model information. @Description GetDeviceModel gets details of the device model. @Param modelId path string true "Device model ID." @Success 200 {object} models.DeviceModelResponse OK @Failure 400 {object} models.DeviceModelResponse Bad Request @Failure 401 {object} models.DeviceModelResponse Unauthorized @Failure 403 {object} models.DeviceModelResponse Forbidden @Failure 500 {object} models.DeviceModelResponse Internal Server Error @router /devicemodels/{modelId} [get]

func (*DeviceManagementController) GetDeviceModelFeature

func (dmc *DeviceManagementController) GetDeviceModelFeature(c *gin.Context)

@Summary Get device model feature information. @Description GetDeviceModel gets details of the device model. @Param modelId path string true "Device model ID." @Param featureId path string true "Device model feature ID." @Success 200 {object} models.DeviceModelFeatureResponse OK @Failure 400 {object} models.DeviceModelFeatureResponse Bad Request @Failure 401 {object} models.DeviceModelFeatureResponse Unauthorized @Failure 403 {object} models.DeviceModelFeatureResponse Forbidden @Failure 500 {object} models.DeviceModelFeatureResponse Internal Server Error @router /devicemodels/{modelId}/features/{featureId} [get]

func (*DeviceManagementController) GetDeviceTopology

func (dmc *DeviceManagementController) GetDeviceTopology(c *gin.Context)

@Summary Get device topology. @Description GetDeviceTopology gets topology of the device. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device ID." @Success 200 {object} models.DeviceTopologyResponse OK @Failure 400 {object} models.DeviceTopologyResponse Bad Request @Failure 401 {object} models.DeviceTopologyResponse Unauthorized @Failure 403 {object} models.DeviceTopologyResponse Forbidden @Failure 500 {object} models.DeviceTopologyResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId}/topology [get]

func (*DeviceManagementController) ImportDeviceModels

func (dmc *DeviceManagementController) ImportDeviceModels(c *gin.Context)

@Summary Import device models in batches. @Description ImportDeviceModels is responsible for importing device models in batches. @Param body body models.DeviceModelImport2ExportList true "Device models in batches." @Success 201 {object} models.DeviceModelListResponse OK @Failure 400 {object} models.DeviceModelListResponse Bad Request @Failure 401 {object} models.DeviceModelListResponse Unauthorized @Failure 403 {object} models.DeviceModelListResponse Forbidden @Failure 500 {object} models.DeviceModelListResponse Internal Server Error @router /import [post]

func (*DeviceManagementController) ImportDevices

func (dmc *DeviceManagementController) ImportDevices(c *gin.Context)

@Summary Import devices in batches. @Description ImportDevices is responsible for importing devices in batches. @Param modelId path string true "Device model ID." @Param body body models.DeviceImport2ExportList true "Devices in batches." @Success 201 {object} models.DeviceListResponse OK @Failure 400 {object} models.DeviceListResponse Bad Request @Failure 401 {object} models.DeviceListResponse Unauthorized @Failure 403 {object} models.DeviceListResponse Forbidden @Failure 500 {object} models.DeviceListResponse Internal Server Error @router /devicemodels/{modelId}/import [post]

func (*DeviceManagementController) ListDeviceModelFeatures

func (dmc *DeviceManagementController) ListDeviceModelFeatures(c *gin.Context)

@Summary List device model features(including searching). @Description ListDeviceModelFeatures get list of device models features. @Param modelId path string true "Device model ID." @Param action query string false "Action(search)" @Param query query string false "Feature name keyword" @Param page query int false "Page(starting from one)" @Param size query int false "Pagesize" @Success 200 {object} models.DeviceModelFeatureListResponse OK @Failure 400 {object} models.DeviceModelFeatureListResponse Bad Request @Failure 401 {object} models.DeviceModelFeatureListResponse Unauthorized @Failure 403 {object} models.DeviceModelFeatureListResponse Forbidden @Failure 500 {object} models.DeviceModelFeatureListResponse Internal Server Error @router /devicemodels/{modelId}/features [get]

func (*DeviceManagementController) ListDeviceModels

func (dmc *DeviceManagementController) ListDeviceModels(c *gin.Context)

@Summary List device models(including searching). @Description ListDeviceModels get list of device models. @Param filter query bool false "Whether or not to filter subGateway and subDevice(not enabled by default)" @Param action query string false "Action(search)" @Param query query string false "Device model name keyword" @Param page query int false "Page(starting from one)" @Param size query int false "Pagesize" @Success 200 {object} models.DeviceModelListResponse OK @Failure 400 {object} models.DeviceModelListResponse Bad Request @Failure 401 {object} models.DeviceModelListResponse Unauthorized @Failure 403 {object} models.DeviceModelListResponse Forbidden @Failure 500 {object} models.DeviceModelListResponse Internal Server Error @router /devicemodels [get]

func (*DeviceManagementController) ListDeviceSubDevices

func (dmc *DeviceManagementController) ListDeviceSubDevices(c *gin.Context)

@Summary List device subdevices(including searching). @Description ListDeviceSubDevices get list of device subDevices. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device ID." @Param action query string false "Action(search)." @Param query query string false "Device name keyword." @Param page query int false "Page(starting from one)." @Param size query int false "Pagesize." @Success 200 {object} models.DeviceListResponse OK @Failure 400 {object} models.DeviceListResponse Bad Request @Failure 401 {object} models.DeviceListResponse Unauthorized @Failure 403 {object} models.DeviceListResponse Forbidden @Failure 500 {object} models.DeviceListResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId}/subdevices [get]

func (*DeviceManagementController) ListDevices

func (dmc *DeviceManagementController) ListDevices(c *gin.Context)

@Summary List devices(including search). @Description ListDevices get list of devices. @Param modelId path string true "Device model ID." @Param filter query bool false "Whether or not to filter subGateway and subDevice(not enabled by default)" @Param action query string false "Action(search)" @Param query query string false "Device name keyword" @Param page query int false "Page(starting from one)" @Param size query int false "Pagesize" @Success 200 {object} models.DeviceListResponse OK @Failure 400 {object} models.DeviceListResponse Bad Request @Failure 401 {object} models.DeviceListResponse Unauthorized @Failure 403 {object} models.DeviceListResponse Forbidden @Failure 500 {object} models.DeviceListResponse Internal Server Error @router /devicemodels/{modelId}/devices [get]

func (*DeviceManagementController) UpdateDevice

func (dmc *DeviceManagementController) UpdateDevice(c *gin.Context)

@Summary Update device. @Description UpdateDevice is responsible for updating device. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device ID." @Param body body models.Device true "Device contents." @Success 200 {object} models.DeviceResponse OK @Failure 400 {object} models.DeviceResponse Bad Request @Failure 401 {object} models.DeviceResponse Unauthorized @Failure 403 {object} models.DeviceResponse Forbidden @Failure 500 {object} models.DeviceResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId} [put]

func (*DeviceManagementController) UpdateDeviceCommand

func (dmc *DeviceManagementController) UpdateDeviceCommand(c *gin.Context)

@Summary Update device command. @Description UpdateDeviceCommand is responsible for updating device command. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device ID." @Param commandId path string true "Device command ID." @Param body body models.DeviceCommandItem true "Device command content." @Success 200 {object} models.DeviceResponse OK @Failure 400 {object} models.DeviceResponse Bad Request @Failure 401 {object} models.DeviceResponse Unauthorized @Failure 403 {object} models.DeviceResponse Forbidden @Failure 500 {object} models.DeviceResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId}/commands/{commandId} [put]

func (*DeviceManagementController) UpdateDeviceModel

func (dmc *DeviceManagementController) UpdateDeviceModel(c *gin.Context)

@Summary Update device model. @Description UpdateDeviceModel is responsible for updating device model. @Param modelId path string true "Device model ID." @Param body body models.DeviceModel true "Device model contents." @Success 200 {object} models.DeviceModelResponse OK @Failure 400 {object} models.DeviceModelResponse Bad Request @Failure 401 {object} models.DeviceModelResponse Unauthorized @Failure 403 {object} models.DeviceModelResponse Forbidden @Failure 500 {object} models.DeviceModelResponse Internal Server Error @router /devicemodels/{modelId} [put]

func (*DeviceManagementController) UpdateDeviceModelFeature

func (dmc *DeviceManagementController) UpdateDeviceModelFeature(c *gin.Context)

@Summary Update device model feature. @Description UpdateDeviceModelFeature is responsible for updating device model feature. @Param modelId path string true "device model ID." @Param featureId path string true "feature ID." @Param body body models.DeviceModelFeature true "feature contents." @Success 200 {object} models.DeviceModelResponse OK @Failure 400 {object} models.DeviceModelResponse Bad Request @Failure 401 {object} models.DeviceModelResponse Unauthorized @Failure 403 {object} models.DeviceModelResponse Forbidden @Failure 500 {object} models.DeviceModelResponse Internal Server Error @router /devicemodels/{modelId}/features/{featureId} [put]

func (*DeviceManagementController) UpdateDeviceProperty

func (dmc *DeviceManagementController) UpdateDeviceProperty(c *gin.Context)

@Summary Update device property. @Description UpdateDeviceProperty is responsible for updating device property. @Param modelId path string true "Device model ID." @Param deviceId path string true "Device ID." @Param propertyId path string true "Device property ID." @Param body body models.DevicePropertyItem true "Device property content." @Success 200 {object} models.DeviceResponse OK @Failure 400 {object} models.DeviceResponse Bad Request @Failure 401 {object} models.DeviceResponse Unauthorized @Failure 403 {object} models.DeviceResponse Forbidden @Failure 500 {object} models.DeviceResponse Internal Server Error @router /devicemodels/{modelId}/devices/{deviceId}/properties/{propertyId} [put]

func (*DeviceManagementController) UploadDeviceModelPicture

func (dmc *DeviceManagementController) UploadDeviceModelPicture(c *gin.Context)

@Summary Upload device model picture. @Description UploadDeviceModelPicture is responsible for uploading device model picture. @Param importPkg formData file true "The picture you want to uplaod to." @Success 201 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/:modelId/pictures [post]

func (*DeviceManagementController) UploadDeviceModelPlugin

func (dmc *DeviceManagementController) UploadDeviceModelPlugin(c *gin.Context)

@Summary Upload device model plugin. @Description UploadDeviceModelPlugin is responsible for uploading device model. @Param modelId path string true "Device model ID." @Param importPkg formData file true "The plugin you want to uplaod to." @Success 201 {object} models.CommonResponse OK @Failure 400 {object} models.CommonResponse Bad Request @Failure 401 {object} models.CommonResponse Unauthorized @Failure 403 {object} models.CommonResponse Forbidden @Failure 500 {object} models.CommonResponse Internal Server Error @router /devicemodels/{modelId}/plugins [post]

type RestController

type RestController interface {
	// IoT device model relevant CRUDs
	CreateDeviceModel(c *gin.Context)
	UploadDeviceModelPicture(c *gin.Context)
	DeleteDeviceModel(c *gin.Context)
	ListDeviceModels(c *gin.Context)
	GetDeviceModel(c *gin.Context)
	UpdateDeviceModel(c *gin.Context)
	CreateDeviceModelFeature(c *gin.Context)
	ListDeviceModelFeatures(c *gin.Context)
	GetDeviceModelFeature(c *gin.Context)
	UpdateDeviceModelFeature(c *gin.Context)
	DeleteDeviceModelFeature(c *gin.Context)
	UploadDeviceModelPlugin(c *gin.Context)
	DeleteDeviceModelPlugin(c *gin.Context)
	ImportDeviceModels(c *gin.Context)
	ExportDeviceModels(c *gin.Context)
	// IoT device relevant CRUDs
	ListDevices(c *gin.Context)
	CreateDevice(c *gin.Context)
	DeleteDevice(c *gin.Context)
	GetDevice(c *gin.Context)
	UpdateDevice(c *gin.Context)
	UpdateDeviceProperty(c *gin.Context)
	UpdateDeviceCommand(c *gin.Context)
	ListDeviceSubDevices(c *gin.Context)
	AddDeviceSubDevices(c *gin.Context)
	DeleteDeviceSubDevices(c *gin.Context)
	GetDeviceTopology(c *gin.Context)
	ImportDevices(c *gin.Context)
	ExportDevices(c *gin.Context)
}

func NewDeviceManagementController

func NewDeviceManagementController(cfg *config.DeviceManagementConfig, service service.RestService,
	conn *amqp.Connection) (RestController, error)

Jump to

Keyboard shortcuts

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