cf-nodejs-client
Advanced tools
Comparing version 0.8.3 to 0.9.0
16
index.js
@@ -11,3 +11,3 @@ /*jslint node: true*/ | ||
*/ | ||
exports.version = '0.8.2'; | ||
exports.version = '0.9.0'; | ||
@@ -72,2 +72,9 @@ /** | ||
/** | ||
* Support for Organizations Quota | ||
* @type {[type]} | ||
*/ | ||
var OrganizationsQuota = require('./lib/model/OrganizationsQuota'); | ||
exports.OrganizationsQuota = OrganizationsQuota; | ||
/** | ||
* Support for Routes | ||
@@ -94,2 +101,9 @@ * @type {[type]} | ||
/** | ||
* Support for Spaces Quota | ||
* @type {[type]} | ||
*/ | ||
var SpacesQuota = require('./lib/model/SpacesQuota'); | ||
exports.SpacesQuota = SpacesQuota; | ||
/** | ||
* Support for Stacks | ||
@@ -96,0 +110,0 @@ * @type {[type]} |
/*jslint node: true*/ | ||
/*globals Promise:true*/ | ||
"use strict"; | ||
@@ -102,2 +101,26 @@ | ||
/** | ||
* http://apidocs.cloudfoundry.org/217/apps/updating_an_app.html | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} app_guid [description] | ||
* @param {[type]} appOptions [description] | ||
* @return {[type]} [description] | ||
*/ | ||
Apps.prototype.update = function (token_type, access_token, app_guid, appOptions) { | ||
var url = this.API_URL + "/v2/apps/" + app_guid; | ||
var options = { | ||
method: 'PUT', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + ' ' + access_token, | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
}, | ||
form : JSON.stringify(appOptions) | ||
}; | ||
return this.REST.request(options, "201", true); | ||
}; | ||
/** | ||
* http://apidocs.cloudfoundry.org/214/apps/updating_an_app.html | ||
@@ -368,2 +391,49 @@ * | ||
/** | ||
* http://apidocs.cloudfoundry.org/221/apps/list_all_service_bindings_for_the_app.html | ||
* | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} app_guid [description] | ||
* @param {[type]} filter [description] | ||
* @return {[type]} [description] | ||
*/ | ||
Apps.prototype.getServiceBindings = function (token_type, access_token, app_guid, filter) { | ||
var url = this.API_URL + "/v2/apps/" + app_guid + "/service_bindings"; | ||
var qs = { }; | ||
if (filter) { | ||
qs = filter; | ||
} | ||
var options = { | ||
method: 'GET', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + " " + access_token | ||
}, | ||
qs: qs | ||
}; | ||
return this.REST.request(options, "200", true); | ||
}; | ||
/** | ||
* http://apidocs.cloudfoundry.org/222/apps/get_the_env_for_an_app.html | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} app_guid [description] | ||
* @return {[type]} [description] | ||
*/ | ||
Apps.prototype.environmentVariables = function (token_type, access_token, app_guid) { | ||
var url = this.API_URL + "/v2/apps/" + app_guid + "/env"; | ||
var options = { | ||
method: 'GET', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + " " + access_token | ||
} | ||
}; | ||
return this.REST.request(options, "200", true); | ||
}; | ||
module.exports = Apps; |
@@ -8,2 +8,3 @@ /*jslint node: true */ | ||
this.buildpackMap['nodejs'] = "https://github.com/cloudfoundry/nodejs-buildpack"; | ||
this.buildpackMap['java'] = "https://github.com/cloudfoundry/java-buildpack"; | ||
} | ||
@@ -10,0 +11,0 @@ |
@@ -43,2 +43,44 @@ /*jslint node: true*/ | ||
/** | ||
* http://apidocs.cloudfoundry.org/222/organizations/retrieving_organization_memory_usage.html | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} org_guid [description] | ||
* @return {[type]} [description] | ||
*/ | ||
Organizations.prototype.memoryUsage = function (token_type, access_token, org_guid) { | ||
var url = this.API_URL + "/v2/organizations/" + org_guid + "/memory_usage"; | ||
var options = { | ||
method: 'GET', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + ' ' + access_token | ||
} | ||
}; | ||
return this.REST.request(options, "200", true); | ||
}; | ||
/** | ||
* http://apidocs.cloudfoundry.org/222/organizations/get_organization_summary.html | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} org_guid [description] | ||
* @return {[type]} [description] | ||
*/ | ||
Organizations.prototype.summary = function (token_type, access_token, org_guid) { | ||
var url = this.API_URL + "/v2/organizations/" + org_guid + "/summary"; | ||
var options = { | ||
method: 'GET', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + ' ' + access_token | ||
} | ||
}; | ||
return this.REST.request(options, "200", true); | ||
}; | ||
/** | ||
* http://apidocs.cloudfoundry.org/214/organizations/list_all_private_domains_for_the_organization.html | ||
@@ -45,0 +87,0 @@ * |
@@ -96,2 +96,43 @@ /*jslint node: true*/ | ||
/** | ||
* http://apidocs.cloudfoundry.org/222/spaces/get_space_summary.html | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} space_guid [description] | ||
* @param {[type]} filter [description] | ||
* @return {[type]} [description] | ||
*/ | ||
Spaces.prototype.summary = function (token_type, access_token, space_guid) { | ||
var url = this.API_URL + "/v2/spaces/" + space_guid + "/summary"; | ||
var options = { | ||
method: 'GET', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + ' ' + access_token | ||
} | ||
}; | ||
return this.REST.request(options, "200", true); | ||
}; | ||
/** | ||
* http://apidocs.cloudfoundry.org/222/spaces/retrieving_the_roles_of_all_users_in_the_space.html | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} space_guid [description] | ||
* @return {[type]} [description] | ||
*/ | ||
Spaces.prototype.userRoles = function (token_type, access_token, space_guid) { | ||
var url = this.API_URL + "/v2/spaces/" + space_guid + "/user_roles"; | ||
var options = { | ||
method: 'GET', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + ' ' + access_token | ||
} | ||
}; | ||
return this.REST.request(options, "200", true); | ||
}; | ||
module.exports = Spaces; |
/*jslint node: true*/ | ||
/*globals Promise:true*/ | ||
"use strict"; | ||
/* global -Promise */ | ||
@@ -8,2 +7,3 @@ var HttpUtils = require('../utils/HttpUtils'); | ||
function Stacks(_API_URL) { | ||
"use strict"; | ||
this.API_URL = _API_URL; | ||
@@ -15,6 +15,6 @@ this.REST = new HttpUtils(); | ||
* [setEndpoint description] | ||
* | ||
* @param {[type]} _API_URL [description] | ||
*/ | ||
Stacks.prototype.setEndPoint = function (_API_URL) { | ||
"use strict"; | ||
this.API_URL = _API_URL; | ||
@@ -25,3 +25,2 @@ }; | ||
* http://apidocs.cloudfoundry.org/214/stacks/list_all_stacks.html | ||
* | ||
* @param {[type]} token_type [description] | ||
@@ -32,3 +31,3 @@ * @param {[type]} access_token [description] | ||
Stacks.prototype.getStacks = function (token_type, access_token) { | ||
"use strict"; | ||
var url = this.API_URL + "/v2/stacks"; | ||
@@ -39,3 +38,3 @@ var options = { | ||
headers: { | ||
'Authorization': token_type + ' ' + access_token | ||
Authorization: token_type + ' ' + access_token | ||
} | ||
@@ -42,0 +41,0 @@ }; |
/*jslint node: true*/ | ||
/*globals Promise:true*/ | ||
/*globals Promise:true */ | ||
"use strict"; | ||
@@ -102,3 +102,2 @@ | ||
UserProvidedServices.prototype.delete = function (token_type, access_token, service_guid) { | ||
var url = this.API_URL + "/v2/user_provided_service_instances/" + service_guid; | ||
@@ -116,2 +115,33 @@ var options = { | ||
/** | ||
* http://apidocs.cloudfoundry.org/221/user_provided_service_instances/list_all_service_bindings_for_the_user_provided_service_instance.html | ||
* | ||
* var filter = { | ||
* q': 'app_guid:' + "65be2a2d-a643-4e01-b33d-8755d5934ae6" | ||
* }; | ||
* | ||
* @param {[type]} token_type [description] | ||
* @param {[type]} access_token [description] | ||
* @param {[type]} service_guid [description] | ||
* @param {[type]} filter [description] | ||
* @return {[type]} [description] | ||
*/ | ||
UserProvidedServices.prototype.getServiceBindings = function (token_type, access_token, service_guid, filter) { | ||
var url = this.API_URL + "/v2/user_provided_service_instances/" + service_guid + "/service_bindings"; | ||
var qs = {}; | ||
if (filter) { | ||
qs = filter; | ||
} | ||
var options = { | ||
method: 'GET', | ||
url: url, | ||
headers: { | ||
'Authorization': token_type + ' ' + access_token | ||
}, | ||
qs: qs | ||
}; | ||
return this.REST.request(options, "200", true); | ||
}; | ||
module.exports = UserProvidedServices; |
{ | ||
"name": "cf-nodejs-client", | ||
"version": "0.8.3", | ||
"version": "0.9.0", | ||
"description": "A Cloud Foundry Client for Node.js", | ||
@@ -14,5 +14,6 @@ "author": "Juan Antonio Breña Moral <bren@juanantonio.info>", | ||
"scripts": { | ||
"preversion": "mocha test", | ||
"preversion": "mocha test --config=LOCAL_INSTANCE_1", | ||
"start": "node index.js", | ||
"test": "mocha test" | ||
"test": "mocha test --config=LOCAL_INSTANCE_1 && mocha test --config=PIVOTAL && mocha test --config=BLUEMIX", | ||
"localTests": "mocha test --config=LOCAL_INSTANCE_1 && mocha test --config=PIVOTAL && mocha test --config=BLUEMIX" | ||
}, | ||
@@ -23,11 +24,11 @@ "keywords": [ | ||
"cloud-foundry", | ||
"cf", | ||
"vcap", | ||
"pivotal", | ||
"pivotalcf", | ||
"ibm", | ||
"bluemix", | ||
"cloud", | ||
"node", | ||
"API", | ||
"api", | ||
"REST", | ||
"cf", | ||
"cf client" | ||
@@ -43,14 +44,15 @@ ], | ||
"devDependencies": { | ||
"mocha": "2.3.3", | ||
"archiver": "0.16.0", | ||
"chai": "3.3.0", | ||
"chai-as-promised": "5.1.0", | ||
"istanbul": "0.4.0", | ||
"nconf": "0.8.2", | ||
"random-words": "0.0.1", | ||
"archiver": "0.16.0", | ||
"grunt": "0.4.5", | ||
"grunt-cli": "0.1.13", | ||
"grunt-connect": "0.2.0", | ||
"grunt-jsdoc": "1.0.0", | ||
"grunt-connect": "0.2.0", | ||
"grunt-open": "0.2.3" | ||
"grunt-open": "0.2.3", | ||
"istanbul": "0.4.0", | ||
"mocha": "2.3.3", | ||
"nconf": "0.8.2", | ||
"optimist": "0.6.1", | ||
"random-words": "0.0.1" | ||
}, | ||
@@ -57,0 +59,0 @@ "files": [ |
@@ -7,3 +7,4 @@ # cf-nodejs-client [![Build Status](https://travis-ci.org/prosociallearnEU/cf-nodejs-client.svg)](https://travis-ci.org/prosociallearnEU/cf-nodejs-client) [![Dependency Status](https://david-dm.org/prosociallearnEU/cf-nodejs-client.svg)](https://david-dm.org/prosociallearnEU/cf-nodejs-client) [![devDependency Status](https://david-dm.org/prosociallearnEU/cf-nodejs-client/dev-status.svg)](https://david-dm.org/prosociallearnEU/cf-nodejs-client#info=devDependencies) | ||
This project provides a simple client library to interact with the [Cloud Foundry REST API](http://apidocs.cloudfoundry.org/) using [Node.js](https://nodejs.org/). The client provides objects to retrieve information about the following concepts: | ||
This project provides a simple client library to interact with the [Cloud Foundry REST API](http://apidocs.cloudfoundry.org/) platform installed on [Pivotal](https://console.run.pivotal.io) | ||
, [IBM Bluemix](https://console.ng.bluemix.net/) or a [Local Cloud Foundry instance](https://github.com/yudai/cf_nise_installer) using [Node.js](https://nodejs.org/). The client provides objects to retrieve information about the following concepts: | ||
@@ -16,5 +17,7 @@ * Apps | ||
* Organizations | ||
* Organizations Quota | ||
* Routes | ||
* Service Bindings | ||
* Spaces | ||
* Spaces Quota | ||
* Stacks | ||
@@ -30,8 +33,8 @@ * User Provided Services | ||
* Create an App | ||
* Upload zip with source code | ||
* Upload source code in .zip or .war (Support for Static, Node.js & JEE) | ||
* Create an User Provided Services | ||
* Associate Apps with an User Provided Services | ||
* Start | Stop an App | ||
* Logs management | ||
* Scale Apps (Pending) | ||
* Scale Apps | ||
* Simple Logs management | ||
* Remove Apps | ||
@@ -52,5 +55,7 @@ * Remove User Provided Services | ||
Interacting with Pivotal or Bluemix: | ||
``` Javascript | ||
{ | ||
"endpoint" : "https://api.run.pivotal.io", | ||
"endpoint" : "https://api.run.pivotal.io", || "endpoint" : "https://api.eu-gb.bluemix.net", | ||
"username" : "xxx", | ||
@@ -96,2 +101,8 @@ "password" : "yyy" | ||
The development has been tested with: | ||
* [Commercial Pivotal PaaS platform](https://console.run.pivotal.io) | ||
* [Commercial IBM Bluemix PaaS platform](https://console.ng.bluemix.net/) | ||
* [Local Cloud Foundry instance](https://github.com/yudai/cf_nise_installer) | ||
**Test suite:** | ||
@@ -98,0 +109,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66191
21
1539
133
13