Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit d81e5bd

Browse files
committed
add machines availability method; PS-5654
1 parent 40e2827 commit d81e5bd

File tree

3 files changed

+171
-0
lines changed

3 files changed

+171
-0
lines changed

docs/machines_availability.js.html

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>machines/availability.js - Documentation</title>
6+
7+
<script src="scripts/prettify/prettify.js"></script>
8+
<script src="scripts/prettify/lang-css.js"></script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
14+
</head>
15+
<body>
16+
17+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
18+
<label for="nav-trigger" class="navicon-button x">
19+
<div class="navicon"></div>
20+
</label>
21+
22+
<label for="nav-trigger" class="overlay"></label>
23+
24+
<nav>
25+
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="machines.html">machines</a><ul class='methods'><li data-type='method'><a href="machines.html#.availability">availability</a></li><li data-type='method'><a href="machines.html#.create">create</a></li><li data-type='method'><a href="machines.html#.destroy">destroy</a></li><li data-type='method'><a href="machines.html#.list">list</a></li><li data-type='method'><a href="machines.html#.restart">restart</a></li><li data-type='method'><a href="machines.html#.show">show</a></li><li data-type='method'><a href="machines.html#.start">start</a></li><li data-type='method'><a href="machines.html#.stop">stop</a></li><li data-type='method'><a href="machines.html#.utilization">utilization</a></li><li data-type='method'><a href="machines.html#.waitfor">waitfor</a></li></ul></li><li><a href="networks.html">networks</a><ul class='methods'><li data-type='method'><a href="networks.html#.list">list</a></li></ul></li><li><a href="scripts.html">scripts</a><ul class='methods'><li data-type='method'><a href="scripts.html#.create">create</a></li><li data-type='method'><a href="scripts.html#.destroy">destroy</a></li><li data-type='method'><a href="scripts.html#.list">list</a></li><li data-type='method'><a href="scripts.html#.show">show</a></li><li data-type='method'><a href="scripts.html#.text">text</a></li></ul></li><li><a href="templates.html">templates</a><ul class='methods'><li data-type='method'><a href="templates.html#.list">list</a></li></ul></li><li><a href="users.html">users</a><ul class='methods'><li data-type='method'><a href="users.html#.list">list</a></li></ul></li></ul>
26+
</nav>
27+
28+
<div id="main">
29+
30+
<h1 class="page-title">machines/availability.js</h1>
31+
32+
33+
34+
35+
36+
37+
38+
<section>
39+
<article>
40+
<pre class="prettyprint source linenums"><code>'use strict';
41+
42+
var method = require('./../method');
43+
var assign = require('lodash.assign');
44+
45+
/**
46+
* @memberof machines
47+
* @method availability
48+
* @description Get machine availability for the given region and machine type. Note: availability is only provided for the dedicated GPU machine types. Also, not all machine types are available in all regions.
49+
* @param {object} params - Machine utilization parameters
50+
* @param {string} params.region - Name of the region: either 'East Coast (NY2)', 'West Coast (CA1)', or 'Europe (AMS1)'
51+
* @param {string} params.machineType - Machine type: either 'GPU+', 'P4000', 'P5000', 'P6000', or 'V100'&lt;p>
52+
* @param {function} cb - Node-style error-first callback function
53+
* @returns {object} availability - The availability JSON object, containing a single boolean attribute, "available". A value of true for "available" means machines of that type can currently be requested in that region. A value of false means that requests for that machine type are not currently available in that region.
54+
* @example
55+
* paperspace.machines.availability({
56+
* region: 'East Coast (NY2)',
57+
* machineType: 'GPU+',
58+
* }, function(err, resp) {
59+
* // handle error or http response
60+
* });
61+
* @example
62+
* $ paperspace machines availability \
63+
* --region "East Coast (NY2)" \
64+
* --machineType "GPU+"
65+
* @example
66+
* # HTTP request:
67+
* https://api.paperspace.io
68+
* GET /machines/getAvailability?region=East%20Coast%20(NY2)&amp;machineType=GPU%2B
69+
* x-api-key: 1ba4f98e7c0...
70+
* # Returns 200 on success
71+
* @example
72+
* //Example return value:
73+
* {
74+
* "available": true
75+
* }
76+
*/
77+
78+
function availability(params, cb) {
79+
return method(availability, params, cb);
80+
}
81+
82+
assign(availability, {
83+
auth: true,
84+
group: 'machines',
85+
name: 'availability',
86+
method: 'get',
87+
route: '/machines/getAvailability',
88+
requires: {
89+
machineId: 'string',
90+
region: 'string',
91+
},
92+
returns: {},
93+
});
94+
95+
module.exports = availability;
96+
</code></pre>
97+
</article>
98+
</section>
99+
100+
101+
102+
103+
</div>
104+
105+
<br class="clear">
106+
107+
<footer>
108+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Nov 13 2017 19:26:21 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
109+
</footer>
110+
111+
<script>prettyPrint();</script>
112+
<script src="scripts/linenumber.js"></script>
113+
</body>
114+
</html>

lib/machines/availability.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use strict';
2+
3+
var method = require('./../method');
4+
var assign = require('lodash.assign');
5+
6+
/**
7+
* @memberof machines
8+
* @method availability
9+
* @description Get machine availability for the given region and machine type. Note: availability is only provided for the dedicated GPU machine types. Also, not all machine types are available in all regions.
10+
* @param {object} params - Machine utilization parameters
11+
* @param {string} params.region - Name of the region: either 'East Coast (NY2)', 'West Coast (CA1)', or 'Europe (AMS1)'
12+
* @param {string} params.machineType - Machine type: either 'GPU+', 'P4000', 'P5000', 'P6000', or 'V100'<p>
13+
* @param {function} cb - Node-style error-first callback function
14+
* @returns {object} availability - The availability JSON object, containing a single boolean attribute, "available". A value of true for "available" means machines of that type can currently be requested in that region. A value of false means that requests for that machine type are not currently available in that region.
15+
* @example
16+
* paperspace.machines.availability({
17+
* region: 'East Coast (NY2)',
18+
* machineType: 'GPU+',
19+
* }, function(err, resp) {
20+
* // handle error or http response
21+
* });
22+
* @example
23+
* $ paperspace machines availability \
24+
* --region "East Coast (NY2)" \
25+
* --machineType "GPU+"
26+
* @example
27+
* # HTTP request:
28+
* https://api.paperspace.io
29+
* GET /machines/getAvailability?region=East%20Coast%20(NY2)&machineType=GPU%2B
30+
* x-api-key: 1ba4f98e7c0...
31+
* # Returns 200 on success
32+
* @example
33+
* //Example return value:
34+
* {
35+
* "available": true
36+
* }
37+
*/
38+
39+
function availability(params, cb) {
40+
return method(availability, params, cb);
41+
}
42+
43+
assign(availability, {
44+
auth: true,
45+
group: 'machines',
46+
name: 'availability',
47+
method: 'get',
48+
route: '/machines/getAvailability',
49+
requires: {
50+
region: 'string',
51+
machineType: 'string',
52+
},
53+
returns: {},
54+
});
55+
56+
module.exports = availability;

lib/machines/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
module.exports = {
8+
availability: require('./availability'),
89
create: require('./create'),
910
destroy: require('./destroy'),
1011
list: require('./list'),

0 commit comments

Comments
 (0)