Skip to content

Files

Latest commit

a59a585 · Dec 7, 2018

History

History
1597 lines (1358 loc) · 60.1 KB

DOCUMENTATION.md

File metadata and controls

1597 lines (1358 loc) · 60.1 KB

agile ⇒ Object

Welcome to the Agile SDK documentation.

This document aims to describe all the functions supported by the SDK, as well as showing examples of their expected usage.

If you feel something is missing, not clear or could be improved, please don't hesitate to open an issue in GitHub, we'll be happy to help.

Kind: global namespace

Type Description
Object including the api base url, idm base url (if not provided defaults to the same api host but default idm port), and a token.

Example

var agile = require('agile-sdk')({
      api:'http://agile-core:8080',
      idm: 'http://agile-core:3000',
      data: 'http://agile-data:1338',
      token: 'zIOycOqbEQh4ayw7lGAm9ILBIr'
    })

agile.protocolManager : object

Kind: static namespace of agile

protocolManager.discovery : object

Kind: static namespace of protocolManager

discovery.start([protocolId]) ⇒ Promise

Kind: static method of discovery
Summary: Start device discovery on all or single protocol
Access: public
Fulfil: null

Param Description
[protocolId] Agile protocol Id

Example

agile.protocolManager.discovery.start().then(function() {
  console.log('All protocols discovery is on');
});
agile.protocolManager.discovery.start('Bluetooth LE').then(function() {
  console.log('Bluetooth LE protocols discovery is on');
});

discovery.stop([protocolId]) ⇒ Promise

Kind: static method of discovery
Summary: Stop device discovery on all or single protocol
Access: public
Fulfil: null

Param Description
[protocolId] Agile protocol Id

Example

agile.protocolManager.discovery.stop().then(function() {
  console.log('All protocols discovery is off');
});
agile.protocolManager.discovery.stop('Bluetooth LE').then(function() {
  console.log('Bluetooth LE discovery is off');
});

discovery.status([protocolId]) ⇒ Promise

Kind: static method of discovery
Summary: Return the status object of discovery on the all or single protocol
Access: public
Fulfil: Array|Object

Param Description
[protocolId] Agile protocol Id

Example

agile.protocolManager.discovery.status().then(function(protocols) {
  console.log(protocols);
});
agile.protocolManager.discovery.status('Bluetooth LE').then(function(protocol) {
  console.log(protocol.status);
});

protocolManager.get() ⇒ Promise

Kind: static method of protocolManager
Summary: Get the list of registered protocols
Access: public
Fulfil: Array - protocols
Example

agile.protocolManager.protocols.get().then(function(protocols) {
  console.log(protocols);
});

protocolManager.delete(protocolId) ⇒ Promise

Kind: static method of protocolManager
Summary: Unregister a Dbus Protocol object reference
Access: public
Fulfil: null

Param Type Description
protocolId String Agile protocol Id

Example

agile.protocolManager.protocols.delete(protocolId).then(function() {
  console.log('protocol has been unregistered');
});

protocolManager.create(protocolId) ⇒ Promise

Kind: static method of protocolManager
Summary: Register a new Dbus object implementing the protocol API
Access: public
Fulfil: null

Param Type Description
protocolId String Agile protocol Id

Example

agile.protocolManager.protocols.create(protocolId).then(function() {
  console.log('protocol has been registered');
});

protocolManager.devices() ⇒ Promise

Kind: static method of protocolManager
Summary: List all discovered devices on all available protocols
Access: public
Fulfil: Array - devices
Example

agile.protocolManager.devices().then(function(devices) {
 console.log(devices);
});

agile.deviceManager : object

Kind: static namespace of agile

deviceManager.get([deviceId]) ⇒ Promise

Kind: static method of deviceManager
Summary: Get all or single device definition
Access: public
Fulfil: Array - devices

Param Type Description
[deviceId] String Agile device Id

Example

agile.deviceManager.get('bleB0B448BE5084').then(function(device) {
  console.log(device);
});

deviceManager.delete(deviceId) ⇒ Promise

Kind: static method of deviceManager
Summary: Delete a device definition and unregister it
Access: public
Fulfil: undefined

