Esempio n. 1
0
 def list_devices(self,
                  name=None,
                  name_pattern=None,
                  network_id=None,
                  network_name=None,
                  sort_field=None,
                  sort_order=None,
                  take=None,
                  skip=None):
     auth_api_request = AuthApiRequest(self)
     auth_api_request.url('device')
     auth_api_request.action('device/list')
     auth_api_request.param('name', name)
     auth_api_request.param('namePattern', name_pattern)
     auth_api_request.param('networkId', network_id)
     auth_api_request.param('networkName', network_name)
     auth_api_request.param('sortField', sort_field)
     auth_api_request.param('sortOrder', sort_order)
     auth_api_request.param('take', take)
     auth_api_request.param('skip', skip)
     auth_api_request.response_key('devices')
     devices = auth_api_request.execute('List devices failure.')
     return [Device(self, device) for device in devices]
Esempio n. 2
0
 def put_device(self,
                device_id,
                name=None,
                data=None,
                network_id=None,
                is_blocked=False):
     if not name:
         name = device_id
     device = {
         Device.ID_KEY: device_id,
         Device.NAME_KEY: name,
         Device.DATA_KEY: data,
         Device.NETWORK_ID_KEY: network_id,
         Device.IS_BLOCKED_KEY: is_blocked
     }
     device = Device(self, device)
     device.save()
     device.get(device_id)
     return device
Esempio n. 3
0
 def get_device(self, device_id):
     device = Device(self)
     device.get(device_id)
     return device