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

Commit 1d3cbad

Browse files
colin-welchsanfilip
authored andcommitted
tweak: Add billingMonth parameter to machine utilization query. Update utilization docs.
1 parent bd5c364 commit 1d3cbad

File tree

3 files changed

+386
-5
lines changed

3 files changed

+386
-5
lines changed

docs/machines.html

Lines changed: 241 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<label for="nav-trigger" class="overlay"></label>
2323

2424
<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#.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#.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>
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#.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>
2626
</nav>
2727

2828
<div id="main">
@@ -3166,6 +3166,245 @@ <h6>Properties</h6>
31663166

31673167

31683168

3169+
3170+
<h4 class="name" id=".utilization"><span class="type-signature">(static) </span>utilization<span class="signature">(cb)</span><span class="type-signature"> &rarr; {object}</span></h4>
3171+
3172+
3173+
3174+
3175+
3176+
3177+
<dl class="details">
3178+
3179+
3180+
<dt class="tag-source">Source:</dt>
3181+
<dd class="tag-source"><ul class="dummy"><li>
3182+
<a href="machines_utilization.js.html">machines/utilization.js</a>, <a href="machines_utilization.js.html#line6">line 6</a>
3183+
</li></ul></dd>
3184+
3185+
3186+
3187+
3188+
3189+
3190+
3191+
3192+
3193+
3194+
3195+
3196+
3197+
3198+
3199+
3200+
3201+
3202+
3203+
3204+
3205+
3206+
3207+
3208+
3209+
3210+
3211+
3212+
3213+
3214+
3215+
</dl>
3216+
3217+
3218+
3219+
3220+
3221+
<div class="description">
3222+
<p>Show machine utilization data for the machine with the given id. Machine upgrades are not represented in utilization data.</p>
3223+
</div>
3224+
3225+
3226+
3227+
3228+
3229+
3230+
3231+
3232+
3233+
<h5>Examples</h5>
3234+
3235+
<pre class="prettyprint"><code>paperspace.machines.utilization({
3236+
machineId: 'ps123abc',
3237+
billingMonth: '2017-08',
3238+
}, function(err, resp) {
3239+
// handle error or http response
3240+
});</code></pre>
3241+
3242+
<pre class="prettyprint"><code>$ paperspace machines utilization \
3243+
--machineId "ps123abc" \
3244+
--billingMonth "2017-08"</code></pre>
3245+
3246+
<pre class="prettyprint"><code># HTTP request:
3247+
https://api.paperspace.io
3248+
GET /machines/getUtilization?machineId=ps123abc&amp;billingMonth=2017-08
3249+
x-api-key: 1ba4f98e7c0...
3250+
# Returns 200 on success</code></pre>
3251+
3252+
<pre class="prettyprint"><code>//Example return value:
3253+
{
3254+
"machineId": "ps123abc",
3255+
"secondsUsed": 1000,
3256+
"utilization": {
3257+
"machineId": "ps123abc",
3258+
"secondsUsed": 1000,
3259+
"hourlyRate": "0.40",
3260+
"billingMonth": "2017-08",
3261+
},
3262+
"storageUtilization": {
3263+
"machineId": "ps123abc",
3264+
"secondsUsed": 3000,
3265+
"hourlyRate": "7.00",
3266+
"billingMonth": "2017-08",
3267+
},
3268+
}</code></pre>
3269+
3270+
3271+
3272+
3273+
<h5>Parameters:</h5>
3274+
3275+
3276+
<table class="params">
3277+
<thead>
3278+
<tr>
3279+
3280+
<th>Name</th>
3281+
3282+
3283+
<th>Type</th>
3284+
3285+
3286+
3287+
3288+
3289+
<th class="last">Description</th>
3290+
</tr>
3291+
</thead>
3292+
3293+
<tbody>
3294+
3295+
3296+
<tr>
3297+
3298+
<td class="name"><code>params.machineId</code></td>
3299+
3300+
3301+
<td class="type">
3302+
3303+
3304+
<span class="param-type">string</span>
3305+
3306+
3307+
3308+
</td>
3309+
3310+
3311+
3312+
3313+
3314+
<td class="description last"><p>Id of the machine to show</p></td>
3315+
</tr>
3316+
3317+
3318+
3319+
<tr>
3320+
3321+
<td class="name"><code>params.billingMonth</code></td>
3322+
3323+
3324+
<td class="type">
3325+
3326+
3327+
<span class="param-type">string</span>
3328+
3329+
3330+
3331+
</td>
3332+
3333+
3334+
3335+
3336+
3337+
<td class="description last"><p>Billing period to query in <code>YYYY-MM</code> format</p></td>
3338+
</tr>
3339+
3340+
3341+
3342+
<tr>
3343+
3344+
<td class="name"><code>cb</code></td>
3345+
3346+
3347+
<td class="type">
3348+
3349+
3350+
<span class="param-type">function</span>
3351+
3352+
3353+
3354+
</td>
3355+
3356+
3357+
3358+
3359+
3360+
<td class="description last"><p>Node-style error-first callback function</p></td>
3361+
</tr>
3362+
3363+
3364+
</tbody>
3365+
</table>
3366+
3367+
3368+
3369+
3370+
3371+
3372+
3373+
3374+
3375+
3376+
3377+
3378+
3379+
3380+
<h5>Returns:</h5>
3381+
3382+
3383+
<div class="param-desc">
3384+
<p>machine - The utilization JSON object</p>
3385+
</div>
3386+
3387+
3388+
3389+
<dl class="param-type">
3390+
<dt>
3391+
Type
3392+
</dt>
3393+
<dd>
3394+
3395+
<span class="param-type">object</span>
3396+
3397+
3398+
</dd>
3399+
</dl>
3400+
3401+
3402+
3403+
3404+
3405+
3406+
3407+
31693408

