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

Commit 5027305

Browse files
committed
remove dev and staging data from samples and config
1 parent 84f50e7 commit 5027305

File tree

12 files changed

+125
-310
lines changed

12 files changed

+125
-310
lines changed

lib/config.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ module.exports = {
44
production: {
55
host: 'https://api.paperspace.io',
66
},
7-
staging: {
8-
host: 'https://staging-api.paperspace.io',
9-
},
10-
development: {
11-
host: 'https://dev-api.paperspace.io',
12-
},
13-
sdk: {
14-
host: 'https://sdk-api.paperspace.io',
15-
},
167
local: {
178
host: 'http://localhost:3102',
189
},

samples/sample_bash_script.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Note: this script requires the 'jq' tool for JSON parsing. See https://stedolan.github.io/jq/
4+
5+
# Substitute your apiKey here
6+
PAPERSPACE_API_KEY=1be4f97...
7+
8+
# List out all the templates
9+
echo "paperspace templates list"
10+
paperspace templates list
11+
12+
# Select the 6th template in the list using the 'jq' tool
13+
echo "selecting the 6th template id..."
14+
t_id=`paperspace templates list | jq -r '.[5].id'`
15+
16+
# Create the machine and parse out the new machine id
17+
echo "paperspace machines create ... --templateId $t_id"
18+
m_id=`paperspace machines create --machineName "Test Machine" --billingType "hourly" \
19+
--region "East Coast (NY2)" --size 50 --machineType "C1" --templateId "$t_id" | jq -r '.id'`
20+
21+
echo "paperspace machines waitfor --machineId $m_id --state ready"
22+
paperspace machines waitfor --machineId "$m_id" --state "ready"
23+
24+
echo "paperspace machines show --machineId $m_id"
25+
paperspace machines show --machineId "$m_id"
26+
27+
echo "paperspace machines stop --machineId $m_id"
28+
paperspace machines stop --machineId "$m_id"
29+
30+
echo "paperspace machines waitfor --machineId $m_id --state ready"
31+
paperspace machines waitfor --machineId "$m_id" --state "off"
32+
33+
echo "paperspace machines destroy --machineId $m_id"
34+
paperspace machines destroy --machineId "$m_id"

samples/sample_node_app.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Assumes you have installed the paperspace-sdk node package globally.
2+
// Use "require('../../paperspace-sdk')" if running from the repository tree.
3+
var paperspace_sdk = require('paperspace-sdk');
4+
5+
var paperspace = paperspace_sdk({
6+
apiKey: '1be4f97...' // Substitue your actual apiKey here
7+
});
8+
9+
console.log('paperspace tempates list');
10+
11+
paperspace.templates.list(
12+
function(err, resp) {
13+
if (err) {
14+
console.log(resp.body);
15+
process.exit(1);
16+
}
17+
console.log(resp.body);
18+
19+
var t_id = resp.body[5].id; // e.g., the 6th template was os type 'Ubuntu 16.04 Server'
20+
21+
console.log('paperspace machines create ... --templateId ' + t_id);
22+
23+
paperspace.machines.create({
24+
region: 'East Coast (NY2)',
25+
machineType: 'C1',
26+
size: 50,
27+
billingType: 'hourly',
28+
machineName: 'Test Machine',
29+
templateId: t_id,
30+
}, function(err, resp) {
31+
if (err) {
32+
console.log(err);
33+
process.exit(1);
34+
}
35+
console.log(resp.body);
36+
37+
var id = resp.body.id; // Extract the id of the newly created machine
38+
39+
console.log('paperspace machines waitfor --machineId ' + id + ' --state ready');
40+
41+
paperspace.machines.waitfor({
42+
machineId: id,
43+
state: "ready",
44+
}, function(err, resp) {
45+
if (err) {
46+
console.log(err);
47+
process.exit(1);
48+
}
49+
console.log(resp.body);
50+
51+
console.log('paperspace machines stop --machineId ' + id);
52+
53+
paperspace.machines.stop({
54+
machineId: id,
55+
}, function(err, resp) {
56+
if (err) {
57+
console.log(resp.body);
58+
process.exit(1);
59+
}
60+
console.log(resp.body);
61+
62+
console.log('paperspace machines waitfor --machineId ' + id + ' --state off');
63+
64+
paperspace.machines.waitfor({
65+
machineId: id,
66+
state: "off",
67+
}, function(err, resp) {
68+
if (err) {
69+
console.log(resp.body);
70+
process.exit(1);
71+
}
72+
console.log(resp.body);
73+
74+
console.log('paperspace machines destroy --machineId ' + id);
75+
76+
paperspace.machines.destroy({
77+
machineId: id,
78+
}, function(err, resp) {
79+
if (err) {
80+
console.log(resp.body);
81+
process.exit(1);
82+
}
83+
console.log(resp.body);
84+
85+
console.log('done');
86+
});
87+
});
88+
});
89+
});
90+
});
91+
});

samples/simple.js

Lines changed: 0 additions & 129 deletions
This file was deleted.

samples/testcli.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

samples/testcreate.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

samples/testdestroy.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

samples/testlist.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)