Param Type Description
deviceId String Agile device Id

Example

agile.deviceManager.delete('bleB0B448BE5084').then(function() {
  console.log('Device bleB0B448BD1085 deleted');
});

deviceManager.create(deviceOverview, type) ⇒ Promise

Kind: static method of deviceManager
Summary: Register a new device based on information from ProtocolManager and device type
Access: public
Fulfil: Object - device

Param Type
deviceOverview Object
type string

Example

const deviceOverview = {
  "name": "CC2650 SensorTag",
  "protocol": "iot.agile.protocol.BLE",
  "id": "B0:B4:48:BD:10:85",
  "status": "CONNECTED"
};
const type = "TI SensorTag";

agile.deviceManager.create(deviceOverview, type).then(function(newDevice) {
 console.log(newDevice);
});

deviceManager.typeof(deviceOverview) ⇒ Promise

Kind: static method of deviceManager
Summary: Get matching types for a device overview
Access: public
Fulfil: Array - deviceTypes

Param Type
deviceOverview Object

Example

const deviceOverview = {
  "name": "CC2650 SensorTag",
  "protocol": "iot.agile.protocol.BLE",
  "id": "B0:B4:48:BD:10:85",
  "status": "CONNECTED"
};

agile.deviceManager.typeof(deviceOverview).then(function(deviceTypes) {
 console.log(deviceTypes);
});

agile.device : object

Kind: static namespace of agile

device.status(deviceId) ⇒ Promise

Kind: static method of device
Summary: Get the device status
Access: public
Fulfil: String - status

Param Type Description
deviceId String Agile device Id

Example

agile.device.status('bleB0B448BE5084').then(function(status) {
 console.log(status);
});

device.get(deviceId, [componentId]) ⇒ Promise

Kind: static method of device
Summary: Read values of all components from the device
Access: public
Fulfil: Object|Array Single Component readings returned as object, Device readings returned as Array of Objects.

Param Type Description
deviceId String Agile device Id
[componentId] String Agile component name, like a sensor

Example

agile.device.get('bleB0B448BE5084').then(function(deviceComponents) {
  console.log(deviceComponents);
});

Example

agile.device.get('bleB0B448BE5084', 'Temperature').then(function(deviceComponent) {
  console.log(deviceComponent);
});

device.connect(deviceId) ⇒ Promise

Kind: static method of device
Summary: Connect the device at protocol level
Access: public
Fulfil: Undefined

Param Type Description
deviceId String Agile device Id

Example

agile.device.connect('bleB0B448BE5084').then(function() {
  console.log('Connected!');
});

device.disconnect(deviceId) ⇒ Promise

Kind: static method of device
Summary: Disconnect device at protocol level
Access: public
Fulfil: Undefined

Param Type Description
deviceId String Agile device Id

Example

agile.device.disconnect('bleB0B448BE5084').then(function() {
  console.log('Disconnected!');
});

device.execute(deviceId, command) ⇒ Promise

Kind: static method of device
Summary: Perform an action on the device
Access: public
Fulfil: Undefined

Param Type Description
deviceId String Agile device Id
command String Operation name to be performed

Example