31703409
<h4 class="name" id=".waitfor"><span class="type-signature">(static) </span>waitfor<span class="signature">(params, cb)</span><span class="type-signature"> &rarr; {object}</span></h4>
31713410

@@ -3484,7 +3723,7 @@ <h5>Returns:</h5>
34843723
<br class="clear">
34853724

34863725
<footer>
3487-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Jul 13 2017 22:32:57 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
3726+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Mon Aug 07 2017 17:19:51 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
34883727
</footer>
34893728

34903729
<script>prettyPrint();</script>

docs/machines_utilization.js.html

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>machines/utilization.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#.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/utilization.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 utilization
48+
* @description Show machine utilization data for the machine with the given id. Machine upgrades are not represented in utilization data.
49+
* @param {string} params.machineId - Id of the machine to show
50+
* @param {string} params.billingMonth - Billing period to query in `YYYY-MM` format
51+
* @param {function} cb - Node-style error-first callback function
52+
* @returns {object} machine - The utilization JSON object
53+
* @example
54+
* paperspace.machines.utilization({
55+
* machineId: 'ps123abc',
56+
* billingMonth: '2017-08',
57+
* }, function(err, resp) {
58+
* // handle error or http response
59+
* });
60+
* @example
61+
* $ paperspace machines utilization \
62+
* --machineId "ps123abc" \
63+
* --billingMonth "2017-08"
64+
* @example
65+
* # HTTP request:
66+
* https://api.paperspace.io
67+
* GET /machines/getUtilization?machineId=ps123abc&amp;billingMonth=2017-08
68+
* x-api-key: 1ba4f98e7c0...
69+
* # Returns 200 on success
70+
* @example
71+
* //Example return value:
72+
* {
73+
* "machineId": "ps123abc",
74+
* "secondsUsed": 1000,
75+
* "utilization": {
76+
* "machineId": "ps123abc",
77+
* "secondsUsed": 1000,
78+
* "hourlyRate": "0.40",
79+
* "billingMonth": "2017-08",
80+
* },
81+
* "storageUtilization": {
82+
* "machineId": "ps123abc",
83+
* "secondsUsed": 3000,
84+
* "hourlyRate": "7.00",
85+
* "billingMonth": "2017-08",
86+
* },
87+
* }
88+
*/
89+
90+
function utilization(params, cb) {
91+
return method(utilization, params, cb);
92+
}
93+
94+
assign(utilization, {
95+
auth: true,
96+
group: 'machines',
97+
name: 'utilization',
98+
method: 'get',
99+
route: '/machines/getUtilization',
100+
requires: {
101+
machineId: 'string',
102+
billingMonth: 'string',
103+
},
104+
returns: {},
105+
});
106+
107+
module.exports = utilization;
108+
</code></pre>
109+
</article>
110+
</section>
111+
112+
113+
114+
115+
</div>
116+
117+
<br class="clear">
118+
119+
<footer>
120+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Mon Aug 07 2017 17:19:51 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
121+
</footer>
122+
123+
<script>prettyPrint();</script>
124+
<script src="scripts/linenumber.js"></script>
125+
</body>
126+
</html>

0 commit comments

Comments
 (0)