1and1 1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,58 @@
1
+ [
2
+ {
3
+ "id": "148CE80B09ED769373921F31CEE85G2G",
4
+ "name": "Windows 64-bit Rescue-System",
5
+ "available_datacenters": [
6
+ "4EFAD5836CE43ACA502FD5B99BEE48GH",
7
+ "908DC2072407C94C8054610AD5A53C4D"
8
+ ],
9
+ "os": {
10
+ "name": "Other Windows",
11
+ "family": "Windows",
12
+ "subfamily": "WindowsDatacenter",
13
+ "architecture": 64
14
+ }
15
+ },
16
+ {
17
+ "id": "52670D91E8FB744FB8304B6D6EA1000F",
18
+ "name": "Linux 64-bit Rescue-System (debian/oldstable)",
19
+ "available_datacenters": [
20
+ "4EFAD5836CE43ACA502FD5B99BEE48GH",
21
+ "908DC2072407C94C8054610AD5A53C4D"
22
+ ],
23
+ "os": {
24
+ "name": "Other Linux",
25
+ "family": "Linux",
26
+ "subfamily": "OtherLinux",
27
+ "architecture": 64
28
+ }
29
+ },
30
+ {
31
+ "id": "B36BD02F7448CE912124ACF1718F5F34",
32
+ "name": "Linux 64-bit Rescue-System (debian/stable)",
33
+ "available_datacenters": [
34
+ "4EFAD5836CE43ACA502FD5B99BEE48GH",
35
+ "908DC2072407C94C8054610AD5A53C4D"
36
+ ],
37
+ "os": {
38
+ "name": "Other Linux",
39
+ "family": "Linux",
40
+ "subfamily": "OtherLinux",
41
+ "architecture": 64
42
+ }
43
+ },
44
+ {
45
+ "id": "5BD4A33F7464FFFD9A91AC52F173799B",
46
+ "name": "Linux 64-bit Rescue-System (debian/testing)",
47
+ "available_datacenters": [
48
+ "4EFAD5836CE43ACA502FD5B99BEE48GH",
49
+ "908DC2072407C94C8054610AD5A53C4D"
50
+ ],
51
+ "os": {
52
+ "name": "Other Linux",
53
+ "family": "Linux",
54
+ "subfamily": "OtherLinux",
55
+ "architecture": 64
56
+ }
57
+ }
58
+ ]
@@ -0,0 +1,28 @@
1
+ [
2
+ {
3
+ "id": "39AA65F5D5B02FA02D58173094EBAF95",
4
+ "name": "My SSH key 1",
5
+ "description": "My SSH key description",
6
+ "state": "ACTIVE",
7
+ "servers": [
8
+ {"id": "D0F6D8C8ED29D3036F94C27BBB789536","name": "Server 1"},
9
+ {"id": "E0F6D8C8ED29D3036F94C27BBB789537","name": "Server 2"}
10
+ ],
11
+ "md5": "5df9f63916ebf8528697b629022993e8",
12
+ "public_key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQAB",
13
+ "creation_date": "30-06-2015T 14:52:35+00.00"
14
+ },
15
+ {
16
+ "id": "39AA65F5D5B02FA02D58173094EBAF96",
17
+ "name": "My SSH key 2",
18
+ "description": "My SSH key description",
19
+ "state": "ACTIVE",
20
+ "servers": [
21
+ {"id": "D0F6D8C8ED29D3036F94C27BBB789536","name": "Server 1"},
22
+ {"id": "E0F6D8C8ED29D3036F94C27BBB789537","name": "Server 2"}
23
+ ],
24
+ "md5": "5df9f63916ebf8528697b629022993e3",
25
+ "public_key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQAC",
26
+ "creation_date": "31-08-2017T 14:52:35+00.00"
27
+ }
28
+ ]
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "6AD2F180B7B666539EF75A02FE227084",
3
+ "size": 200,
4
+ "state": "CONFIGURING",
5
+ "description": "My block storage description",
6
+ "datacenter": {
7
+ "id": "D0F6D8C8ED29D3036F94C27BBB7BAD36",
8
+ "location": "USA",
9
+ "country_code": "US"
10
+ },
11
+ "name": "New Name",
12
+ "creation_date": "2015-05-06T08:33:25+00:00",
13
+ "server":
14
+ {
15
+ "id": "638ED28205B1AFD7ADEF569C725DD85F",
16
+ "name": "My server 1"
17
+ }
18
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "39AA65F5D5B02FA02D58173094EBAF95",
3
+ "name": "New Name",
4
+ "description": "My SSH key description",
5
+ "state": "ACTIVE",
6
+ "servers": [
7
+ {"id": "D0F6D8C8ED29D3036F94C27BBB789536","name": "Server 1"},
8
+ {"id": "E0F6D8C8ED29D3036F94C27BBB789537","name": "Server 2"}
9
+ ],
10
+ "md5": "5df9f63916ebf8528697b629022993e8",
11
+ "public_key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQAB",
12
+ "creation_date": "30-06-2015T 14:52:35+00.00"
13
+ }
@@ -0,0 +1,167 @@
1
+ require_relative '../lib/oneandone'
2
+ require 'minitest/autorun'
3
+
4
+ class TestBlockStorage < Minitest::Test
5
+ def setup
6
+
7
+ OneAndOne.start('TEST-API-KEY')
8
+ @block_storage = OneAndOne::BlockStorage.new(test: true)
9
+
10
+ end
11
+
12
+
13
+ def test_list
14
+
15
+ # Read in mock JSON
16
+ file = File.read('mock-api/list-block-storages.json')
17
+ data = JSON.parse(file)
18
+
19
+ # Create stub and perform call
20
+ Excon.stub({:method => :get, :path => '/v1/block_storages'},
21
+ {:body => JSON.generate(data), :status => 200})
22
+
23
+ response = @block_storage.list
24
+
25
+ # Assertions
26
+ assert_equal response[0]['id'], data[0]['id']
27
+
28
+ # Clear out stubs
29
+ Excon.stubs.clear
30
+
31
+ end
32
+
33
+
34
+ def test_create
35
+
36
+ # Read in mock JSON
37
+ file = File.read('mock-api/create-block-storage.json')
38
+ data = JSON.parse(file)
39
+
40
+ # Create stub and perform call
41
+ Excon.stub({:method => :post, :path => '/v1/block_storages'},
42
+ {:body => JSON.generate(data), :status => 202})
43
+
44
+ response = @block_storage.create(name: data['name'],
45
+ description: data['description'],
46
+ size: data['size'],
47
+ datacenter_id: data['datacenter']['id']
48
+ )
49
+
50
+ # Assertions
51
+ assert_equal response['name'], data['name']
52
+ assert_equal response['description'], data['description']
53
+ assert_equal response['size'], data['size']
54
+ assert_equal response['datacenter']['id'], data['datacenter']['id']
55
+
56
+ # Clear out stubs
57
+ Excon.stubs.clear
58
+
59
+ end
60
+
61
+
62
+ def test_get
63
+
64
+ # Read in mock JSON
65
+ file = File.read('mock-api/get-block-storage.json')
66
+ data = JSON.parse(file)
67
+
68
+ # Create stub and perform call
69
+ Excon.stub({:method => :get, :path => "/v1/block_storages/#{data['id']}"},
70
+ {:body => JSON.generate(data), :status => 200})
71
+
72
+ response = @block_storage.get(block_storage_id: data['id'])
73
+
74
+ # Assertions
75
+ assert_equal response['id'], data['id']
76
+
77
+ # Clear out stubs
78
+ Excon.stubs.clear
79
+
80
+ end
81
+
82
+
83
+ def test_modify
84
+
85
+ # Read in mock JSON
86
+ file = File.read('mock-api/modify-block-storage.json')
87
+ data = JSON.parse(file)
88
+
89
+ # Create stub and perform call
90
+ Excon.stub({:method => :put, :path => "/v1/block_storages/#{data['id']}"},
91
+ {:body => JSON.generate(data), :status => 202})
92
+
93
+ response = @block_storage.modify(block_storage_id: data['id'], name: 'New Name')
94
+
95
+ # Assertions
96
+ assert_equal response['name'], data['name']
97
+
98
+ # Clear out stubs
99
+ Excon.stubs.clear
100
+
101
+ end
102
+
103
+
104
+ def test_delete
105
+
106
+ # Read in mock JSON
107
+ file = File.read('mock-api/delete-block-storage.json')
108
+ data = JSON.parse(file)
109
+
110
+ # Create stub and perform call
111
+ Excon.stub({:method => :delete, :path => "/v1/block_storages/#{data['id']}"},
112
+ {:body => JSON.generate(data), :status => 202})
113
+
114
+ response = @block_storage.delete(block_storage_id: data['id'])
115
+
116
+ # Assertions
117
+ assert_equal response['state'], 'REMOVING'
118
+
119
+ # Clear out stubs
120
+ Excon.stubs.clear
121
+
122
+ end
123
+
124
+
125
+ def test_attach_block_storage
126
+
127
+ # Read in mock JSON
128
+ file = File.read('mock-api/attach-block-storage.json')
129
+ data = JSON.parse(file)
130
+
131
+ # Create stub and perform call
132
+ Excon.stub({:method => :post, :path => "/v1/block_storages/#{data['id']}/server"},
133
+ {:body => JSON.generate(data), :status => 202})
134
+
135
+ response = @block_storage.attach_server(block_storage_id: "#{data['id']}")
136
+
137
+ # Assertions
138
+ assert_equal response['name'], data['name']
139
+
140
+ # Clear out stubs
141
+ Excon.stubs.clear
142
+
143
+ end
144
+
145
+
146
+ def test_detach_block_storage
147
+
148
+ # Read in mock JSON
149
+ file = File.read('mock-api/detach-block-storage.json')
150
+ data = JSON.parse(file)
151
+
152
+ # Create stub and perform call
153
+ Excon.stub({:method => :delete, :path => "/v1/block_storages/#{data['id']}/server"},
154
+ {:body => JSON.generate(data), :status => 200})
155
+
156
+ response = @block_storage.detach_server(block_storage_id: data['id'])
157
+
158
+ # Assertions
159
+ assert_equal response['state'], 'CONFIGURING'
160
+
161
+ # Clear out stubs
162
+ Excon.stubs.clear
163
+
164
+ end
165
+
166
+
167
+ end
@@ -0,0 +1,55 @@
1
+ require_relative '../lib/oneandone'
2
+ require 'minitest/autorun'
3
+
4
+ class TestServerAppliance < Minitest::Test
5
+ def setup
6
+
7
+ OneAndOne.start('TEST-API-KEY')
8
+ @appliance = OneAndOne::RecoveryAppliance.new(test: true)
9
+
10
+ end
11
+
12
+
13
+ def test_list
14
+
15
+ # Read in mock JSON
16
+ file = File.read('mock-api/list-recovery-appliances.json')
17
+ data = JSON.parse(file)
18
+
19
+ # Create stub and perform call
20
+ Excon.stub({:method => :get, :path => '/v1/recovery_appliances'},
21
+ {:body => JSON.generate(data), :status => 200})
22
+
23
+ response = @appliance.list
24
+
25
+ # Assertions
26
+ assert_equal response[0]['id'], data[0]['id']
27
+
28
+ # Clear out stubs
29
+ Excon.stubs.clear
30
+
31
+ end
32
+
33
+
34
+ def test_get
35
+
36
+ # Read in mock JSON
37
+ file = File.read('mock-api/get-recovery-appliance.json')
38
+ data = JSON.parse(file)
39
+
40
+ # Create stub and perform call
41
+ Excon.stub({:method => :get, :path => "/v1/recovery_appliances/#{data['id']}"},
42
+ {:body => JSON.generate(data), :status => 200})
43
+
44
+ response = @appliance.get(appliance_id: data['id'])
45
+
46
+ # Assertions
47
+ assert_equal response['id'], data['id']
48
+
49
+ # Clear out stubs
50
+ Excon.stubs.clear
51
+
52
+ end
53
+
54
+
55
+ end
@@ -0,0 +1,118 @@
1
+ require_relative '../lib/oneandone'
2
+ require 'minitest/autorun'
3
+
4
+ class TestSshKey < Minitest::Test
5
+ def setup
6
+
7
+ OneAndOne.start('TEST-API-KEY')
8
+ @ssh_key = OneAndOne::SshKey.new(test: true)
9
+
10
+ end
11
+
12
+
13
+ def test_list
14
+
15
+ # Read in mock JSON
16
+ file = File.read('mock-api/list-ssh-keys.json')
17
+ data = JSON.parse(file)
18
+
19
+ # Create stub and perform call
20
+ Excon.stub({:method => :get, :path => '/v1/ssh_keys'},
21
+ {:body => JSON.generate(data), :status => 200})
22
+
23
+ response = @ssh_key.list
24
+
25
+ # Assertions
26
+ assert_equal response[0]['id'], data[0]['id']
27
+
28
+ # Clear out stubs
29
+ Excon.stubs.clear
30
+
31
+ end
32
+
33
+
34
+ def test_create
35
+
36
+ # Read in mock JSON
37
+ file = File.read('mock-api/create-ssh-key.json')
38
+ data = JSON.parse(file)
39
+
40
+ # Create stub and perform call
41
+ Excon.stub({:method => :post, :path => '/v1/ssh_keys'},
42
+ {:body => JSON.generate(data), :status => 202})
43
+
44
+ response = @ssh_key.create(name: data['name'])
45
+
46
+ # Assertions
47
+ assert_equal response['name'], data['name']
48
+
49
+ # Clear out stubs
50
+ Excon.stubs.clear
51
+
52
+ end
53
+
54
+
55
+ def test_get
56
+
57
+ # Read in mock JSON
58
+ file = File.read('mock-api/get-ssh-key.json')
59
+ data = JSON.parse(file)
60
+
61
+ # Create stub and perform call
62
+ Excon.stub({:method => :get, :path => "/v1/ssh_keys/#{data['id']}"},
63
+ {:body => JSON.generate(data), :status => 200})
64
+
65
+ response = @ssh_key.get(ssh_key_id: data['id'])
66
+
67
+ # Assertions
68
+ assert_equal response['id'], data['id']
69
+
70
+ # Clear out stubs
71
+ Excon.stubs.clear
72
+
73
+ end
74
+
75
+
76
+ def test_modify
77
+
78
+ # Read in mock JSON
79
+ file = File.read('mock-api/modify-ssh-key.json')
80
+ data = JSON.parse(file)
81
+
82
+ # Create stub and perform call
83
+ Excon.stub({:method => :put, :path => "/v1/ssh_keys/#{data['id']}"},
84
+ {:body => JSON.generate(data), :status => 202})
85
+
86
+ response = @ssh_key.modify(ssh_key_id: data['id'], name: 'New Name')
87
+
88
+ # Assertions
89
+ assert_equal response['name'], data['name']
90
+
91
+ # Clear out stubs
92
+ Excon.stubs.clear
93
+
94
+ end
95
+
96
+
97
+ def test_delete
98
+
99
+ # Read in mock JSON
100
+ file = File.read('mock-api/delete-ssh-key.json')
101
+ data = JSON.parse(file)
102
+
103
+ # Create stub and perform call
104
+ Excon.stub({:method => :delete, :path => "/v1/ssh_keys/#{data['id']}"},
105
+ {:body => JSON.generate(data), :status => 202})
106
+
107
+ response = @ssh_key.delete(ssh_key_id: data['id'])
108
+
109
+ # Assertions
110
+ assert_equal response['state'], 'DELETING'
111
+
112
+ # Clear out stubs
113
+ Excon.stubs.clear
114
+
115
+ end
116
+
117
+
118
+ end