- Source:
Methods
(static) create(delegationopt, cb) → {object}
- Source:
Create resourceDelegation with limited access, e.g. for users who needs to stream a machine you created. The create method takes a delegation object as the only argument with resource name as key and an object with ids to list resource ids to give access to.
Examples
var delegation = {
machine: {
ids: ['m123abc', 'm456def']
}
};
paperspace.resourceDelegations.create(delegation, function(err, res) {
// handle error or result
});
$ paperspace resourceDelegations create
--machine '{ "ids": ["m123abc"] }'
--apiKey 1ba4f98e7c0...
# HTTP request:
https://api.paperspace.io
POST /resourceDelegations/create
x-api-key: 1ba4f98e7c0...
{
"machine": {
"ids": ["m123abc", "m456def"]
}
}
# Returns 200 on success
// Example return value:
[
{
"delegation": {
"machine": {
"ids": [
"m123abc",
"m456def"
]
}
},
"isEnabled": true,
"accessTokenId": "resource-delegation-token-123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc",
"dtCreated": "2019-04-03T12:31:40.061Z",
"id": 123
}
]
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
delegation |
object |
<optional> |
A delegation object to grant access to reources Properties
|
||||||||||||||||
cb |
function | Node-style error-first callback function |
Returns:
{ delegation: { machine: ['m123abc', 'm456def', ... ] }, accessToken: 'resource-delegation-token-123abc...', ... } - JSON object with provided delegation and newly generated resourceDelegation accessToken
- Type
- object