- AdobeState
Cloud State Management
- validate(schema, data) ⇒
object
Validates json according to a schema.
- init([config]) ⇒
Promise.<AdobeState>
Initializes and returns the key-value-store SDK.
To use the SDK you must either provide your OpenWhisk credentials in
config.ow
or your ownOpenWhisk credentials can also be read from environment variables
__OW_NAMESPACE
and__OW_API_KEY
.
- AdobeStateCredentials :
object
AdobeStateCredentials
- AdobeStatePutOptions :
object
AdobeState put options
- AdobeStateGetReturnValue :
object
AdobeState get return object
- OpenWhiskCredentials :
object
An object holding the OpenWhisk credentials
- AdobeStateLibError :
object
- AdobeStateLibErrors :
object
Adobe State lib custom errors.
e.sdkDetails
provides additional context for each error (e.g. function parameter)
Cloud State Management
Kind: global abstract class
- AdobeState
- .get(key) ⇒
Promise.<AdobeStateGetReturnValue>
- .put(key, value, [options]) ⇒
Promise.<string>
- .delete(key) ⇒
Promise.<string>
- .deleteAll() ⇒
Promise.<boolean>
- .any() ⇒
Promise.<boolean>
- .stats() ⇒
Promise.<boolean>
- .get(key) ⇒
adobeState.get(key) ⇒ Promise.<AdobeStateGetReturnValue>
Retrieves the state value for given key. If the key doesn't exist returns undefined.
Kind: instance method of AdobeState
Returns: Promise.<AdobeStateGetReturnValue>
- get response holding value and additional info
Param | Type | Description |
---|---|---|
key | string |
state key identifier |
Creates or updates a state key-value pair
Kind: instance method of AdobeState
Returns: Promise.<string>
- key
Param | Type | Description |
---|---|---|
key | string |
state key identifier |
value | string |
state value |
[options] | AdobeStatePutOptions |
put options |
Deletes a state key-value pair
Kind: instance method of AdobeState
Returns: Promise.<string>
- key of deleted state or null
if state does not exists
Param | Type | Description |
---|---|---|
key | string |
state key identifier |
Deletes all key-values
Kind: instance method of AdobeState
Returns: Promise.<boolean>
- true if deleted, false if not
There exists key-values.
Kind: instance method of AdobeState
Returns: Promise.<boolean>
- true if exists, false if not
Get stats.
Kind: instance method of AdobeState
Returns: Promise.<boolean>
- true if exists, false if not
Validates json according to a schema.
Kind: global function
Returns: object
- the result
Param | Type | Description |
---|---|---|
schema | object |
the AJV schema |
data | object |
the json data to test |
init([config]) ⇒ Promise.<AdobeState>
Initializes and returns the key-value-store SDK.
To use the SDK you must either provide your
OpenWhisk credentials in
config.ow
or your own
OpenWhisk credentials can also be read from environment variables __OW_NAMESPACE
and __OW_API_KEY
.
Kind: global function
Returns: Promise.<AdobeState>
- An AdobeState instance
Param | Type | Description |
---|---|---|
[config] | object |
used to init the sdk |
[config.ow] | OpenWhiskCredentials |
OpenWhiskCredentials. Set those if you want to use ootb credentials to access the state management service. OpenWhisk namespace and auth can also be passed through environment variables: __OW_NAMESPACE and __OW_API_KEY |
AdobeStateCredentials
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
namespace | string |
the state store namespace |
apikey | string |
the state store api key |
region | 'amer' | 'apac' | 'emea' |
the region for the Adobe State Store. defaults to 'amer' |
AdobeState put options
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
ttl | number |
time-to-live for key-value pair in seconds, defaults to 24 hours (86400s). Set to < 0 for max ttl of one year. A value of 0 sets default. |
AdobeState get return object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
expiration | string |
the ISO-8601 date string of the expiration time for the key-value pair |
value | string |
the value set by put |
An object holding the OpenWhisk credentials
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
namespace | string |
user namespace |
auth | string |
auth key |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
message | string |
The message for the Error |
code | string |
The code for the Error |
sdk | string |
The SDK associated with the Error |
sdkDetails | object |
The SDK details associated with the Error |
Adobe State lib custom errors.
e.sdkDetails
provides additional context for each error (e.g. function parameter)
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
ERROR_BAD_ARGUMENT | AdobeStateLibError |
this error is thrown when an argument is missing, has invalid type, or includes invalid characters. |
ERROR_BAD_REQUEST | AdobeStateLibError |
this error is thrown when an argument has an illegal value. |
ERROR_PAYLOAD_TOO_LARGE | AdobeStateLibError |
this error is thrown when the state key, state value or underlying request payload size exceeds the specified limitations. |
ERROR_BAD_CREDENTIALS | AdobeStateLibError |
this error is thrown when the supplied init credentials are invalid. |
ERROR_UNAUTHORIZED | AdobeStateLibError |
this error is thrown when the credentials are unauthorized to access the resource |
ERROR_INTERNAL | AdobeStateLibError |
this error is thrown when an unknown error is thrown by the underlying DB provider or TVM server for credential exchange. More details can be found in e.sdkDetails._internal . |
ERROR_REQUEST_RATE_TOO_HIGH | AdobeStateLibError |
this error is thrown when the request rate for accessing state is too high. |