
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
push2cloud-cf-adapter
Advanced tools
This repository is part of the push2cloud project. For contribution guidelines, issues, and general documentation, visit the main push2cloud project page.
push2cloud-cf-adapter abstracts the cloud foundry api.
It's designed for use with Node.js and installable via npm install --save push2cloud-cf-adapter
.
const cf = require('push2cloud-cf-adapter');
const api = cf({
api: process.env.CF_API || 'https://api.lyra-836.appcloud.swisscom.com',
username: process.env.CF_USER,
password: process.env.CF_PWD,
org: process.env.CF_ORG,
space: process.env.CF_SPACE
});
// the callback way...
api.init((err, result) => {
api.pushApp({
name: 'temp-app',
appPath: join(__dirname, '/sampleApp')
}, (err, app) => {
api.stageApp({
appGuid: app.metadata.guid
// or: name: 'temp-app'
}, (err) => {
api.startAppAndWaitForInstances({
appGuid: app.metadata.guid
// or: name: 'temp-app'
}, (err) => {
// ...
});
});
});
});
// or the promise way...
api.init()
.then((app) => {
return api.stageApp({
appGuid: app.metadata.guid
// or: name: 'temp-app'
});
})
.then(() => {
return api.startAppAndWaitForInstances({
appGuid: app.metadata.guid
// or: name: 'temp-app'
});
})
.then(() => {
// ...
});
The source is available for download from GitHub. Alternatively, you can install using npm:
npm install --save push2cloud-cf-adapter
You can then require()
push2cloud-cf-adapter as normal:
const cf = require('push2cloud-cf-adapter');
Each asynchronous call can be done with classical callback style or with promise style.
Retrieves information of the current space. i.e. apps, services, service bindings, routes, domains, etc...
Arguments
none
Examples
const cf = require('push2cloud-cf-adapter');
const api = cf({
api: 'https://the-url-to-the-cloud-foundry-api-endpoint',
username: 'my-funny-username',
password: 'my-very-secret-password',
org: 'the-cf-org',
space: 'the-cf-space'
});
api.init((err, result) => {
console.log(result);
// {
// "apps": [
// {
// "name": "push2cloud-example-api-1.0.0",
// "unversionedName": "push2cloud-example-api",
// "guid": "cff85cc4-e217-47f0-b0e0-113d04e6e37d",
// "instances": 1,
// "memory": 512,
// "disk": 512,
// "state": "STARTED",
// "version": "1.0.0",
// "package_state": "STAGED"
// },
// {
// "name": "push2cloud-example-host-2.0.0",
// "unversionedName": "push2cloud-example-host",
// "guid": "9afc0b68-9004-4292-9284-6110bed72afb",
// "instances": 1,
// "memory": 512,
// "disk": 1024,
// "state": "STARTED",
// "version": "2.0.0",
// "package_state": "STAGED"
// }
// ],
// "serviceBindings": [
// {
// "service": "todo-db",
// "serviceInstanceGuid": "e0dc3f5e-7631-473e-ad3e-ebbf0549ad22",
// "app": "push2cloud-example-api-1.0.0",
// "unversionedName": "push2cloud-example-api",
// "appGuid": "cff85cc4-e217-47f0-b0e0-113d04e6e37d",
// "guid": "0d82e751-26ab-40b1-987a-8e1671b39c24"
// }
// ],
// "services": [
// {
// "name": "todo-db",
// "guid": "e0dc3f5e-7631-473e-ad3e-ebbf0549ad22",
// "type": "redis",
// "plan": "small"
// }
// ],
// "routes": [
// {
// "guid": "bd7cb2eb-f9fe-4b84-a7cd-1f43969e3ba9",
// "domain": "scapp.io",
// "domainGuid": "5f952bf2-618b-4584-b37e-92e406149285",
// "hostname": "push2cloud-example-host-iot-cf-test",
// "app": "push2cloud-example-host-2.0.0",
// "unversionedName": "push2cloud-example-host",
// "appGuid": "9afc0b68-9004-4292-9284-6110bed72afb"
// },
// {
// "guid": "47542223-1a74-45e9-8857-7baab1b29941",
// "domain": "scapp.io",
// "domainGuid": "5f952bf2-618b-4584-b37e-92e406149285",
// "hostname": "push2cloud-example-api-iot-cf-test",
// "app": "push2cloud-example-api-1.0.0",
// "unversionedName": "push2cloud-example-api",
// "appGuid": "cff85cc4-e217-47f0-b0e0-113d04e6e37d"
// }
// ],
// "envVars": [
// {
// "env": {
// "SYSTEM_VERSION": "1.0.0"
// },
// "name": "push2cloud-example-api-1.0.0",
// "unversionedName": "push2cloud-example-api"
// },
// {
// "env": {
// "SYSTEM_VERSION": "1.0.0",
// "PUSH2CLOUD_EXAMPLE_API_HOST": "https://push2cloud-example-api-iot-cf-test.scapp.io"
// },
// "name": "push2cloud-example-host-2.0.0",
// "unversionedName": "push2cloud-example-host"
// }
// ],
// "domains": [
// {
// "guid": "5f952bf2-618b-4584-b37e-92e406149285",
// "name": "scapp.io"
// },
// {
// "guid": "dc478cd0-5185-4a48-a964-1e53d868daf2",
// "name": "applicationcloud.io"
// }
// ]
// }
});
Retrieves information of the cloud foundry platform.
Arguments
none
Example
api.getInfo((err, result) => {
console.log(result);
// {
// "name": "",
// "build": "",
// "support": "https://developer.swisscom.com/contact",
// "version": 0,
// "description": "Cloud Foundry provided by Swisscom",
// "authorization_endpoint": "https://login.lyra-836.appcloud.swisscom.com",
// "token_endpoint": "https://uaa.lyra-836.appcloud.swisscom.com",
// "min_cli_version": null,
// "min_recommended_cli_version": null,
// "api_version": "2.52.0",
// "app_ssh_endpoint": "ssh.lyra-836.appcloud.swisscom.com:2222",
// "app_ssh_host_key_fingerprint": "6d:d2:8c:09:64:b6:fc:2b:50:3c:a9:cb:2e:be:d4:a7",
// "app_ssh_oauth_client": "ssh-proxy",
// "logging_endpoint": "wss://loggregator.lyra-836.appcloud.swisscom.com:443",
// "doppler_logging_endpoint": "wss://doppler.lyra-836.appcloud.swisscom.com:443"
// }
});
FAQs
abstracts cloud foundry api
The npm package push2cloud-cf-adapter receives a total of 14 weekly downloads. As such, push2cloud-cf-adapter popularity was classified as not popular.
We found that push2cloud-cf-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.