Support iot and iot-data (#1303)
* append appropriate urls when scaffolding * make dispatch for rest-api * fix dispatch for rest-json * fix moto/core/response to obtain path and body parameters * small fixes * remove unused import * fix get_int_param * Add features of things and thing-types * fix scaffold * basic crud of cert * support basic CRUD of policy * refactor * fix formatting of scaffold * support principal_pocicy * support thing_principal * update readme * escape service to handle service w/ hyphen like iot-data * escape service w/ hyphen * fix regexp to extract region from url * escape service * Implement basic iota-data feature * iot-data shadow delta * update readme * remove unused import * remove comment * fix syntax * specify region when creating boto3 client for test * use uuid for seed of generating cert id * specify region_name to iotdata client in test * specify region to boto3 client in moto response * excude iot and iotdata tests on server mode * fix handling of thingTypeName in describe-thing * test if server is up for iot
This commit is contained in:
parent
884fc6f260
commit
0de2e55b13
20 changed files with 1260 additions and 4 deletions
35
moto/iotdata/responses.py
Normal file
35
moto/iotdata/responses.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
from __future__ import unicode_literals
|
||||
from moto.core.responses import BaseResponse
|
||||
from .models import iotdata_backends
|
||||
import json
|
||||
|
||||
|
||||
class IoTDataPlaneResponse(BaseResponse):
|
||||
SERVICE_NAME = 'iot-data'
|
||||
|
||||
@property
|
||||
def iotdata_backend(self):
|
||||
return iotdata_backends[self.region]
|
||||
|
||||
def update_thing_shadow(self):
|
||||
thing_name = self._get_param("thingName")
|
||||
payload = self.body
|
||||
payload = self.iotdata_backend.update_thing_shadow(
|
||||
thing_name=thing_name,
|
||||
payload=payload,
|
||||
)
|
||||
return json.dumps(payload.to_response_dict())
|
||||
|
||||
def get_thing_shadow(self):
|
||||
thing_name = self._get_param("thingName")
|
||||
payload = self.iotdata_backend.get_thing_shadow(
|
||||
thing_name=thing_name,
|
||||
)
|
||||
return json.dumps(payload.to_dict())
|
||||
|
||||
def delete_thing_shadow(self):
|
||||
thing_name = self._get_param("thingName")
|
||||
payload = self.iotdata_backend.delete_thing_shadow(
|
||||
thing_name=thing_name,
|
||||
)
|
||||
return json.dumps(payload.to_dict())
|
||||
Loading…
Add table
Add a link
Reference in a new issue