Documentation
¶
Index ¶
- Constants
- Variables
- func CheckToken(t string) (*jwt.Token, error)
- func DeleteActuator(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteApp(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteCloud(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteCodec(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteCurrentDevice(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteDevice(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteDeviceActuator(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteDeviceSensor(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func DeleteSensor(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetActuator(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetActuatorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetActuatorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetActuators(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetApp(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetApps(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCloud(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCloudEvents(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCloudStatus(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetClouds(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCodecs(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCurrentDevice(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCurrentDeviceID(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCurrentDeviceMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetCurrentDeviceName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDevice(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceActuator(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceActuatorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceActuatorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceActuators(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceSensor(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceSensorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceSensorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDeviceSensors(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetDevices(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetExportAllInOne(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetExportBins(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetExportTree(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetLocalID() string
- func GetMessages(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetPermissions(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetRefereshToken(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetSensor(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetSensorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetSensorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetSensors(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetToken(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetUpdateApp(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func GetUserProfile(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func HandleAppProxyRequest(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func IsAuthorized(endpoint routing.Handle, checkIPWhiteList bool) routing.Handle
- func IsDockerSubnet(ip net.IP) (bool, error)
- func Logout(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostActuator(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostActuatorMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostActuatorName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostActuatorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostActuatorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostApp(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostApps(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCloudMQTTAddr(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCloudName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCloudPaused(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCloudRESTAddr(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCloudToken(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCloudUsername(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostClouds(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCodec(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCodecs(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCurrentDeviceID(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCurrentDeviceMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostCurrentDeviceName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDevice(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceActuator(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceActuatorMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceActuatorName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceActuatorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceActuatorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceSensor(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceSensorMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceSensorMetaField(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceSensorName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceSensorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDeviceSensorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostDevices(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostMessage(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostSensor(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostSensorMeta(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostSensorName(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostSensorValue(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostSensorValues(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostUpdateApp(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func PostUserProfile(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysClearAll(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysDeleteLog(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysGetBuildNr(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysGetInfo(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysGetLog(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysGetLogs(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysGetUptime(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysGetVersion(resp http.ResponseWriter, req *http.Request, params routing.Params)
- func SysSetNewTimezone(resp http.ResponseWriter, req *http.Request, params routing.Params)
- type Actuator
- type ActuatorValue
- type Device
- type Info
- type Meta
- type ProbeMeta
- type Query
- type Sensor
- type SensorValue
- type Value
Constants ¶
const ( SameSiteDefaultMode http.SameSite = iota + 1 SameSiteLaxMode SameSiteStrictMode SameSiteNoneMode )
const TimeFormat = time.RFC3339 // "2006-01-02T15:04:05-0700"
TimeFormat (RFC3339)
Variables ¶
var Branch string
var BuildNr string
var Buildtime int64
var ExampleTime = "2006-01-02T15:04:05-07:00"
var Publish func(topic string, data []byte)
var Urls = []string{"http://localhost/"}
Only use host API calls for export
var Version string
Functions ¶
func DeleteActuator ¶
DeleteActuator implements DELETE /actuators/{actuatorID}
func DeleteCloud ¶
DeleteCloud implements DELETE /clouds/{cloudID}
func DeleteCodec ¶
DeleteCodec implements DELETE /codecs/{id}
func DeleteCurrentDevice ¶
DeleteCurrentDevice implements DELETE /device
func DeleteDevice ¶
DeleteDevice implements DELETE /devices/{deviceID}
func DeleteDeviceActuator ¶
DeleteDeviceActuator implements DELETE /devices/{deviceID}/actuators/{actuatorID}
func DeleteDeviceSensor ¶
DeleteDeviceSensor implements DELETE /devices/{deviceID}/sensors/{sensorID}
func DeleteSensor ¶
DeleteSensor implements DELETE /sensors/{sensorID}
func GetActuator ¶
GetActuator implements GET /actuators/{actuatorID}
func GetActuatorValue ¶
GetActuatorValue implements GET /actuators/{actuatorID}/value
func GetActuatorValues ¶
GetActuatorValues implements GET /actuators/{actuatorID}/values
func GetActuators ¶
GetActuators implements GET /actuators
func GetApp ¶
GetApp implements GET /apps/{app_id} GetApp implements GET /apps/{app_id}?install_logs
func GetCloudEvents ¶
GetCloudEvents implements GET /clouds/{cloudID}/events
func GetCloudStatus ¶
GetCloudStatus implements GET /clouds/{cloudID}/status
func GetCurrentDevice ¶
GetCurrentDevice implements GET /device
func GetCurrentDeviceID ¶
GetCurrentDeviceID implements GET /device/id
func GetCurrentDeviceMeta ¶
GetCurrentDeviceMeta implements GET /device/meta
func GetCurrentDeviceName ¶
GetCurrentDeviceName implements GET /device/name
func GetDeviceActuator ¶
GetDeviceActuator implements GET /devices/{deviceID}/actuators/{actuatorID}
func GetDeviceActuatorValue ¶
GetDeviceActuatorValue implements GET /devices/{deviceID}/actuators/{actuatorID}/value
func GetDeviceActuatorValues ¶
GetDeviceActuatorValues implements GET /devices/{deviceID}/actuators/{actuatorID}/values
func GetDeviceActuators ¶
GetDeviceActuators implements GET /devices/{deviceID}/actuators
func GetDeviceMeta ¶
GetDeviceMeta implements GET /devices/{deviceID}/meta
func GetDeviceName ¶
GetDeviceName implements GET /devices/{deviceID}/name
func GetDeviceSensor ¶
GetDeviceSensor implements GET /devices/{deviceID}/sensors/{sensorID}
func GetDeviceSensorValue ¶
GetDeviceSensorValue implements GET /devices/{deviceID}/sensors/{sensorID}/value
func GetDeviceSensorValues ¶
GetDeviceSensorValues implements GET /devices/{deviceID}/sensors/{sensorID}/values
func GetDeviceSensors ¶
GetDeviceSensors implements GET /devices/{deviceID}/sensors
func GetDevices ¶
GetDevices implements GET /devices
func GetExportAllInOne ¶
func GetExportBins ¶
func GetExportTree ¶
func GetMessages ¶
GetMessages implements GET /devices
func GetPermissions ¶
GetPermissions implements GET /auth/permissions
func GetRefereshToken ¶
GetRefereshToken implements POST /auth/retoken it takes a valid token and generate a new valid token it is used to keep the user logged in without asking for credentials every time the token gets expired
func GetSensorValue ¶
GetSensorValue implements GET /sensors/{sensorID}/value
func GetSensorValues ¶
GetSensorValues implements GET /sensors/{sensorID}/values
func GetSensors ¶
GetSensors implements GET /sensors
func GetUpdateApp ¶
GetUpdateApp implements GET /update/:app_id
func GetUserProfile ¶
GetUserProfile implements GET /auth/profile
func HandleAppProxyRequest ¶
HandleAppProxyRequest implements GET, POST, PUT and DELETE /apps/{app_id}/*file_path
func IsAuthorized ¶
IsAuthorized checks if the given request is valid for the API call
func IsDockerSubnet ¶
IsDockerSubnet calls `docker network inspect wazigate` to get the wazigate subnet from docker. It checks if the ip is in the subnet, because all containers from docker are whitelisted for the API.
func PostActuator ¶
PostActuator implements POST /actuators
func PostActuatorMeta ¶
PostActuatorMeta implements POST /actuators/{actuatorID}/meta
func PostActuatorName ¶
PostActuatorName implements POST /actuators/{actuatorID}/name
func PostActuatorValue ¶
PostActuatorValue implements POST /actuators/{actuatorID}/value
func PostActuatorValues ¶
PostActuatorValues implements POST /actuators/{actuatorID}/values
func PostApp ¶
PostApp implements POST /apps/{app_id} action={start | stop} PostApp implements POST /apps/{app_id} restart={"always" | "on-failure" | "unless-stopped" | "no"}
func PostCloudMQTTAddr ¶
PostCloudMQTTAddr implements POST /clouds/{cloudID}/mqtt
func PostCloudName ¶
PostCloudMQTTAddr implements POST /clouds/{cloudID}/name
func PostCloudPaused ¶
PostCloudPaused implements POST /clouds/{cloudID}/paused
func PostCloudRESTAddr ¶
PostCloudRESTAddr implements POST /clouds/{cloudID}/rest
func PostCloudToken ¶
PostCloudToken implements POST /clouds/{cloudID}/token
func PostCloudUsername ¶
PostCloudUsername implements POST /clouds/{cloudID}/username
func PostClouds ¶
PostClouds implements POST /clouds
func PostCodecs ¶
PostCodecs implements POST /codecs
func PostCurrentDeviceID ¶
PostCurrentDeviceID implements POST /device/id
func PostCurrentDeviceMeta ¶
PostCurrentDeviceMeta implements POST /device/meta
func PostCurrentDeviceName ¶
PostCurrentDeviceName implements POST /device/name
func PostDevice ¶
PostDevice implements POST /devices/{deviceID}
func PostDeviceActuator ¶
PostDeviceActuator implements POST /devices/{deviceID}/actuators
func PostDeviceActuatorMeta ¶
PostDeviceActuatorMeta implements POST /devices/{deviceID}/actuators/{actuatorID}/meta
func PostDeviceActuatorName ¶
PostDeviceActuatorName implements POST /devices/{deviceID}/actuators/{actuatorID}/name
func PostDeviceActuatorValue ¶
PostDeviceActuatorValue implements POST /devices/{deviceID}/actuators/{actuatorID}/value
func PostDeviceActuatorValues ¶
PostDeviceActuatorValues implements POST /devices/{deviceID}/actuators/{actuatorID}/values
func PostDeviceMeta ¶
PostDeviceMeta implements POST /devices/{deviceID}/meta
func PostDeviceName ¶
PostDeviceName implements POST /devices/{deviceID}/name
func PostDeviceSensor ¶
PostDeviceSensor implements POST /devices/{deviceID}/sensors
func PostDeviceSensorMeta ¶
PostDeviceSensorMeta implements POST /devices/{deviceID}/sensors/{sensorID}/meta
func PostDeviceSensorMetaField ¶
PostDeviceSensorMetaField implements POST /devices/{deviceID}/sensors/{sensorID}/meta/{meta}
func PostDeviceSensorName ¶
PostDeviceSensorName implements POST /devices/{deviceID}/sensors/{sensorID}/name
func PostDeviceSensorValue ¶
PostDeviceSensorValue implements POST /devices/{deviceID}/sensors/{sensorID}/value
func PostDeviceSensorValues ¶
PostDeviceSensorValues implements POST /devices/{deviceID}/sensors/{sensorID}/values
func PostDevices ¶
PostDevices implements POST /devices
func PostMessage ¶
func PostSensor ¶
PostSensor implements POST /sensors
func PostSensorMeta ¶
PostSensorMeta implements POST /sensors/{sensorID}/meta
func PostSensorName ¶
PostSensorName implements POST /sensors/{sensorID}/name
func PostSensorValue ¶
PostSensorValue implements POST /sensors/{sensorID}/value
func PostSensorValues ¶
PostSensorValues implements POST /sensors/{sensorID}/values
func PostUpdateApp ¶
PostUpdateApp implements POST /update/:app_id it updates the given app by pulling the latest images from docker hub and replace with the current one (uninstall the current version and install a new one ;]) please note that it will replace docker-compose.yml and package.json files with the new version as well.
func PostUserProfile ¶
PostUserProfile implements POST /auth/profile
func SysClearAll ¶
SysClearAll implements PUT /sys/clear_all
func SysDeleteLog ¶
SysDeleteLog implements DELETE /sys/log/{log_name}
func SysGetBuildNr ¶
func SysGetInfo ¶
func SysGetLogs ¶
SysGetLogs implements GET /sys/logs
func SysGetUptime ¶
SysGetUptime implements GET /sys/uptime
func SysGetVersion ¶
func SysSetNewTimezone ¶
Types ¶
type Actuator ¶
type Actuator struct { ID string `json:"id" bson:"id"` Name string `json:"name" bson:"name"` Modified time.Time `json:"modified" bson:"modified"` Created time.Time `json:"created" bson:"created"` Time time.Time `json:"time" bson:"time"` Value interface{} `json:"value" bson:"value"` Meta Meta `json:"meta" bson:"meta"` }
Actuator represents a Waziup actuator
type ActuatorValue ¶
type ActuatorValue struct { ID bson.ObjectId `json:"id" bson:"_id"` Value interface{} `json:"value" bson:"value"` DeviceID string `json:"deviceId" bson:"deviceId"` ActuatorID string `json:"actuatorId" bson:"actuatorId"` }
ActuatorValue represents a Waziup actuator data value
func (*ActuatorValue) MarshalJSON ¶
func (v *ActuatorValue) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for ActuatorValue
type Device ¶
type Device struct { Name string `json:"name" bson:"name"` ID string `json:"id" bson:"_id"` Sensors []*Sensor `json:"sensors" bson:"sensors"` Actuators []*Actuator `json:"actuators" bson:"actuators"` Modified time.Time `json:"modified" bson:"modified"` Created time.Time `json:"created" bson:"created"` Meta Meta `json:"meta" bson:"meta"` }
Device represents a Waziup Device
type Sensor ¶
type Sensor struct { ID string `json:"id" bson:"id"` Name string `json:"name" bson:"name"` Modified time.Time `json:"modified" bson:"modified"` Created time.Time `json:"created" bson:"created"` Time time.Time `json:"time" bson:"time"` Value interface{} `json:"value" bson:"value"` Meta Meta `json:"meta" bson:"meta"` }
Sensor represents a Waziup sensor
type SensorValue ¶
type SensorValue struct { ID bson.ObjectId `json:"id" bson:"_id"` Value interface{} `json:"value" bson:"value"` DeviceID string `json:"deviceId" bson:"deviceId"` SensorID string `json:"sensorId" bson:"sensorId"` }
SensorValue represents a Waziup sensor data value
func (*SensorValue) MarshalJSON ¶
func (v *SensorValue) MarshalJSON() ([]byte, error)
MarshalJSON provides a custom json serialization for values, transforming
{_id: ..., value: ...}
to
{value: ..., time: ...}