Class: EnterpriseClient

iotcs.enterprise.EnterpriseClient(appid, taStoreFileopt, taStorePasswordopt)

EnterpriseClient is a enterprise application which is a client of the Oracle IoT Cloud Service.

This function is meant to be used for constructing EnterpriseClient objects only when the actual ID of the application associated with the object is known. An actual validation of the application ID with the cloud is not made at construction and if the application ID is incorrect, a NOT FOUND error from the cloud will be given when the object is actually used (e.g. when calling iotcs.enterprise.EnterpriseClient#getDevices).

If the actual application ID is not known is is better to use the iotcs.enterprise.EnterpriseClient#newClient method for creating EnterpriseClient objects, an asynchronous method that will first make a request at the cloud server for validation and then pass in the callback the validated object. This will ensure that no NOT FOUND error is given at first usage of the object.

Constructor

new EnterpriseClient(appid, taStoreFileopt, taStorePasswordopt)

Parameters:
Name Type Attributes Description
appid string The application identifier as it is in the cloud. This is the actual application ID generated by the server when creating a new application from the cloud UI. It is different than the integration ID or application mane.
taStoreFile string <optional>
The trusted assets store file path to be used for trusted assets manager creation. This is optional. If none is given the default global library parameter is used: iotcs.oracle.iot.tam.store. This is used only in the context of endpoint authentication.
taStorePassword string <optional>
The trusted assets store file password to be used for trusted assets manager creation. This is optional. If none is given, the default global library parameter is used: iotcs.oracle.iot.tam.storePassword. This is used only in the context of endpoint authentication.
See:

Extends

Methods

(static) close()

Closes the resources used by this Client. This will close all the virtual devices created and associated with this enterprise client.
See:
  • iotcs.AbstractVirtualDevice#close

(static) createStorageObject(arg1, arg2)

Create a new iotcs.enterprise.StorageObject.

The createStorageObject method works in two modes:

1. client.createStorageObject(name, type) - Creates a new
   iotcs.enterprise.StorageObject with the given object name and mime–type.

   Parameters:
      {string} name - The unique name to be used to reference the content in storage.
      {?string} [type] - The mime-type of the content. If type is null
                         or undefined, the mime–type defaults to
                         iotcs.StorageObject.MIME_TYPE.

   Returns:
      {iotcs.enterprise.StorageObject} A StorageObject.

2. client.createStorageObject(uri, callback) - Creates a new
   iotcs.enterprise.StorageObject from the URL for a named object in storage and
   returns it in a callback. Creates a new iotcs.ExternalObject if using an external
   URI.

   Parameters:
      {string} url - The URL of the object in the storage cloud.
      {function(storage, error)} callback - The callback called once getting storage data
                                            completes.
Parameters:
Name Type Description
arg1 string The first argument.
arg2 string | function The second argument.
See:

(static) createVirtualDevice(endpointId, deviceModel) → {iotcs.enterprise.VirtualDevice}

Create a VirtualDevice instance with the given device model for the given device identifier. This method creates a new VirtualDevice instance for the given parameters. The client library does not cache previously created VirtualDevice objects.

A device model can be obtained by it's afferent URN with the EnterpriseClient if it is registered on the cloud.

Parameters:
Name Type Description
endpointId string The endpoint identifier of the device being modeled.
deviceModel object The device model object holding the full description of that device model that this device implements.
See:
Returns:
The newly created virtual device
Type
iotcs.enterprise.VirtualDevice

(static) getActiveDevices(deviceModelUrn) → {iotcs.enterprise.Pageable}

Get the list of all active devices implementing the specified device model and application of the client.
Parameters:
Name Type Description
deviceModelUrn string The device model expected.
Returns:
A pageable instance with which pages can be requested that contain devices as items. A standard device item would have the "id" property that can be used as endpoint id for creating virtual devices.
Type
iotcs.enterprise.Pageable

(static) getApplication(callback)

Get the application information that this enterprise client is associated with.
Parameters:
Name Type Description
callback function The callback function. This function is called with the following argument: an appinfo object holding all data and metadata associated to that appid e.g. { id:"", name:"", description:"", metadata: { key1:"value1", key2:"value2", ... } }. If an error occurs or the response is invalid an error object is passed in callback as the second parameter with the reason in error.message: callback(response, error)

(static) getApplications() → {iotcs.enterprise.Pageable}

Get the all the applications that the user has access to.
Returns:
A pageable instance with which pages can be requested that contain application info objects as items
Type
iotcs.enterprise.Pageable

(static) getDeviceModels() → {iotcs.enterprise.Pageable}

Get the device models associated with the application of this enterprise client.
Returns:
A pageable instance with which pages can be requested that contain device models associated with the application as items. An item can be used to create VirtualDevices.
Type
iotcs.enterprise.Pageable

(static) getDevices(filter, fieldsopt) → {iotcs.enterprise.Pageable}

Return a list of Devices associated with the application of the client. The returned fields are limited to the fields defined in fields. Filters forms a query. Only endpoints that satisfy all the statements in filters are returned.
Parameters:
Name Type Attributes Description
filter iotcs.enterprise.Filter A filter as generated by the Filter class.
fields Array.<string> <optional>
Array of fields for the selected endpoint. Can be null.
Returns:
A pageable instance with which pages can be requested that contain devices as items
Type
iotcs.enterprise.Pageable

(static) newClient(appName, callback, taStoreFileopt, taStorePasswordopt)

Creates an enterprise client based on the application name.
Parameters:
Name Type Attributes Description
appName string The application name as it is on the cloud server.
callback function The callback function. This function is called with an object as parameter that is a created and initialized instance of an EnterpriseClient with the application endpoint id associated with the application name given as parameter. If the client creation fails the client object will be null and an error object is passed as the second parameter in the callback: callback(client, error) where the reason is in error.message.
taStoreFile string <optional>
The trusted assets store file path to be used for trusted assets manager creation. This is optional. If none is given the default global library parameter is used: iotcs.oracle.iot.tam.store. Also this is used only in the context of endpoint authentication.
taStorePassword string <optional>
The trusted assets store file password to be used for trusted assets manager creation. This is optional. If none is given the default global library parameter is used: iotcs.oracle.iot.tam.storePassword. Also this is used only in the context of endpoint authentication.
See:

Home