@osaas/client-core
Advanced tools
Comparing version 0.5.0 to 0.5.1
import { Context, Service } from './context'; | ||
export declare function getService(context: Context, serviceId: string): Promise<Service>; | ||
/** | ||
* @typedef ServiceInstance | ||
* @type object | ||
* @property {string} name - Service instance name | ||
* @property {string} url - Service instance URL | ||
* @property ... - Service specific properties | ||
*/ | ||
/** | ||
* Create a new instance of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - Service identifier. The service identifier is {github-organization}-{github-repo} | ||
* @param {string} token - Service access token | ||
* @param {object} body - Service instance options. The options are service specific | ||
* @returns {ServiceInstance} - Service instance | ||
* @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); | ||
*/ | ||
export declare function createInstance(context: Context, serviceId: string, token: string, body: any): Promise<any>; | ||
/** | ||
* Remove an instance of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} name - The name of the service instance to remove | ||
* @param {string} token - Service access token | ||
* @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); | ||
*/ | ||
export declare function removeInstance(context: Context, serviceId: string, name: string, token: string): Promise<void>; | ||
/** | ||
* Retrieve an instance of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} name - The name of the service instance to remove | ||
* @param {string} token - Service access token | ||
* @returns {ServiceInstance} - Service instance | ||
*/ | ||
export declare function getInstance(context: Context, serviceId: string, name: string, token: string): Promise<any>; | ||
/** | ||
* List all instances of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} token - Service access token | ||
* @returns {Array.<ServiceInstance>} - List of instances | ||
*/ | ||
export declare function listInstances(context: Context, serviceId: string, token: string): Promise<any>; | ||
//# sourceMappingURL=core.d.ts.map |
@@ -22,2 +22,24 @@ "use strict"; | ||
exports.getService = getService; | ||
/** | ||
* @typedef ServiceInstance | ||
* @type object | ||
* @property {string} name - Service instance name | ||
* @property {string} url - Service instance URL | ||
* @property ... - Service specific properties | ||
*/ | ||
/** | ||
* Create a new instance of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - Service identifier. The service identifier is {github-organization}-{github-repo} | ||
* @param {string} token - Service access token | ||
* @param {object} body - Service instance options. The options are service specific | ||
* @returns {ServiceInstance} - Service instance | ||
* @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); | ||
*/ | ||
async function createInstance(context, serviceId, token, body) { | ||
@@ -37,2 +59,14 @@ const service = await getService(context, serviceId); | ||
exports.createInstance = createInstance; | ||
/** | ||
* Remove an instance of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} name - The name of the service instance to remove | ||
* @param {string} token - Service access token | ||
* @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); | ||
*/ | ||
async function removeInstance(context, serviceId, name, token) { | ||
@@ -50,2 +84,10 @@ const service = await getService(context, serviceId); | ||
exports.removeInstance = removeInstance; | ||
/** | ||
* Retrieve an instance of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} name - The name of the service instance to remove | ||
* @param {string} token - Service access token | ||
* @returns {ServiceInstance} - Service instance | ||
*/ | ||
async function getInstance(context, serviceId, name, token) { | ||
@@ -70,2 +112,9 @@ const service = await getService(context, serviceId); | ||
exports.getInstance = getInstance; | ||
/** | ||
* List all instances of a service in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} token - Service access token | ||
* @returns {Array.<ServiceInstance>} - List of instances | ||
*/ | ||
async function listInstances(context, serviceId, token) { | ||
@@ -72,0 +121,0 @@ const service = await getService(context, serviceId); |
import { Context } from './context'; | ||
/** | ||
* @typedef ServiceJob | ||
* @type object | ||
* @property {string} name - Service job name | ||
* @property ... - Service specific job properties | ||
*/ | ||
/** | ||
* Create a new service job in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - Service identifier. The service identifier is {github-organization}-{github-repo} | ||
* @param {string} token - Service access token | ||
* @param {object} body - Service job options. The options are service specific | ||
* @returns {ServiceJob} - Service job. The job is specific to the service | ||
* @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/' | ||
* } | ||
* ); | ||
*/ | ||
export declare function createJob(context: Context, serviceId: string, token: string, body: any): Promise<any>; | ||
@@ -3,0 +33,0 @@ export declare function removeJob(context: Context, serviceId: string, name: string, token: string): Promise<void>; |
@@ -7,2 +7,32 @@ "use strict"; | ||
const delay = (ms) => new Promise((res) => setTimeout(res, ms)); | ||
/** | ||
* @typedef ServiceJob | ||
* @type object | ||
* @property {string} name - Service job name | ||
* @property ... - Service specific job properties | ||
*/ | ||
/** | ||
* Create a new service job in Open Source Cloud | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - Service identifier. The service identifier is {github-organization}-{github-repo} | ||
* @param {string} token - Service access token | ||
* @param {object} body - Service job options. The options are service specific | ||
* @returns {ServiceJob} - Service job. The job is specific to the service | ||
* @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/' | ||
* } | ||
* ); | ||
*/ | ||
async function createJob(context, serviceId, token, body) { | ||
@@ -9,0 +39,0 @@ const service = await (0, core_1.getService)(context, serviceId); |
{ | ||
"name": "@osaas/client-core", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Open Source Cloud Client SDK core library", | ||
@@ -34,3 +34,3 @@ "author": "Eyevinn Technology <work@eyevinn.se>", | ||
}, | ||
"gitHead": "d6ac76ccd8ee1463c3484a67757271131b3ac5f2" | ||
"gitHead": "1cd9bcf9e53033687345cbffa58d61853ade3a1f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
40315
578