def update(self, friendly_name=values.unset, status=values.unset): """ Update the AccountInstance :param unicode friendly_name: FriendlyName to update :param AccountInstance.Status status: Status to update the Account with :returns: Updated AccountInstance :rtype: connio.rest.api.v3.account.AccountInstance """ data = values.of({ 'friendlyName': friendly_name, 'status': status, }) payload = self._version.update( 'PUT', self._uri, data=data, ) return AccountInstance( self._version, payload, id=self._solution['id'], )
def update(self, name=values.unset, status=values.unset): """ Update the SysUserInstance :param unicode name: User name to update :param SysUserInstance.Status status: Status to update the User with :returns: Updated SysUserInstance :rtype: connio.rest.api.v3.sysuser.SysUserInstance """ data = values.of({ 'name': name, 'status': status, }) payload = self._version.update( 'PUT', self._uri, data=data, ) return SysUserInstance( self._version, payload, id=self._solution['id'], )
def update(self, name=values.unset, password=values.unset): """ Update the UserInstance :param unicode name: Given name of the entity :param unicode password: :returns: Updated UserInstance :rtype: connio.rest.api.v3.account.user.UserInstance """ data = values.of({ 'name': name, 'password': password, }) payload = self._version.update( 'PUT', self._uri, data=data, ) return UserInstance( self._version, payload, account_id=self._solution['account_id'], id=self._solution['id'], )
def update(self, name=values.unset, friendly_name=values.unset, method_impl=values.unset): """ Update the MethodInstance :param unicode name: Given name of the entity :param unicode friendly_name: A human readable description of this resource :returns: Updated MethodInstance :rtype: connio.rest.api.v3.account.method.MethodInstance """ data = values.of({ 'name': name, 'friendlyName': friendly_name, 'methodImpl': serialize.methodImplementation(method_impl.body, method_impl.lang), }) payload = self._version.update( 'PUT', self._uri, data=data, ) return MethodInstance( self._version, payload, account_id=self._solution['account_id'], id=self._solution['id'], )
def update(self, name=values.unset, friendly_name=values.unset, description=values.unset, tags=values.unset, status=values.unset): """ Update the AppInstance :param unicode name: Given name of the entity :param unicode friendly_name: A human readable description of this resource :returns: Updated AppInstance :rtype: connio.rest.api.v3.account.app.AppInstance """ data = values.of({ 'name': name, 'friendlyName': friendly_name, 'description': description, 'tags': tags, 'status': status, }) payload = self._version.update( 'POST', self._uri, data=data, ) return AppInstance( self._version, payload, account_id=self._solution['account_id'], id=self._solution['id'], )
def page(self, friendly_name=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of AppInstance records from the API. Request is executed immediately :param unicode friendly_name: Filter by friendly name :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 200 :returns: Page of AppInstance :rtype: connio.rest.api.v3.account.app.AppPage """ params = values.of({ 'FriendlyName': friendly_name, 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return AppPage(self._version, response, self._solution)
def page(self, friendly_name=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of PropertyInstance records from the API. Request is executed immediately :param unicode friendly_name: Filter by friendly name :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 200 :returns: Page of PropertyInstance :rtype: connio.rest.api.v3.account.property.PropertyPage """ params = values.of({ 'ownerId': self._solution['owner_id'], 'friendlyName': friendly_name, 'page': page_number, 'pageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return PropertyPage(self._version, response, self._solution)
def update(self, name=values.unset, friendly_name=values.unset, measurement=values.unset): """ Update the PropertyInstance :param unicode name: Given name of the entity :param unicode friendly_name: A human readable description of this resource :returns: Updated PropertyInstance :rtype: connio.rest.api.v3.account.property.PropertyInstance """ from connio.base import serialize data = values.of({ 'name': name, 'friendlyName': friendly_name, 'measurement': serialize.measurement(measurement), }) payload = self._version.update( 'PUT', self._uri, data=data, ) return PropertyInstance( self._version, payload, account_id=self._solution['account_id'], id=self._solution['id'], )
def page(self, name=values.unset, status=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of SysUserInstance records from the API. Request is executed immediately :param unicode name: User name to filter on :param SysUserInstance.Status status: Status to filter on :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of SysUserInstance :rtype: connio.rest.api.v3.sysuser.SysUserPage """ params = values.of({ 'name': name, 'status': status, 'pageNo': page_number, 'pageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return SysUserPage(self._version, response, self._solution)
def update(self, context=values.unset, scope=values.unset, rate_limit=values.unset): """ Update the ApiKeyInstance :param unicode context: :param unicode scope: :returns: Updated ApiKeyInstance :rtype: connio.rest.api.v3.account.apikey.ApiKeyInstance """ data = values.of({ 'context': context, 'scope': scope, 'rateLimit': rate_limit, }) payload = self._version.update( 'PUT', self._uri, data=data, ) return ApiKeyInstance( self._version, payload, account_id=self._solution['account_id'], owner_type=self._solution['owner_type'], owner_id=self._solution['owner_id'], )
def create_batch(self, devices): """ Create multiple devices """ data = values.of(devices) # { # 'name': name, # 'profile': profile, # 'apps': apps, # 'friendlyName': friendly_name, # 'description': description, # 'tags': tags, # 'location': serialize.location(location), # 'customIds': custom_ids, # 'status': status, # 'period': period, # 'annotateWithLoc': annotate_with_location, # 'annotateWithMeta': annotate_with_meta, # } payload = self._version.create( 'POST', self._uri, data=data, ) return payload
def create(self, name, trigger, metric, friendly_name=values.unset, status='enabled', description=values.unset, tags=values.unset, conditions=values.unset, notifications=values.unset, locked=values.unset): """ Create a new AlertInstance :param unicode name: A name uniquely identifying this alert within account context :param unicode friendly_name: :param unicode status: :param unicode description: A description of this alert :param unicode tags: Tags associated with this alert :returns: Newly created AlertInstance :rtype: connio.rest.api.v3.account.alert.AlertInstance """ data = values.of({ 'name': name, 'ownerId': self._solution['owner_id'], 'friendlyName': friendly_name, 'description': description, 'tags': tags, 'status': status, 'trigger': trigger, 'metric': metric, 'conditions': serialize.conditions(conditions), 'notifications': serialize.notifications(notifications), 'locked': locked, }) payload = self._version.create( 'POST', self._uri, data=data, ) return AlertInstance( self._version, payload, account_id=self._solution['account_id'], )
def activate(self, token): """ """ params = values.of({'token': token}) payload = self._version.fetch( 'GET', self._uri + '/activate', params=params, ) return UserInstance(self._version, payload, payload['accountId'])
def create(self, name, data_type, access_type, publish_type, friendly_name=values.unset, description=values.unset, tags=values.unset, measurement=values.unset, retention=values.unset, boundaries=values.unset, locked=values.unset): """ Create a new PropertyInstance :param unicode name: A name uniquely identifying this property within account context :param unicode owner_id: Property owner's id :param unicode type: Property data type :param unicode friendly_name: A human readable description of the application :param unicode description: A description of this property :param unicode tags: Tags associated with this property :returns: Newly created PropertyInstance :rtype: connio.rest.api.v3.account.property.PropertyInstance """ from connio.base import serialize data = values.of({ 'name': name, 'ownerId': self._solution['owner_id'], 'friendlyName': friendly_name, 'description': description, 'tags': tags, 'type': data_type, 'access': access_type, 'publish': publish_type, 'measurement': serialize.measurement(measurement), 'boundaries': serialize.boundaries(boundaries), 'retention': serialize.retention(retention), 'locked': locked, }) payload = self._version.create( 'POST', self._uri, data=data, ) return PropertyInstance( self._version, payload, account_id=self._solution['account_id'], )
def create(self, name, profile, apps=values.unset, friendly_name=values.unset, description=values.unset, tags=values.unset, status=values.unset, location=values.unset, custom_ids=values.unset, period=values.unset, annotate_with_location=values.unset, annotate_with_meta=values.unset): """ Create a new DeviceInstance :param unicode name: A name uniquely identifying this device within account context :param unicode friendly_name: A human readable description of the device :param unicode description: A description of this device :param unicode tags: Tags associated with this device :returns: Newly created DeviceInstance :rtype: connio.rest.api.v3.account.device.DeviceInstance """ data = values.of({ 'name': name, 'profile': profile, 'apps': apps, 'friendlyName': friendly_name, 'description': description, 'tags': tags, 'location': serialize.location(location), 'customIds': custom_ids, 'status': status, 'period': period, 'annotateWithLoc': annotate_with_location, 'annotateWithMeta': annotate_with_meta, }) payload = self._version.create( 'POST', self._uri, data=data, ) return DeviceInstance( self._version, payload, account_id=self._solution['account_id'], )
def create(self, name, access_type, method_impl=values.unset, friendly_name=values.unset, description=values.unset, tags=values.unset, locked=values.unset): """ Create a new MethodInstance :param unicode name: A name uniquely identifying this method within account context :param unicode access_type: :param unicode method_impl: :param unicode description: A description of this method :param unicode tags: Tags associated with this method :returns: Newly created MethodInstance :rtype: connio.rest.api.v3.account.method.MethodInstance """ data = values.of({ 'name': name, 'ownerId': self._solution['owner_id'], 'friendlyName': friendly_name, 'description': description, 'tags': tags, 'access': access_type, 'locked': locked, 'methodImpl': serialize.methodImplementation(method_impl.body, method_impl.lang), }) payload = self._version.create( 'POST', self._uri, data=data, ) return MethodInstance( self._version, payload, account_id=self._solution['account_id'], )
def create(self, name, base_profile=values.unset, friendly_name=values.unset, description=values.unset, tags=values.unset, device_class=values.unset, vendor_name=values.unset, product_name=values.unset, image_url=values.unset, locked=values.unset): """ Create a new DeviceProfileInstance :param unicode name: A name uniquely identifying this deviceprofile within account context :param unicode friendly_name: A human readable description of the application :param unicode description: A description of this deviceprofile :param unicode tags: Tags associated with this deviceprofile :returns: Newly created DeviceProfileInstance :rtype: connio.rest.api.v3.account.deviceprofile.DeviceProfileInstance """ # if tags is not None: # tags = tags[:32] data = values.of({ 'name': name, 'friendlyName': friendly_name, 'baseProfile': base_profile, 'description': description, 'tags': tags, 'deviceClass': device_class, 'vendorName': vendor_name, 'productName': product_name, 'imageUrl': image_url, 'locked': locked, }) payload = self._version.create( 'POST', self._uri, data=data, ) return DeviceProfileInstance( self._version, payload, account_id=self._solution['account_id'], )
def create(self, name, friendly_name=values.unset, owner=values.unset, userInfo=values.unset, tags=values.unset, description=values.unset, plan=values.unset): """ Create a new AccountInstance :param unicode friendly_name: A human readable description of the account :returns: Newly created AccountInstance :rtype: connio.rest.api.v3.account.AccountInstance """ from connio.base import serialize adminInfo = values.unset if userInfo is not values.unset: adminInfo = { 'email': userInfo.email, 'role': userInfo.role, 'name': userInfo.name } data = values.of({ 'name': name, 'friendlyName': friendly_name, 'owner': owner, 'user': adminInfo, 'tags': tags, 'description': description, 'plan': serialize.plan(plan) }) payload = self._version.create( 'POST', self._uri, data=data, ) if userInfo is not None: # System returns a token return payload else: return AccountInstance( self._version, payload, )
def update(self, name=values.unset, friendly_name=values.unset, apps=values.unset, description=values.unset, tags=values.unset, period=values.unset, location=values.unset, custom_ids=values.unset, status=values.unset, annotate_with_location=values.unset, annotate_with_meta=values.unset): """ Update the DeviceInstance :param unicode name: Given name of the entity :param unicode friendly_name: A human readable description of this resource :returns: Updated DeviceInstance :rtype: connio.rest.api.v3.account.device.DeviceInstance """ data = values.of({ 'name': name, 'friendlyName': friendly_name, 'apps': apps, 'description': description, 'tags': tags, 'location': serialize.location(location), 'custom_ids': custom_ids, 'status': status, 'period': period, 'annotateWithLoc': annotate_with_location, 'annotateWithMeta': annotate_with_meta, }) payload = self._version.update( 'PUT', self._uri, data=data, ) return DeviceInstance( self._version, payload, account_id=self._solution['account_id'], id=self._solution['id'], )
def fetch(self): """ Fetch a SysUserInstance :returns: Fetched SysUserInstance :rtype: connio.rest.api.v3.sysuser.SysUserInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return SysUserInstance( self._version, payload, id=self._solution['id'], )
def fetch(self): """ Fetch a AccountInstance :returns: Fetched AccountInstance :rtype: connio.rest.api.v3.account.AccountInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return AccountInstance( self._version, payload, id=self._solution['id'], )
def create(self, email, role, name=values.unset): """ Create a new UserInstance :param unicode email: :param unicode role: :param unicode name: :returns: Newly created UserInstance :rtype: connio.rest.api.v3.account.user.UserInstance """ data = values.of({'name': name, 'email': email, 'role': role}) token = self._version.create( 'POST', self._uri, data=data, ) return token
def update(self, name=values.unset, friendly_name=values.unset, description=values.unset, tags=values.unset, device_class=values.unset, vendor_name=values.unset, product_name=values.unset, image_url=values.unset): """ Update the DeviceProfileInstance :param unicode name: Given name of the entity :param unicode friendly_name: A human readable description of this resource :returns: Updated DeviceProfileInstance :rtype: connio.rest.api.v3.account.deviceprofile.DeviceProfileInstance """ data = values.of({ 'name': name, 'friendlyName': friendly_name, 'description': description, 'tags': tags, 'deviceClass': device_class, 'vendorName': vendor_name, 'productName': product_name, 'imageUrl': image_url, }) payload = self._version.update( 'PUT', self._uri, data=data, ) return DeviceProfileInstance( self._version, payload, account_id=self._solution['account_id'], id=self._solution['id'], )
def fetch(self): """ Fetch a DeviceProfileInstance :returns: Fetched DeviceProfileInstance :rtype: connio.rest.api.v3.account.deviceprofile.DeviceProfileInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return DeviceProfileInstance( self._version, payload, account_id=self._solution['account_id'], id=self._solution['id'], )
def create(self, context, scope, name=values.unset, friendly_name=values.unset, description=values.unset, tags=values.unset): """ Create a new ApiClientInstance :param unicode name: A name uniquely identifying this apiclient within account context :param unicode friendly_name: A human readable description of the application :param unicode description: A description of this deviceprofile :param unicode tags: Tags associated with this deviceprofile #TODO Doldur! :returns: Newly created ApiClientInstance :rtype: connio.rest.api.v3.account.deviceprofile.ApiClientInstance """ data = values.of({ 'name': name, 'friendlyName': friendly_name, 'context': context, 'scope': scope, 'description': description, 'tags': tags, }) payload = self._version.create( 'POST', self._uri, data=data, ) return ApiClientInstance( self._version, payload, account_id=self._solution['account_id'], )
def fetch(self): """ Fetch a DataConnectorInstance :returns: Fetched DataConnectorInstance :rtype: connio.rest.api.v3.account.dataconnector.DataConnectorInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return DataConnectorInstance( self._version, payload, account_id=self._solution['account_id'], owner_id=self._solution['owner_id'], id=self._solution['id'], )
def fetch(self): """ Fetch a ApiKeyInstance :returns: Fetched ApiKeyInstance :rtype: connio.rest.api.v3.account.apikey.ApiKeyInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return ApiKeyInstance( self._version, payload, account_id=self._solution['account_id'], owner_type=self._solution['owner_type'], owner_id=self._solution['owner_id'], )
def create(self, id, type, config, disabled=values.unset): """ Create a new DataConnectorInstance :param unicode id: Unique identifier assinged to this data connector :param unicode type: :param unicode config: :returns: Newly created DataConnectorInstance :rtype: connio.rest.api.v3.account.dataconnector.DataConnectorInstance """ data = None if type == DataConnectorInstance.ConnectorType.COUCHDB: data = values.of({ 'id': id, 'type': type, 'disabled': disabled, 'server': config['server'], 'databaseName': config['database_name'], 'port': config['port'], 'ssl': config['ssl'], 'credentials': config['credentials'] }) payload = self._version.create( 'POST', self._uri, data=data, ) return DataConnectorInstance( self._version, payload, account_id=self._solution['account_id'], owner_id=self._solution['owner_id'], )
def update(self, id, type, disabled=values.unset, config=values.unset): """ Update the DataConnectorInstance :param unicode config: :returns: Updated DataConnectorInstance :rtype: connio.rest.api.v3.account.dataconnector.DataConnectorInstance """ data = None if type == DataConnectorInstance.ConnectorType.COUCHDB: data = values.of({ 'id': id, 'type': type, 'disabled': disabled, 'server': config['server'], 'database_name': config['databaseName'], 'port': config['port'], 'ssl': config['ssl'], 'credentials': config['credentials'] }) payload = self._version.update( 'PUT', self._uri, data=data, ) return DataConnectorInstance( self._version, payload, account_id=self._solution['account_id'], owner_id=self._solution['owner_id'], id=self._solution['id'], )
def create(self, email, name=values.unset): """ Create a new SysUserInstance :param unicode name: Name of this user :returns: Newly created SysUserInstance :rtype: connio.rest.api.v3.sysuser.SysUserInstance """ data = values.of({ 'name': name, 'email': email, }) payload = self._version.create( 'POST', self._uri, data=data, ) return SysUserInstance( self._version, payload, )