@osaas/client-core

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) deleteSecret(serviceId, secretName, ctx)

Description:
  • Delete a secret for a service in Open Source Cloud.

Parameters:
Name Type Description
serviceId string

The service identifier

secretName string

The secret name to delete

ctx Context

Open Source Cloud configuration context

(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) getInstanceScaling(context, serviceId, name, token) → {Object}

Description:
  • Get scaling information 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:
  • Scaling information with actualReplicas and desiredReplicas
Type
Object

(async, static) getInternalEndpoint(context, serviceId, name, token) → {InternalEndpointInfo}

Description:
  • Get internal endpoint information 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:
  • Internal endpoint info including serviceDns, ports, and publicAccess
Type
InternalEndpointInfo

(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) getSecret(serviceId, secretName, ctx) → {Promise.<({serviceId: string, secretName: string}|undefined)>}

Description:
  • Look up a single secret by name for a service in Open Source Cloud. Returns metadata only — secret values are write-only by design and are never returned by the API. Returns undefined if the secret does not exist.

    Note: implemented client-side via listSecrets + .find() because no single-secret GET endpoint exists on the backend.

Parameters:
Name Type Description
serviceId string

The service identifier

secretName string

The secret name to look up

ctx Context

Open Source Cloud configuration context

Returns:
  • Secret metadata or undefined
Type
Promise.<({serviceId: string, secretName: string}|undefined)>

(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) listSecrets(serviceId, ctx) → {Promise.<Array.<{serviceId: string, secretName: string}>>}

Description:
  • List all secrets for a service in Open Source Cloud. Returns metadata only — secret values are write-only by design and are never returned by the API.

Parameters:
Name Type Description
serviceId string

The service identifier

ctx Context

Open Source Cloud configuration context

Returns:
  • List of secret metadata
Type
Promise.<Array.<{serviceId: string, secretName: string}>>

(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) → {RemoveInstanceResult}

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');
const result = await removeInstance(ctx, 'eyevinn-test-adserver', 'my-instance', sat);
// result === 'success' | 'alreadyAbsent'
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:
  • 'success' if the instance was deleted, 'alreadyAbsent' if it did not exist
Type
RemoveInstanceResult

(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) scaleInstanceReplicas(context, serviceId, name, replicas, token)

Description:
  • Scale the number of replicas 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

replicas number

Desired number of replicas

token string

Service access token

(async, static) updateInstance(context, serviceId, name, token, body) → {Promise.<T>}

Description:
  • Update 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

body Record.<string, string>

Fields to update on the instance

Returns:
  • Updated instance
Type
Promise.<T>

(async, static) updateSecret(serviceId, secretName, value, ctx)

Description:
  • Update (upsert) a secret for a service in Open Source Cloud via PUT. Use saveSecret for initial creation (POST). updateSecret uses PUT and will overwrite an existing secret of the same name.

Parameters:
Name Type Description
serviceId string

The service identifier

secretName string

The secret name

value string

The secret value

ctx Context

Open Source Cloud configuration context

(async, static) waitForJobToComplete(context, serviceId, name, token, optionsopt) → {Promise.<any>}

Description:
  • Wait for a service job to complete

Parameters:
Name Type Attributes 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

options WaitForJobOptions <optional>

Optional settings

Properties
Name Type Attributes Description
timeoutMs number <optional>

Wall-clock timeout in milliseconds; throws if exceeded

Throws:
  • If the job reaches a terminal failure state ('Failed' or 'FailureTarget')

    Type
    Error
  • If timeoutMs is set and the job does not complete within the given time

    Terminal success statuses: 'Complete', 'SuccessCriteriaMet' Terminal failure statuses: 'Failed', 'FailureTarget'

    Type
    Error
Returns:
  • The completed job object
Type
Promise.<any>