Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
359 changes: 334 additions & 25 deletions libcloud/compute/drivers/digitalocean.py

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean/create_image.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"action": {
"id": 36805022,
"status": "in-progress",
"type": "snapshot",
"started_at": "2014-11-14T16:34:39Z",
"completed_at": null,
"resource_id": 3164450,
"resource_type": "droplet",
"region": "nyc3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ssh_key": {
"id": 7717,
"fingerprint": "f5:d1:78:ed:28:72:5f:e1:ac:94:fd:1f:e0:a3:48:6d",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQsxRiUKn example",
"name": "test1"
}
}
1 change: 1 addition & 0 deletions libcloud/test/compute/fixtures/digitalocean/error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"","message":"Unable to authenticate you."}
12 changes: 12 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean/ex_power_on_node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"action": {
"id": 36804758,
"status": "in-progress",
"type": "power_on",
"started_at": "2014-11-14T16:31:19Z",
"completed_at": null,
"resource_id": 3164450,
"resource_type": "droplet",
"region": "nyc3"
}
}
12 changes: 12 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean/ex_shutdown_node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"action": {
"id": 36077293,
"status": "in-progress",
"type": "shutdown",
"started_at": "2014-11-04T17:08:03Z",
"completed_at": null,
"resource_id": 3067649,
"resource_type": "droplet",
"region": "nyc2"
}
}
14 changes: 14 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean/get_image.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"image": {
"id": 12345,
"name": "My snapshot",
"distribution": "Ubuntu",
"slug": null,
"public": false,
"regions": [
"nyc2"
],
"created_at": "2014-11-04T22:23:02Z",
"min_disk_size": 20
}
}
13 changes: 13 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean/list_key_pairs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ssh_keys": [
{
"id": 7717,
"fingerprint": "f5:d1:78:ed:28:72:5f:e1:ac:94:fd:1f:e0:a3:48:6d",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDGk5 example",
"name": "test1"
}
],
"meta": {
"total": 1
}
}
95 changes: 95 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean/list_nodes_page_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"droplets": [
{
"id": 3164444,
"name": "example.com",
"memory": 512,
"vcpus": 1,
"disk": 20,
"locked": false,
"status": "active",
"kernel": {
"id": 2233,
"name": "Ubuntu 14.04 x64 vmlinuz-3.13.0-37-generic",
"version": "3.13.0-37-generic"
},
"created_at": "2014-11-14T16:29:21Z",
"features": [
"backups",
"ipv6",
"virtio"
],
"backup_ids": [
7938002
],
"snapshot_ids": [

],
"image": {
"id": 6918990,
"name": "14.04 x64",
"distribution": "Ubuntu",
"slug": "ubuntu-14-04-x64",
"public": true,
"regions": [
"nyc1",
"ams1",
"sfo1",
"nyc2",
"ams2",
"sgp1",
"lon1",
"nyc3",
"ams3",
"nyc3"
],
"created_at": "2014-10-17T20:24:33Z",
"min_disk_size": 20
},
"size_slug": "512mb",
"networks": {
"v4": [
{
"ip_address": "104.236.32.182",
"netmask": "255.255.192.0",
"gateway": "104.236.0.1",
"type": "public"
}
],
"v6": [
{
"ip_address": "2604:A880:0800:0010:0000:0000:02DD:4001",
"netmask": 64,
"gateway": "2604:A880:0800:0010:0000:0000:0000:0001",
"type": "public"
}
]
},
"region": {
"name": "New York 3",
"slug": "nyc3",
"sizes": [

],
"features": [
"virtio",
"private_networking",
"backups",
"ipv6",
"metadata"
],
"available": null
}
}
],
"links": {
"pages":
{
"last":"https://api.digitalocean.com/v2/droplets?page=2",
"next":"https://api.digitalocean.com/v2/droplets?page=2"
}
},
"meta": {
"total":2
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"droplets": [
{
"id": 3164445,
"name": "example1.com",
"memory": 512,
"vcpus": 1,
"disk": 20,
"locked": false,
"status": "active",
"kernel": {
"id": 2233,
"name": "Ubuntu 14.04 x64 vmlinuz-3.13.0-37-generic",
"version": "3.13.0-37-generic"
},
"created_at": "2014-11-14T16:29:21Z",
"features": [
"backups",
"ipv6",
"virtio"
],
"backup_ids": [
7938002
],
"snapshot_ids": [

],
"image": {
"id": 6918990,
"name": "14.04 x64",
"distribution": "Ubuntu",
"slug": "ubuntu-14-04-x64",
"public": true,
"regions": [
"nyc1",
"ams1",
"sfo1",
"nyc2",
"ams2",
"sgp1",
"lon1",
"nyc3",
"ams3",
"nyc3"
],
"created_at": "2014-10-17T20:24:33Z",
"min_disk_size": 20
},
"size_slug": "512mb",
"networks": {
"v4": [
{
"ip_address": "104.236.32.182",
"netmask": "255.255.192.0",
"gateway": "104.236.0.1",
"type": "public"
}
],
"v6": [
{
"ip_address": "2604:A880:0800:0010:0000:0000:02DD:4001",
"netmask": 64,
"gateway": "2604:A880:0800:0010:0000:0000:0000:0001",
"type": "public"
}
]
},
"region": {
"name": "New York 3",
"slug": "nyc3",
"sizes": [

],
"features": [
"virtio",
"private_networking",
"backups",
"ipv6",
"metadata"
],
"available": null
}
}
],
"links": {
"pages":
{
"first":"https://api.digitalocean.com/v2/droplets?page=1",
"prev":"https://api.digitalocean.com/v2/droplets?page=1"
}
},
"meta": {
"total":2
}
}
12 changes: 12 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean_v2/create_image.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"action": {
"id": 36805022,
"status": "in-progress",
"type": "snapshot",
"started_at": "2014-11-14T16:34:39Z",
"completed_at": null,
"resource_id": 3164450,
"resource_type": "droplet",
"region": "nyc3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ssh_key": {
"id": 7717,
"fingerprint": "f5:d1:78:ed:28:72:5f:e1:ac:94:fd:1f:e0:a3:48:6d",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQsxRiUKn example",
"name": "test1"
}
}
13 changes: 13 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean_v2/create_node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"action":
{
"id":39290099,
"status":"completed",
"type":"create",
"started_at":"2014-12-19T19:14:36Z",
"completed_at":"2014-12-19T19:15:23Z",
"resource_id":12345,
"resource_type":"droplet",
"region":"nyc3"
}
}
1 change: 1 addition & 0 deletions libcloud/test/compute/fixtures/digitalocean_v2/error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"","message":"Unable to authenticate you."}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"unprocessable_entity","message":"You specified an invalid image for Droplet creation."}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"action": {
"id": 36804758,
"status": "in-progress",
"type": "power_on",
"started_at": "2014-11-14T16:31:19Z",
"completed_at": null,
"resource_id": 3164450,
"resource_type": "droplet",
"region": "nyc3"
}
}
13 changes: 13 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean_v2/ex_rename_node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"action":
{
"id":918910,
"status":"in-progress",
"type":"rename",
"started_at":"2014-12-21T02:19:17Z",
"completed_at":null,
"resource_id":12345,
"resource_type":"droplet",
"region":"nyc3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"action": {
"id": 36077293,
"status": "in-progress",
"type": "shutdown",
"started_at": "2014-11-04T17:08:03Z",
"completed_at": null,
"resource_id": 3067649,
"resource_type": "droplet",
"region": "nyc2"
}
}
14 changes: 14 additions & 0 deletions libcloud/test/compute/fixtures/digitalocean_v2/get_image.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"image": {
"id": 12345,
"name": "My snapshot",
"distribution": "Ubuntu",
"slug": null,
"public": false,
"regions": [
"nyc2"
],
"created_at": "2014-11-04T22:23:02Z",
"min_disk_size": 20
}
}
Loading