@osaas/client-core
Advanced tools
Comparing version 0.6.0 to 0.7.0
import { Context, Service } from './context'; | ||
export declare function getService(context: Context, serviceId: string): Promise<Service>; | ||
export type Port = { | ||
externalIp: string; | ||
externalPort: number; | ||
internalPort: number; | ||
}; | ||
/** | ||
@@ -60,2 +65,12 @@ * @typedef ServiceInstance | ||
export declare function listInstances(context: Context, serviceId: string, token: string): Promise<any>; | ||
/** | ||
* List all extra TCP ports routed to an instance in Open Source Cloud | ||
* @memberof module:@osaas/client-core | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} name - The name of the service instance | ||
* @param {string} token - Service access token | ||
* @returns {Array.<Port>} - List of ports | ||
*/ | ||
export declare function getPortsForInstance(context: Context, serviceId: string, name: string, token: string): Promise<Port[]>; | ||
//# sourceMappingURL=core.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = exports.getService = void 0; | ||
exports.getPortsForInstance = exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = exports.getService = void 0; | ||
const fetch_1 = require("./fetch"); | ||
@@ -132,2 +132,24 @@ const log_1 = require("./log"); | ||
exports.listInstances = listInstances; | ||
/** | ||
* List all extra TCP ports routed to an instance in Open Source Cloud | ||
* @memberof module:@osaas/client-core | ||
* @param {Context} context - Open Source Cloud configuration context | ||
* @param {string} serviceId - The service identifier | ||
* @param {string} name - The name of the service instance | ||
* @param {string} token - Service access token | ||
* @returns {Array.<Port>} - List of ports | ||
*/ | ||
async function getPortsForInstance(context, serviceId, name, token) { | ||
const service = await getService(context, serviceId); | ||
const instanceUrl = new URL(service.apiUrl); | ||
const portsUrl = new URL('https://' + instanceUrl.host + '/ports/' + name); | ||
return await (0, fetch_1.createFetch)(portsUrl, { | ||
method: 'GET', | ||
headers: { | ||
'x-jwt': `Bearer ${token}`, | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
} | ||
exports.getPortsForInstance = getPortsForInstance; | ||
//# sourceMappingURL=core.js.map |
@@ -5,4 +5,4 @@ /** @module @osaas/client-core */ | ||
export { Context } from './context'; | ||
export { createInstance, removeInstance, getInstance, listInstances } from './core'; | ||
export { createInstance, removeInstance, getInstance, listInstances, getPortsForInstance } from './core'; | ||
export { createJob, removeJob, getJob, listJobs, waitForJobToComplete } from './job'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.waitForJobToComplete = exports.listJobs = exports.getJob = exports.removeJob = exports.createJob = exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = exports.Context = exports.createFetch = exports.Log = void 0; | ||
exports.waitForJobToComplete = exports.listJobs = exports.getJob = exports.removeJob = exports.createJob = exports.getPortsForInstance = exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = exports.Context = exports.createFetch = exports.Log = void 0; | ||
/** @module @osaas/client-core */ | ||
@@ -16,2 +16,3 @@ var log_1 = require("./log"); | ||
Object.defineProperty(exports, "listInstances", { enumerable: true, get: function () { return core_1.listInstances; } }); | ||
Object.defineProperty(exports, "getPortsForInstance", { enumerable: true, get: function () { return core_1.getPortsForInstance; } }); | ||
var job_1 = require("./job"); | ||
@@ -18,0 +19,0 @@ Object.defineProperty(exports, "createJob", { enumerable: true, get: function () { return job_1.createJob; } }); |
{ | ||
"name": "@osaas/client-core", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Open Source Cloud Client SDK core library", | ||
@@ -34,3 +34,3 @@ "author": "Eyevinn Technology <work@eyevinn.se>", | ||
}, | ||
"gitHead": "0d54f545a51a26df68290fc3a3bcfce2ce2851aa" | ||
"gitHead": "c0a201146ca9996b48b5b436a4bee414c2401dcb" | ||
} |
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
46344
691