Methods
(async, static) createInstance(context, serviceId, token, body) → {ServiceInstance}
- Description:
Create a new instance of a service in Open Source Cloud
Example
import { Context, createInstance } from '@osaas/client-core';
const ctx = new Context();
const sat = await ctx.getServiceAccessToken('eyevinn-test-adserver');
const instance = await createInstance(ctx, 'eyevinn-test-adserver', sat, { name: 'my-instance' });
console.log(instance.url);
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | Service identifier. The service identifier is {github-organization}-{github-repo} |
token |
string | Service access token |
body |
object | Service instance options. The options are service specific |
Returns:
- Service instance
- Type
- ServiceInstance
(async, static) createJob(context, serviceId, token, body) → {ServiceJob}
- Description:
Create a new service job in Open Source Cloud
Example
import { Context, createJob } from '@osaas/client-core';
const serviceAccessToken = await ctx.getServiceAccessToken(
'eyevinn-docker-retransfer'
);
const job = await createJob(
ctx,
'eyevinn-docker-retransfer',
serviceAccessToken,
{
name: 'example',
awsAccessKeyId: process.env.AWS_ACCESS_KEY_ID,
awsSecretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
cmdLineArgs: 's3://source/myfile.txt s3://dest/'
}
);
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | Service identifier. The service identifier is {github-organization}-{github-repo} |
token |
string | Service access token |
body |
object | Service job options. The options are service specific |
Returns:
- Service job. The job is specific to the service
- Type
- ServiceJob
(async, static) getInstance(context, serviceId, name, token) → {ServiceInstance}
- Description:
Retrieve an instance of a service in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | The service identifier |
name |
string | The name of the service instance to remove |
token |
string | Service access token |
Returns:
- Service instance
- Type
- ServiceInstance
(async, static) getJob(context, serviceId, name, token)
- Description:
Get a service job in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | Service identifier. The service identifier is {github-organization}-{github-repo} |
name |
string | Name of service job to read |
token |
string | Service access token |
(async, static) getLogsForInstance(context, serviceId, name, token) → {string|Array.<string>}
- Description:
Get logs for an instance of a service in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | The service identifier |
name |
string | The name of the service instance |
token |
string | Service access token |
Returns:
- Log rows
- Type
- string | Array.<string>
(async, static) getPortsForInstance(context, serviceId, name, token) → {Array.<Port>}
- Description:
List all extra TCP ports routed to an instance in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | The service identifier |
name |
string | The name of the service instance |
token |
string | Service access token |
Returns:
- List of ports
- Type
- Array.<Port>
(async, static) listInstances(context, serviceId, token) → {Array.<ServiceInstance>}
- Description:
List all instances of a service in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | The service identifier |
token |
string | Service access token |
Returns:
- List of instances
- Type
- Array.<ServiceInstance>
(async, static) listJobs(context, serviceId, token)
- Description:
List service jobs in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | Service identifier. The service identifier is {github-organization}-{github-repo} |
token |
string | Service access token |
(async, static) listReservedNodes(context) → {Array.<ReservedNode>}
- Description:
List my reserved nodes
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
Returns:
- List of reserved nodes
- Type
- Array.<ReservedNode>
(async, static) listSubscriptions(context) → {Array.<Subscription>}
- Description:
List all my active subscriptions
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
Returns:
- List of active subscriptions
- Type
- Array.<Subscription>
(async, static) removeInstance(context, serviceId, name, token)
- Description:
Remove an instance of a service in Open Source Cloud
Example
import { Context, removeInstance } from '@osaas/client-core';
const ctx = new Context();
const sat = await ctx.getServiceAccessToken('eyevinn-test-adserver');
await removeInstance(ctx, 'eyevinn-test-adserver', 'my-instance', sat);
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | The service identifier |
name |
string | The name of the service instance to remove |
token |
string | Service access token |
(async, static) removeJob(context, serviceId, name, token)
- Description:
Remove a service job in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | Service identifier. The service identifier is {github-organization}-{github-repo} |
name |
string | Name of service job to remove |
token |
string | Service access token |
(async, static) removeSubscription(context, serviceId)
- Description:
Remove an active subscription
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | The service identifier |
(async, static) restartInstance(context, serviceId, name, token)
- Description:
Restart an instance of a service in Open Source Cloud
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | The service identifier |
name |
string | The name of the service instance |
token |
string | Service access token |
(async, static) waitForJobToComplete(context, serviceId, name, token)
- Description:
Wait for a service job to complete
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | Open Source Cloud configuration context |
serviceId |
string | Service identifier. The service identifier is {github-organization}-{github-repo} |
name |
string | Name of service job to wait for |
token |
string | Service access token |