agile.device.execute('bleB0B448BE5084', command).then(function() {
  console.log(`executed ${command}!``);
});

device.lastUpdate(deviceId, [componentId]) ⇒ Promise

Kind: static method of device
Summary: Get the last record fetched from the device or component
Access: public
Fulfil: Object|Array Single Component readings returned as object, Device readings returned as Array of Objects.

Param Type Description
deviceId String Agile device Id
[componentId] String Agile component name, like a sensor

Example

agile.device.lastUpdate('bleB0B448BE5084', 'Temperature').then(function(temperatureReading) {
 console.log(temperatureReading);
});

Example

agile.device.lastUpdate('bleB0B448BE5084').then(function(componentsReading) {
 console.log(componentsReading);
});

device.subscribe(deviceId, componentId) ⇒ Promise

Kind: static method of device
Summary: Enable a subscription to a data stream. Asynchronous data updates will be delivered via websocket.
Access: public
Fulfil: Object - websocket instance - https://www.w3.org/TR/websockets/

Param Type Description
deviceId String Agile device Id
componentId String Operation name to be performed

Example

agile.device.subscribe('bleB0B448BE5084', 'Temperature').then(function(stream) {
  stream.onerror = () => {
   console.log('Connection Error');
 };

 stream.onopen = () => {
   console.log('WebSocket Client Connected');
 };

 stream.onclose = () => {
   console.log('echo-protocol Client Closed');
 };

 stream.onmessage = (e) => {
   if (typeof e.data === 'string') {
     console.log("Received: '" + e.data + "'");
   }
 };
});

device.unsubscribe(deviceId, componentId) ⇒ Promise

Kind: static method of device
Summary: Unsubscribe from a data stream
Access: public
Fulfil: undefined

Param Type Description
deviceId String Agile device Id
componentId String Agile component name, like a sensor

Example

agile.device.unsubscribe('bleB0B448BE5084', 'Temperature').then(function() {
 console.log('Unsubscribed!');
});

agile.protocol : object

Kind: static namespace of agile

protocol.disconnect(protocolId, deviceId) ⇒ Promise

Kind: static method of protocol
Summary: Disconnect from the device
Access: public
Fulfil: Undefined

Param Type Description
protocolId String Agile Id of the protocol
deviceId String Agile internal Id of the protocol

Example

agile.protocol.disconnect('Bluetooth LE', 'bleB0B448BE5084').then(function() {
 console.log('Disconnected!');
});

protocol.connect(protocolId, deviceId) ⇒ Promise

Kind: static method of protocol
Summary: Connect to the device
Access: public
Fulfil: Undefined

Param Type Description
protocolId String Agile Id of the protocol
deviceId String Agile internal Id of the protocol

Example

agile.protocol.connect('Bluetooth LE', 'bleB0B448BE5084').then(function() {
 console.log('Connected!');
});

protocol.read(protocolId, deviceId) ⇒ Promise

Kind: static method of protocol
Summary: Call a read via protocol
Access: public
Fulfil: Object

Param Type Description
protocolId String Agile Id of the protocol
deviceId String Agile internal Id of the protocol

Example

agile.protocol.read('Bluetooth LE', 'bleB0B448BE5084').then(function(data) {
 console.log(data);
});

protocol.write(protocolId, deviceId, data) ⇒ Promise

Kind: static method of protocol
Summary: Call a write via protocol
Access: public
Fulfil: Undefined

Param Type Description
protocolId String Agile Id of the protocol
deviceId String Agile internal Id of the protocol
data object An object containing the content to write

Example

agile.protocol.write('Bluetooth LE', 'bleB0B448BE5084', data).then(function() {
 console.log('wrote data!');
});

agile.idm : object

Kind: static namespace of agile

idm.group : object

Kind: static namespace of idm

group.get([owner], [groupName]) ⇒ Promise

Kind: static method of group
Summary: Get a particular group by name and owner
Access: public
Fulfil: Array all groups if no arguments are provided, otherwise the group with given name and owner.

Param Type Description
[owner] String Owner of the group
[groupName] String Name of the group

Example

agile.idm.group.get('agile!@!agile-local','my-group').then(function(group) {
  console.log('this is my group '+JSON.stringify(group));
});
agile.idm.group.get().then(function(groups) {
  console.log('these are all groups '+JSON.stringify(groups));
});

group.create(groupName) ⇒ Promise

Kind: static method of group
Summary: Create a group onwned by the authenticated user
Access: public
Fulfil: Object group created

Param Type Description
groupName String Name of the group

Example

agile.idm.group.create('ble-devices').then(function(group) {
  console.log('group created!'+group);
});

group.delete(owner, groupName) ⇒ Promise

Kind: static method of group
Summary: Delete a group
Access: public
Fulfil: Undefined

Param Type Description
owner String Owner of the group
groupName String Name of the group

Example

agile.idm.group.delete('agile!@!agile-local','my-group').then(function() {
  console.log('group removed!');
});

group.addEntity(containing) ⇒ Promise

Kind: static method of group
Summary: Add entity to a group
Access: public
Fulfil: Undefined

Param Type Description
containing Object the owner of the group, the name of the group, the id of the entity to be added to the group, and the Type of the entity

Example

agile.idm.group.addEntity({
          owner: 'agile!@!agile-local',
          name: 'my-group',
          entityId: '1',
          entityType: 'device'
        }).then(function(updated) {
  console.log('entity updated !'+updated);
});

group.removeEntity(containing) ⇒ Promise

Kind: static method of group
Summary: Remove entity from a group
Access: public
Fulfil: Undefined

Param Type Description
containing Object the owner of the group, the name of the group, the id of the entity to be removed to the group, and the Type of the entity

Example

agile.idm.group.removeEntity({
          owner: 'agile!@!agile-local',
          name: 'my-group',
        entityId: '1',
          entityType: 'device'
        }).then(function(updated) {
  console.log('entity updated !'+updated);
});

idm.user : object

Kind: static namespace of idm

user.getCurrentUserInfo() ⇒ Promise

Kind: static method of user
Summary: Get the user information for the user currently logged in, i.e. token provided when agileSDK was created
Access: public
Fulfil: Object userInfo - object with user information
Example

agile.idm.user.getCurrentUserInfo().then(function(info) {
 console.log(info);
});

user.get(userName, authType) ⇒ Promise

Kind: static method of user
Summary: Show information for a particular user by username and authentication type
Access: public
Fulfil: Object user found

Param Type Description
userName String user name
authType String authentication type

Example

agile.idm.user.get('alice','agile-local').then(function(user) {
  console.log(user);
});

user.create(including, authType, [options]) ⇒ Promise

Kind: static method of user
Summary: Create user
Access: public
Fulfil: Object user created

Param Type Description
including object userName user name
authType String authentication type
[options] Object continaing role of the user as 'role' and password as 'password'

Example

agile.idm.user.create('bob','agile-local',{'role':'admin', 'password':'secret'}).then(function(user) {
  console.log('user created!'+user);
});

user.delete(userName, authType) ⇒ Promise

Kind: static method of user
Summary: Delete a user
Access: public
Fulfil: Undefined

Param Type Description
userName String user name
authType String authentication type

Example

agile.idm.user.delete('bob','agile-local').then(function() {
  console.log('user removed!');
});

user.resetPassword(userName, authType, newPassword) ⇒ Promise

Kind: static method of user
Summary: Reset password for any user. The user executing this action needs to be allowed to do this, e.g. admin.
Access: public
Fulfil: Undefined

Param Type Description
userName String user name
authType String authentication type
newPassword String new password

Example

agile.idm.user.resetPassword('bob','agile-local',"myNewPassword").then(function() {
  console.log('password updated!');
});

user.updatePassword(oldPassword, newPassword) ⇒ Promise

Kind: static method of user
Summary: update password for himself
Access: public
Fulfil: Undefined

Param Type Description
oldPassword String old password
newPassword String new password

Example

agile.idm.user.updatePassword("myOldPassword","myNewPassword").then(function() {
  console.log('password updated!');
});

idm.entity : object

Kind: static namespace of idm

entity.getByType(entityType) ⇒ Promise

Kind: static method of entity
Summary: List all entities by type
Access: public
Fulfil: Array all entities with a given type

Param Type Description
entityType String type of entity

Example

agile.idm.entity.getByType('device').then(function(entities) {
  console.log(entities);
});

entity.getByAttributeValue(constraints) ⇒ Promise

Kind: static method of entity
Summary: List all entities which have a particular attribute value
Access: public
Fulfil: Array all entities with a given type

Param Type Description
constraints Array contains objects containing objects with the property 'attributeType' to specify the attribute type and with the property 'attributeValue' to specify the expected attribute value

Example

agile.idm.entity.getByAttributeValue([{attributeType:'credentials.dropbox','attributeValue':'expected attribute value for dropbox credentials'}]).then(function(entities) {
  console.log(entities);
});

entity.get(entityId, entityType) ⇒ Promise

Kind: static method of entity
Summary: get Entity by entity id and type
Access: public
Fulfil: Object entity entity

Param Type Description
entityId String id of entity
entityType String type of entity

Example

agile.idm.entity.get('1','device').then(function(result) {
  console.log('entity created!'+result);
});

entity.create(entityId, entityType, entity) ⇒ Promise

Kind: static method of entity
Summary: Create a group onwned by the authenticated user
Access: public
Fulfil: Object entity created

Param Type Description
entityId String id of entity
entityType String type of entity
entity object An object containing the entity

Example

agile.idm.entity.create('1','device',{'name':'entity name'}).then(function(result) {
  console.log('entity created!'+result);
});

entity.delete(entityId, entityType) ⇒ Promise

Kind: static method of entity
Summary: Delete entity
Access: public
Fulfil: Undefined

Param Type Description
entityId String id of entity
entityType String type of entity

Example

agile.idm.entity.delete('1','device').then(function() {
  console.log('group removed!');
});

entity.setAttribute(with) ⇒ Promise

Kind: static method of entity
Summary: Set Entity's attribute
Access: public
Fulfil: Object entity updated

Param Type Description
with Object entityId - id of entity, entityType - type of entity, attributeName- name of the attribute, attribute - An object or a String containing the entity's attribute value

Example

agile.idm.entity.setAttribute({
          entityId: '1',
          entityType: 'device',
          attributeType: 'credentials',
          attributeValue: {'dropbox':'entity credentials for drop'}
        }).then(function(result) {
  console.log('entity created!'+result);
});

entity.deleteAttribute(entityId, entityType, attributeName-) ⇒ Promise

Kind: static method of entity
Summary: Delete Entity's attribute
Access: public
Fulfil: Object entity updated entity

Param Type Description
entityId String id of entity
entityType String type of entity
attributeName- String name of the attribute

Example

agile.idm.entity.deleteAttribute('1','device','credentials').then(function(result) {
  console.log('entity updated!'+result);
});

entity.getEntitiesSchema() ⇒ Promise

Kind: static method of entity
Summary: Get Entities schema
Access: public
Fulfil: Object JSON Schema with the configuration for the entity format
Example

agile.idm.entity.getEntitiesSchema().then(function(jsonschema) {
  console.log('schema for the entities'+jsonschema);
});

idm.authentication : object

Kind: static namespace of idm

authentication.authenticateClient(client, secret) ⇒ Promise

Kind: static method of authentication
Summary: Authenticate a client with client secret and client name.
Access: public
Fulfil: Object Authentication information including token_type and access_token

Param Type Description
client String client name. This is the client name provided to the create Entity when you register an Oauth2 client in AGILE-IDM. For more info: https://github.com/Agile-IoT/agile-idm-oauth2-client-example
secret String client secret. This is the client name provided to the create Entity when you register an Oauth2 client in AGILE-IDM. For more info: https://github.com/Agile-IoT/agile-idm-oauth2-client-example

Example

agile.idm.authentication.authenticateClient('MyAgileClient2','WLnhhc3LnesbYj0GspNA13zgJEroN8V').then(function(result) {
  console.log(credentials.access_token);
  console.log(credentials.token_type);
});

agile.data : object

Kind: static namespace of agile

data.subscription : object

Kind: static namespace of data

subscription.create([subscription]) ⇒ Promise

Kind: static method of subscription
Summary: Create subscription for device component
Access: public
Fulfil: Object

Param Type Description
[subscription] Object New Subscription configuration

Example

agile.data.subscription.create({
 deviceID: 'myDevice',
 componentID: 'temperature',
 interval: 3000,
 retention: '7d'
})
.then(function(subscription) {
  console.log(subscription);
});

subscription.delete([subscriptionID]) ⇒ Promise

Kind: static method of subscription
Summary: Delete subscription for device component
Access: public
Fulfil: null

Param Type Description
[subscriptionID] String Agile data subscriptionID

Example

agile.data.subscription.delete('128484893938')
.then(function(subscription) {
  console.log('Subscription deleted!');
});

subscription.update([subscriptionID], [subscription]) ⇒ Promise

Kind: static method of subscription
Summary: Update subscription
Access: public
Fulfil: Object

Param Type Description
[subscriptionID] String Agile data subscriptionID
[subscription] Object Updated Subscription configuration

Example

agile.data.subscription.update('5991b583553d6897bd14f87d', {
   interval : 25000
 })
.then(function(subscription) {
  console.log(subscription);
});

subscription.get([query]) ⇒ Promise

Kind: static method of subscription
Summary: Get single or all subscriptions on gateway
Access: public
Fulfil: Object|Array

Param Type Description
[query] String Basic query that is transformed to influx sql

Example

agile.data.subscription.get('id=5991b583553d6897bd14f87d')
.then(function(subscription) {
  console.log(subscription);
});
agile.data.subscription.get()
.then(function(subscriptions) {
  console.log(subscriptions);
});

data.record : object

Kind: static namespace of data

record.get([query]) ⇒ Promise

Kind: static method of record
Summary: Get records from gateway
Access: public
Fulfil: Array

Param Type Description
[query] String Basic query that is transformed to influx sql

Example

agile.data.record.get()
.then(function(subscription) {
  console.log(subscription);
});

// you can use any valid mongo-querystring
// https://www.npmjs.com/package/mongo-querystring
const query = 'deviceID=mySensor'
agile.data.record.get(query)
.then(function(records) {
  console.log(records);
});

record.delete([query]) ⇒ Promise

Kind: static method of record
Summary: Delete records from gateway
Access: public
Fulfil: null

Param Type Description
[query] String Basic query that is transformed to influx sql

Example

agile.data.record.delete('deviceID="myDevice&componentID="temperature""')
.then(function() {
  console.log('Data deleted!');
});

data.settings : object

Kind: static namespace of data

settings.get() ⇒ Promise

Kind: static method of settings
Summary: Get settings for agile data
Access: public
Fulfil: Array
Example

agile.data.settings.get()
.then(function(settings) {
  console.log(settings);
});

settings.update(settings) ⇒ Promise

Kind: static method of settings
Summary: Update settings for agile data
Access: public
Fulfil: Array

Param Type Description
settings Object Updated settings values

Example

agile.data.settings.update({
 retention: '4d'
})
.then(function(newSettings) {
  console.log(newSettings);
});

agile.cloud : object

Kind: static namespace of agile

cloud.getCloudsInfo() ⇒ Promise

Kind: static method of cloud
Summary: Get the list of cloud related data from Agile Data
Access: public
Fulfil: Object - Description of supported cloud providers
Example

agile.cloud.getCloudsInfo().then(function(providers) {
 console.log(providers.clouds);
});

cloud.getCloudInfo(cloudName) ⇒ Promise

Kind: static method of cloud
Summary: Get the description of a supported cloud provider
Access: public
Fulfil: Object - Description of the cloud provider

Param Type Description
cloudName String The name of the cloud provider

Example

agile.cloud.getCloudInfo('owncloud').then(function(description) {
 console.log(description.cloudName);
 console.log(description.requiredFields);
});

cloud.exportDataToCloud(cloudName, dataQuery, customArgs) ⇒ Promise

Kind: static method of cloud
Summary: Export local data to a cloud
Access: public
Fulfil: null

Param Type Description
cloudName String The name of the cloud provider
dataQuery Object An object encoding a sql query
customArgs Object Cloud provider specific custom arguments

Example

const customArgs = {
  username: 'x',
  password: 'y',
  owncloudServer: 'z'
}

const query = {
  deviceID: 'dummy',
  componentID: 'y',
  between: '1523831000000 | 1523832000000'
}

agile.cloud.exportDataToCloud('owncloud', query, customArgs).then(function() {
  console.log('Data uploaded')
});

agile.policies : object

Kind: static namespace of agile

policies.pdp : object

Kind: static namespace of policies

pdp.evaluate(PDP) ⇒ Promise

Kind: static method of pdp
Summary: Evaluate policies for a particular entity and action or attribute
Access: public
Fulfil: Array boolean - each elemtn in the array is a boolean value mapeed one-to-one to the PDP requests objects. Each boolean shows whether the policy evaluated in the same potition of the array was allowed or not.

Param Type Description
PDP Array request - each element in the array includes entityId, entityType, field indicating the attribute or action to be executed. Finally the method can be read or write depending on the action to be performed. For instance the example shows the evaluation of a policy showing whether the user logged in can read the attribute password for the user with id sam!@!agile-local

Example

agile.policies.pdp.evaluate([{
     entityId : 'sam!@!agile-local',
     entityType: 'user',
     field : 'password',
     method : 'read'
   }]).then(function(results) {
 console.log(results);
});

policies.pap : object

Kind: static namespace of policies

pap.get(including) ⇒ Promise

Kind: static method of pap
Summary: Get policies for a particular entity and action or attribute
Access: public
Fulfil: Object Policy for the query, in case it is there

Param Type Description
including Object entityType, entityId, and field optionally. If provided, field represents the attribute or action for which the policy is being queried. The example shows how to obtain the (read and write) policy for the user with id sam!@!agile-local.

Example

agile.policies.pap.get({
     entityId : 'sam!@!agile-local',
     entityType: 'user',
     field : 'password'
   }).then(function(results) {
 console.log(results);
});

pap.set(including) ⇒ Promise

Kind: static method of pap
Summary: Set policies for a particular entity and action or attribute
Access: public
Fulfil: Object Policy for the entity resulting after the update

Param Type Description
including Object entityType, entityId, policy, and field optionally. If provided, field represents the attribute or action for which the policy is being queried. The example shows how to make the password of sam!@!agile-local readable and writable to anyone (do not do this in production!).

Example

agile.policies.pap.set({
     entityId : 'sam!@!agile-local',
     entityType: 'user',
     field : 'password',
     policy :  [
      {
         op: "write"
       },
       {
         op: "read"
       }
     ]
   }).then(function(results) {
 console.log(results);
});

pap.delete(including) ⇒ Promise

Kind: static method of pap
Summary: Delete policies for a particular entity and action or attribute
Access: public
Fulfil: Object Policy for the entity resulting after the update

Param Type Description
including Object entityType, entityId, and field optionally. If provided, field represents the attribute or action for which the policy is to be deleted. The example shows how to delete the (read and write) policy for the user with id sam!@!agile-local.

Example

agile.policies.pap.delete({
     entityId : 'sam!@!agile-local',
     entityType: 'user',
     field : 'password'
   }).then(function(results) {
 console.log(results);
});

agile.audit : object

Kind: static namespace of agile

audit.getUserActions() ⇒ Promise

Kind: static method of audit
Summary: Get actions performed by currently logged in user
Access: public
Fulfil: Array Actions actions performed by the user authenticated with the token used by the SDK. Each action has a user, entity and time field to show who executed where action when on which entity.
Example

agile.policies.audit.getUserActions( ).then(function(results) {
 console.log(results);
});

audit.getActionsOnUsersEntities() ⇒ Promise

Kind: static method of audit
Summary: Get actions performed on entities owned by the user currently logged in
Access: public
Fulfil: Array Actions actions performed by the user authenticated with the token used by the SDK. Each action has a user, entity and time field to show who executed where action when on which entity.
Example

agile.policies.audit.getActionsOnUsersEntities( ).then(function(results) {
 console.log(results);
});

audit.cleanActionsOnUsersEntities() ⇒ Promise

Kind: static method of audit
Summary: Removes actions performed on entities owned by the user currently logged in
Access: public
Example

agile.policies.audit.cleanActionsOnUsersEntities( ).then(function(results) {
 console.log(results);
});

agile.tokenSet(token) ⇒ String

Kind: static method of agile
Summary: Set/Update Idm Authentication token
Returns: String - token - Newly set Idm Authentication token
Access: public

Param Type Description
token String Idm Authentication token

Example

agile.tokenSet('1234');

agile.tokenGet() ⇒ String

Kind: static method of agile
Summary: Get Idm Authentication token
Access: public
Example

agile.tokenGet();

agile.tokenDelete() ⇒ String

Kind: static method of agile
Summary: Unset/delete Idm Authentication token
Access: public
Example

agile.tokenDelete();