@@ -56,10 +56,14 @@ The following functions are exported:
56
56
* ` makeHMAC() ` to generate an SHA256 HMAC from a string and key
57
57
* ` buildRequest() ` to generate a request object to be sent to the ` apiCall() ` function
58
58
* ` apiCall() ` to send the actual request data to the Meta API
59
+
60
+ The following helper functions are exported:
61
+
59
62
* ` buildOVA() ` to build an OVA through the Meta API
60
63
* ` getStatus() ` to obtain the status of an OVA build
61
64
* ` pollStatus() ` to poll the status of an OVA build (every 5 seconds)
62
65
* ` getDownloads() ` to obtain the list of download files for an OVA build
66
+ * ` cancelBuild() ` to cancel a running OVA build
63
67
64
68
See the usage docs below.
65
69
@@ -151,7 +155,21 @@ meta.buildRequest apiParams, (error, result) =>
151
155
coffee> { Status : ' 200 OK' }
152
156
```
153
157
154
- #### Build an OVA (returns the builddate)
158
+ #### Change a NodeJS ` http.request() ` option (example: ` family ` (for IPv6))
159
+
160
+ ``` coffee
161
+ meta .options .agent = new https.Agent { family : 6 }
162
+ meta .buildRequest undefined , (error , result ) =>
163
+ unless error
164
+ meta .apiCall result, (err , res , data ) ->
165
+ console .log data
166
+ ```
167
+
168
+ ### Helper examples
169
+
170
+ The following helper functions are designed to simplify API calls and return simple string results
171
+
172
+ #### buildOVA() - Build an OVA (returns the builddate)
155
173
156
174
``` coffee
157
175
apiParams =
@@ -169,7 +187,7 @@ meta.buildOVA "/path/to/your/app.tcz", apiParams, (err, res) ->
169
187
coffee> 1574834281.966265128
170
188
```
171
189
172
- #### Poll the status of an OVA (returns the status)
190
+ #### pollStatus() - Poll the status of an OVA (returns the status)
173
191
174
192
``` coffee
175
193
meta .pollStatus ' 1574834281.966265128' , undefined , (err , res ) ->
@@ -182,7 +200,7 @@ meta.pollStatus '1574834281.966265128', undefined, (err, res) ->
182
200
coffee> success
183
201
```
184
202
185
- #### Get the list of download URLs
203
+ #### getDownloads() - Get the list of download URLs (returns a list of URLs)
186
204
187
205
``` coffee
188
206
meta .getDownloads ' 1574834281.966265128' , (err , res ) ->
@@ -195,14 +213,17 @@ meta.getDownloads '1574834281.966265128', (err, res) ->
195
213
coffee> https : // yourdomain .com : 443 / downloads/ build- 1574834281.966265128 / your- appliance- v1.2 .3 - release .ova
196
214
```
197
215
198
- #### Change a NodeJS ` http.request() ` option (example: ` family ` (for IPv6) )
216
+ #### cancelBuild() - Cancel an OVA build (returns OK )
199
217
200
218
``` coffee
201
- meta .options .agent = new https.Agent { family : 6 }
202
- meta .buildRequest undefined , (error , result ) =>
203
- unless error
204
- meta .apiCall result, (err , res , data ) ->
205
- console .log data
219
+ meta .cancelBuild ' 1574834281.966265128' , (err , res ) ->
220
+ if err
221
+ console .error err
222
+ process .exit 1
223
+ else
224
+ console .log res
225
+
226
+ coffee> OK
206
227
```
207
228
208
229
## JavaScript
@@ -284,7 +305,24 @@ meta.buildRequest(apiParams, (error, result) => {
284
305
});
285
306
```
286
307
287
- #### Build an OVA (returns the builddate)
308
+ #### Change a NodeJS ` http.request() ` option (example: ` family ` (for IPv6))
309
+
310
+ ``` js
311
+ meta .options .agent = new https.Agent ({ family: 6 });
312
+ meta .buildRequest (void 0 , (error , result ) => {
313
+ if (! error) {
314
+ return meta .apiCall (result, function (err , res , data ) {
315
+ return console .log (data);
316
+ });
317
+ }
318
+ });
319
+ ```
320
+
321
+ ### Helper examples
322
+
323
+ The following helper functions are designed to simplify API calls and return simple string results
324
+
325
+ #### buildOVA() - Build an OVA (returns the builddate)
288
326
289
327
``` js
290
328
apiParams = {
@@ -303,7 +341,7 @@ meta.buildOVA("/path/to/your/app.tcz", apiParams, function(err, res) {
303
341
});
304
342
```
305
343
306
- #### Poll the status of an OVA (returns the status object )
344
+ #### pollStatus() - Poll the status of an OVA (returns the status)
307
345
308
346
``` js
309
347
meta .pollStatus (' 1574834281.966265128' , void 0 , function (err , res ) {
@@ -316,7 +354,7 @@ meta.pollStatus('1574834281.966265128', void 0, function(err, res) {
316
354
});
317
355
```
318
356
319
- #### Get the list of download URLs
357
+ #### getDownloads() - Get the list of download URLs (returns a list of URLs)
320
358
321
359
``` js
322
360
meta .getDownloads (' 1574834281.966265128' , function (err , res ) {
@@ -329,17 +367,17 @@ meta.getDownloads('1574834281.966265128', function(err, res) {
329
367
});
330
368
```
331
369
332
- #### Change a NodeJS ` http.request() ` option (example: ` family ` (for IPv6) )
370
+ #### cancelBuild() - Cancel an OVA build (returns OK )
333
371
334
372
``` js
335
- meta .options . agent = new https.Agent ({ family : 6 });
336
- meta . buildRequest ( void 0 , ( error , result ) => {
337
- if ( ! error) {
338
- return meta . apiCall (result, function ( err , res , data ) {
339
- return console . log (data);
340
- } );
341
- }
342
- });
373
+ meta .cancelBuild ( ' 1574941961.314614280 ' , function ( err , res ) {
374
+ if (err) {
375
+ console . error (err);
376
+ return process . exit ( 1 );
377
+ } else {
378
+ return console . log (res );
379
+ }
380
+ });
343
381
```
344
382
345
383
# Testing
0 commit comments