fog-oneandone 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/CONTRIBUTING.md +276 -0
- data/CONTRIBUTORS.md +1 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +317 -0
- data/bin/fog +78 -0
- data/examples/example_app.rb +80 -0
- data/fog-oneandone.gemspec +22 -0
- data/gemfiles/Gemfile-edge +7 -0
- data/lib/fog-oneandone.rb +10 -0
- data/lib/oneandone/compute.rb +713 -0
- data/lib/oneandone/core.rb +11 -0
- data/lib/oneandone/models/compute/firewall.rb +128 -0
- data/lib/oneandone/models/compute/firewalls.rb +24 -0
- data/lib/oneandone/models/compute/image.rb +72 -0
- data/lib/oneandone/models/compute/images.rb +24 -0
- data/lib/oneandone/models/compute/load_balancer.rb +149 -0
- data/lib/oneandone/models/compute/load_balancers.rb +24 -0
- data/lib/oneandone/models/compute/monitoring_policies.rb +24 -0
- data/lib/oneandone/models/compute/monitoring_policy.rb +196 -0
- data/lib/oneandone/models/compute/private_network.rb +105 -0
- data/lib/oneandone/models/compute/private_networks.rb +24 -0
- data/lib/oneandone/models/compute/public_ip.rb +68 -0
- data/lib/oneandone/models/compute/public_ips.rb +24 -0
- data/lib/oneandone/models/compute/server.rb +434 -0
- data/lib/oneandone/models/compute/servers.rb +24 -0
- data/lib/oneandone/models/compute/shared_storage.rb +101 -0
- data/lib/oneandone/models/compute/shared_storages.rb +24 -0
- data/lib/oneandone/models/compute/vpn.rb +70 -0
- data/lib/oneandone/models/compute/vpns.rb +24 -0
- data/lib/oneandone/requests/compute/access.rb +35 -0
- data/lib/oneandone/requests/compute/add_firewall.rb +70 -0
- data/lib/oneandone/requests/compute/add_firewall_ips.rb +67 -0
- data/lib/oneandone/requests/compute/add_firewall_rules.rb +68 -0
- data/lib/oneandone/requests/compute/add_hdds.rb +65 -0
- data/lib/oneandone/requests/compute/add_load_balancer.rb +76 -0
- data/lib/oneandone/requests/compute/add_load_balancer_ips.rb +67 -0
- data/lib/oneandone/requests/compute/add_load_balancer_rules.rb +68 -0
- data/lib/oneandone/requests/compute/add_mp_servers.rb +64 -0
- data/lib/oneandone/requests/compute/add_ports.rb +65 -0
- data/lib/oneandone/requests/compute/add_private_network.rb +65 -0
- data/lib/oneandone/requests/compute/add_private_network_servers.rb +67 -0
- data/lib/oneandone/requests/compute/add_processes.rb +65 -0
- data/lib/oneandone/requests/compute/add_server_ip.rb +72 -0
- data/lib/oneandone/requests/compute/add_shared_storage_servers.rb +64 -0
- data/lib/oneandone/requests/compute/change_password.rb +45 -0
- data/lib/oneandone/requests/compute/change_status.rb +69 -0
- data/lib/oneandone/requests/compute/clone_server.rb +67 -0
- data/lib/oneandone/requests/compute/create_firewall.rb +78 -0
- data/lib/oneandone/requests/compute/create_image.rb +101 -0
- data/lib/oneandone/requests/compute/create_load_balancer.rb +104 -0
- data/lib/oneandone/requests/compute/create_monitoring_policy.rb +93 -0
- data/lib/oneandone/requests/compute/create_private_network.rb +82 -0
- data/lib/oneandone/requests/compute/create_public_ip.rb +77 -0
- data/lib/oneandone/requests/compute/create_server.rb +139 -0
- data/lib/oneandone/requests/compute/create_shared_storage.rb +83 -0
- data/lib/oneandone/requests/compute/create_snapshot.rb +51 -0
- data/lib/oneandone/requests/compute/create_vpn.rb +80 -0
- data/lib/oneandone/requests/compute/delete_firewall.rb +51 -0
- data/lib/oneandone/requests/compute/delete_firewall_rule.rb +60 -0
- data/lib/oneandone/requests/compute/delete_hdd.rb +61 -0
- data/lib/oneandone/requests/compute/delete_image.rb +51 -0
- data/lib/oneandone/requests/compute/delete_load_balancer.rb +51 -0
- data/lib/oneandone/requests/compute/delete_load_balancer_rule.rb +60 -0
- data/lib/oneandone/requests/compute/delete_monitoring_policy.rb +51 -0
- data/lib/oneandone/requests/compute/delete_port.rb +60 -0
- data/lib/oneandone/requests/compute/delete_private_network.rb +51 -0
- data/lib/oneandone/requests/compute/delete_process.rb +60 -0
- data/lib/oneandone/requests/compute/delete_public_ip.rb +51 -0
- data/lib/oneandone/requests/compute/delete_server.rb +51 -0
- data/lib/oneandone/requests/compute/delete_server_ip.rb +60 -0
- data/lib/oneandone/requests/compute/delete_shared_storage.rb +51 -0
- data/lib/oneandone/requests/compute/delete_snapshot.rb +51 -0
- data/lib/oneandone/requests/compute/delete_vpn.rb +51 -0
- data/lib/oneandone/requests/compute/eject_dvd.rb +51 -0
- data/lib/oneandone/requests/compute/get_datacenter.rb +50 -0
- data/lib/oneandone/requests/compute/get_dvd.rb +50 -0
- data/lib/oneandone/requests/compute/get_dvd_iso.rb +50 -0
- data/lib/oneandone/requests/compute/get_firewall.rb +50 -0
- data/lib/oneandone/requests/compute/get_firewall_ip.rb +59 -0
- data/lib/oneandone/requests/compute/get_firewall_rule.rb +59 -0
- data/lib/oneandone/requests/compute/get_fixed_server.rb +50 -0
- data/lib/oneandone/requests/compute/get_hardware.rb +50 -0
- data/lib/oneandone/requests/compute/get_hdd.rb +60 -0
- data/lib/oneandone/requests/compute/get_hdds.rb +50 -0
- data/lib/oneandone/requests/compute/get_image.rb +50 -0
- data/lib/oneandone/requests/compute/get_load_balancer.rb +50 -0
- data/lib/oneandone/requests/compute/get_load_balancer_ip.rb +59 -0
- data/lib/oneandone/requests/compute/get_load_balancer_rule.rb +59 -0
- data/lib/oneandone/requests/compute/get_log.rb +51 -0
- data/lib/oneandone/requests/compute/get_monitored_server.rb +49 -0
- data/lib/oneandone/requests/compute/get_monitoring_policy.rb +50 -0
- data/lib/oneandone/requests/compute/get_mp_server.rb +59 -0
- data/lib/oneandone/requests/compute/get_port.rb +59 -0
- data/lib/oneandone/requests/compute/get_private_network.rb +50 -0
- data/lib/oneandone/requests/compute/get_private_network_server.rb +59 -0
- data/lib/oneandone/requests/compute/get_process.rb +59 -0
- data/lib/oneandone/requests/compute/get_public_ip.rb +50 -0
- data/lib/oneandone/requests/compute/get_server.rb +50 -0
- data/lib/oneandone/requests/compute/get_server_appliance.rb +50 -0
- data/lib/oneandone/requests/compute/get_server_image.rb +50 -0
- data/lib/oneandone/requests/compute/get_server_ip.rb +59 -0
- data/lib/oneandone/requests/compute/get_server_private_network.rb +59 -0
- data/lib/oneandone/requests/compute/get_shared_storage.rb +50 -0
- data/lib/oneandone/requests/compute/get_shared_storage_server.rb +59 -0
- data/lib/oneandone/requests/compute/get_snapshot.rb +50 -0
- data/lib/oneandone/requests/compute/get_vpn.rb +50 -0
- data/lib/oneandone/requests/compute/install_server_image.rb +72 -0
- data/lib/oneandone/requests/compute/list_datacenters.rb +56 -0
- data/lib/oneandone/requests/compute/list_dvds.rb +56 -0
- data/lib/oneandone/requests/compute/list_firewall_ips.rb +50 -0
- data/lib/oneandone/requests/compute/list_firewall_rules.rb +50 -0
- data/lib/oneandone/requests/compute/list_firewalls.rb +56 -0
- data/lib/oneandone/requests/compute/list_fixed_servers.rb +40 -0
- data/lib/oneandone/requests/compute/list_images.rb +56 -0
- data/lib/oneandone/requests/compute/list_ip_firewalls.rb +59 -0
- data/lib/oneandone/requests/compute/list_ip_load_balancers.rb +59 -0
- data/lib/oneandone/requests/compute/list_load_balancer_ips.rb +50 -0
- data/lib/oneandone/requests/compute/list_load_balancer_rules.rb +50 -0
- data/lib/oneandone/requests/compute/list_load_balancers.rb +56 -0
- data/lib/oneandone/requests/compute/list_logs.rb +59 -0
- data/lib/oneandone/requests/compute/list_monitored_servers.rb +51 -0
- data/lib/oneandone/requests/compute/list_monitoring_policies.rb +56 -0
- data/lib/oneandone/requests/compute/list_mp_servers.rb +50 -0
- data/lib/oneandone/requests/compute/list_ports.rb +51 -0
- data/lib/oneandone/requests/compute/list_private_network_servers.rb +50 -0
- data/lib/oneandone/requests/compute/list_private_networks.rb +56 -0
- data/lib/oneandone/requests/compute/list_processes.rb +51 -0
- data/lib/oneandone/requests/compute/list_public_ips.rb +56 -0
- data/lib/oneandone/requests/compute/list_server_appliances.rb +56 -0
- data/lib/oneandone/requests/compute/list_server_ips.rb +50 -0
- data/lib/oneandone/requests/compute/list_server_private_networks.rb +50 -0
- data/lib/oneandone/requests/compute/list_servers.rb +56 -0
- data/lib/oneandone/requests/compute/list_shared_storage_servers.rb +50 -0
- data/lib/oneandone/requests/compute/list_shared_storages.rb +56 -0
- data/lib/oneandone/requests/compute/list_usages.rb +54 -0
- data/lib/oneandone/requests/compute/list_vpns.rb +56 -0
- data/lib/oneandone/requests/compute/load_dvd.rb +65 -0
- data/lib/oneandone/requests/compute/ping.rb +38 -0
- data/lib/oneandone/requests/compute/ping_auth.rb +38 -0
- data/lib/oneandone/requests/compute/remove_firewall.rb +60 -0
- data/lib/oneandone/requests/compute/remove_firewall_ip.rb +60 -0
- data/lib/oneandone/requests/compute/remove_load_balancer.rb +71 -0
- data/lib/oneandone/requests/compute/remove_load_balancer_ip.rb +60 -0
- data/lib/oneandone/requests/compute/remove_mp_server.rb +60 -0
- data/lib/oneandone/requests/compute/remove_private_network.rb +60 -0
- data/lib/oneandone/requests/compute/remove_private_network_server.rb +60 -0
- data/lib/oneandone/requests/compute/remove_shared_storage_server.rb +60 -0
- data/lib/oneandone/requests/compute/restore_snapshot.rb +35 -0
- data/lib/oneandone/requests/compute/status.rb +50 -0
- data/lib/oneandone/requests/compute/update_firewall.rb +76 -0
- data/lib/oneandone/requests/compute/update_hardware.rb +82 -0
- data/lib/oneandone/requests/compute/update_hdd.rb +71 -0
- data/lib/oneandone/requests/compute/update_image.rb +80 -0
- data/lib/oneandone/requests/compute/update_load_balancer.rb +96 -0
- data/lib/oneandone/requests/compute/update_monitoring_policy.rb +82 -0
- data/lib/oneandone/requests/compute/update_port.rb +74 -0
- data/lib/oneandone/requests/compute/update_private_network.rb +82 -0
- data/lib/oneandone/requests/compute/update_process.rb +76 -0
- data/lib/oneandone/requests/compute/update_public_ip.rb +71 -0
- data/lib/oneandone/requests/compute/update_server.rb +76 -0
- data/lib/oneandone/requests/compute/update_shared_storage.rb +80 -0
- data/lib/oneandone/requests/compute/update_vpn.rb +76 -0
- data/tests/oneandone/test_firewalls.rb +188 -0
- data/tests/oneandone/test_images.rb +79 -0
- data/tests/oneandone/test_load_balancers.rb +192 -0
- data/tests/oneandone/test_monitoring_policies.rb +342 -0
- data/tests/oneandone/test_private_networks.rb +123 -0
- data/tests/oneandone/test_public_ips.rb +75 -0
- data/tests/oneandone/test_servers.rb +465 -0
- data/tests/oneandone/test_shared_storages.rb +131 -0
- metadata +259 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of all private networks on your account
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks_get]
|
10
|
+
##
|
11
|
+
def list_private_networks(page: nil, per_page: nil, sort: nil, q: nil,
|
12
|
+
fields: nil)
|
13
|
+
|
14
|
+
# Build hash for query parameters
|
15
|
+
keyword_args = {
|
16
|
+
:page => page,
|
17
|
+
:per_page => per_page,
|
18
|
+
:sort => sort,
|
19
|
+
:q => q,
|
20
|
+
:fields => fields
|
21
|
+
}
|
22
|
+
|
23
|
+
# Clean out null query parameters
|
24
|
+
query = clean_hash(keyword_args)
|
25
|
+
|
26
|
+
# Request
|
27
|
+
params = {
|
28
|
+
'method' => :get,
|
29
|
+
'endpoint' => '/private_networks',
|
30
|
+
'params' => query
|
31
|
+
}
|
32
|
+
|
33
|
+
request(params)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end # Real
|
38
|
+
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
|
42
|
+
def list_private_networks(page: nil, per_page: nil, sort: nil, q: nil,
|
43
|
+
fields: nil)
|
44
|
+
|
45
|
+
response = Excon::Response.new
|
46
|
+
response.status = 200
|
47
|
+
response.body = self.data[:private_networks]
|
48
|
+
response
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end # Mock
|
53
|
+
|
54
|
+
end # OneAndOne
|
55
|
+
end # Compute
|
56
|
+
end # Fog
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of a monitoring policy's processes
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__processes_get]
|
10
|
+
##
|
11
|
+
def list_processes(monitoring_policy_id)
|
12
|
+
|
13
|
+
# Request
|
14
|
+
params = {
|
15
|
+
'method' => :get,
|
16
|
+
'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/processes"
|
17
|
+
}
|
18
|
+
|
19
|
+
request(params)
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end # Real
|
24
|
+
|
25
|
+
|
26
|
+
class Mock
|
27
|
+
|
28
|
+
def list_processes(monitoring_policy_id)
|
29
|
+
|
30
|
+
# Search for MP
|
31
|
+
if monitoring_policy = self.data[:monitoring_policies].find {
|
32
|
+
|hash| hash['id'] == monitoring_policy_id
|
33
|
+
}
|
34
|
+
else
|
35
|
+
raise Fog::Errors::NotFound.new('The requested resource could
|
36
|
+
not be found.')
|
37
|
+
end
|
38
|
+
|
39
|
+
# Return Response Object to User
|
40
|
+
response = Excon::Response.new
|
41
|
+
response.status = 200
|
42
|
+
response.body = monitoring_policy['processes']
|
43
|
+
response
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end # Mock
|
48
|
+
|
49
|
+
end # OneAndOne
|
50
|
+
end # Compute
|
51
|
+
end # Fog
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of all public IPs on your account
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#public_ips_get]
|
10
|
+
##
|
11
|
+
def list_public_ips(page: nil, per_page: nil, sort: nil, q: nil,
|
12
|
+
fields: nil)
|
13
|
+
|
14
|
+
# Build hash for query parameters
|
15
|
+
keyword_args = {
|
16
|
+
:page => page,
|
17
|
+
:per_page => per_page,
|
18
|
+
:sort => sort,
|
19
|
+
:q => q,
|
20
|
+
:fields => fields
|
21
|
+
}
|
22
|
+
|
23
|
+
# Clean out null query parameters
|
24
|
+
query = clean_hash(keyword_args)
|
25
|
+
|
26
|
+
# Request
|
27
|
+
params = {
|
28
|
+
'method' => :get,
|
29
|
+
'endpoint' => '/public_ips',
|
30
|
+
'params' => query
|
31
|
+
}
|
32
|
+
|
33
|
+
request(params)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end # Real
|
38
|
+
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
|
42
|
+
def list_public_ips(page: nil, per_page: nil, sort: nil, q: nil,
|
43
|
+
fields: nil)
|
44
|
+
|
45
|
+
response = Excon::Response.new
|
46
|
+
response.status = 200
|
47
|
+
response.body = self.data[:public_ips]
|
48
|
+
response
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end # Mock
|
53
|
+
|
54
|
+
end # OneAndOne
|
55
|
+
end # Compute
|
56
|
+
end # Fog
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of appliances that you can use to create a server
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#server_appliances_get]
|
10
|
+
##
|
11
|
+
def list_server_appliances(page: nil, per_page: nil, sort: nil, q: nil,
|
12
|
+
fields: nil)
|
13
|
+
|
14
|
+
# Build hash for query parameters
|
15
|
+
keyword_args = {
|
16
|
+
:page => page,
|
17
|
+
:per_page => per_page,
|
18
|
+
:sort => sort,
|
19
|
+
:q => q,
|
20
|
+
:fields => fields
|
21
|
+
}
|
22
|
+
|
23
|
+
# Clean out null query parameters
|
24
|
+
query = clean_hash(keyword_args)
|
25
|
+
|
26
|
+
# Request
|
27
|
+
params = {
|
28
|
+
'method' => :get,
|
29
|
+
'endpoint' => '/server_appliances',
|
30
|
+
'params' => query
|
31
|
+
}
|
32
|
+
|
33
|
+
request(params)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end # Real
|
38
|
+
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
|
42
|
+
def list_server_appliances(page: nil, per_page: nil, sort: nil, q: nil,
|
43
|
+
fields: nil)
|
44
|
+
|
45
|
+
response = Excon::Response.new
|
46
|
+
response.status = 200
|
47
|
+
response.body = self.data[:server_appliances]
|
48
|
+
response
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end # Mock
|
53
|
+
|
54
|
+
end # OneAndOne
|
55
|
+
end # Compute
|
56
|
+
end # Fog
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of a server's IP's
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__ips_get]
|
10
|
+
##
|
11
|
+
def list_server_ips(server_id)
|
12
|
+
|
13
|
+
params = {
|
14
|
+
'method' => :get,
|
15
|
+
'endpoint' => "/servers/#{server_id}/ips"
|
16
|
+
}
|
17
|
+
|
18
|
+
request(params)
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end # Real
|
23
|
+
|
24
|
+
|
25
|
+
class Mock
|
26
|
+
|
27
|
+
def list_server_ips(server_id)
|
28
|
+
|
29
|
+
# Search for server
|
30
|
+
if server = self.data[:servers].find {
|
31
|
+
|hash| hash['id'] == server_id
|
32
|
+
}
|
33
|
+
else
|
34
|
+
raise Fog::Errors::NotFound.new('The requested resource could
|
35
|
+
not be found.')
|
36
|
+
end
|
37
|
+
|
38
|
+
# Return Response Object to User
|
39
|
+
response = Excon::Response.new
|
40
|
+
response.status = 200
|
41
|
+
response.body = server['ips']
|
42
|
+
response
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end # Mock
|
47
|
+
|
48
|
+
end # OneAndOne
|
49
|
+
end # Compute
|
50
|
+
end # Fog
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of the server's private networks
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__private_networks_get]
|
10
|
+
##
|
11
|
+
def list_server_private_networks(server_id)
|
12
|
+
|
13
|
+
params = {
|
14
|
+
'method' => :get,
|
15
|
+
'endpoint' => "/servers/#{server_id}/private_networks"
|
16
|
+
}
|
17
|
+
|
18
|
+
request(params)
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end # Real
|
23
|
+
|
24
|
+
|
25
|
+
class Mock
|
26
|
+
|
27
|
+
def list_server_private_networks(server_id)
|
28
|
+
|
29
|
+
# Search for server
|
30
|
+
if server = self.data[:servers].find {
|
31
|
+
|hash| hash['id'] == server_id
|
32
|
+
}
|
33
|
+
else
|
34
|
+
raise Fog::Errors::NotFound.new('The requested resource could
|
35
|
+
not be found.')
|
36
|
+
end
|
37
|
+
|
38
|
+
# Return Response Object to User
|
39
|
+
response = Excon::Response.new
|
40
|
+
response.status = 200
|
41
|
+
response.body = server['private_networks']
|
42
|
+
response
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end # Mock
|
47
|
+
|
48
|
+
end # OneAndOne
|
49
|
+
end # Compute
|
50
|
+
end # Fog
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of all servers on your account
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_get]
|
10
|
+
##
|
11
|
+
def list_servers(page: nil, per_page: nil, sort: nil, q: nil,
|
12
|
+
fields: nil)
|
13
|
+
|
14
|
+
# Build hash for query parameters
|
15
|
+
keyword_args = {
|
16
|
+
:page => page,
|
17
|
+
:per_page => per_page,
|
18
|
+
:sort => sort,
|
19
|
+
:q => q,
|
20
|
+
:fields => fields
|
21
|
+
}
|
22
|
+
|
23
|
+
# Clean out null query parameters
|
24
|
+
query = clean_hash(keyword_args)
|
25
|
+
|
26
|
+
# Request
|
27
|
+
params = {
|
28
|
+
'method' => :get,
|
29
|
+
'endpoint' => '/servers',
|
30
|
+
'params' => query
|
31
|
+
}
|
32
|
+
|
33
|
+
request(params)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end # Real
|
38
|
+
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
|
42
|
+
def list_servers(page: nil, per_page: nil, sort: nil, q: nil,
|
43
|
+
fields: nil)
|
44
|
+
|
45
|
+
response = Excon::Response.new
|
46
|
+
response.status = 200
|
47
|
+
response.body = self.data[:servers]
|
48
|
+
response
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end # Mock
|
53
|
+
|
54
|
+
end # OneAndOne
|
55
|
+
end # Compute
|
56
|
+
end # Fog
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of the servers attached to a shared storage
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages__shared_storage_id__servers_get]
|
10
|
+
##
|
11
|
+
def list_shared_storage_servers(shared_storage_id)
|
12
|
+
|
13
|
+
params = {
|
14
|
+
'method' => :get,
|
15
|
+
'endpoint' => "/shared_storages/#{shared_storage_id}/servers"
|
16
|
+
}
|
17
|
+
|
18
|
+
request(params)
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end # Real
|
23
|
+
|
24
|
+
|
25
|
+
class Mock
|
26
|
+
|
27
|
+
def list_shared_storage_servers(shared_storage_id)
|
28
|
+
|
29
|
+
# Search for shared storage to return
|
30
|
+
if shared_storage = self.data[:shared_storages].find {
|
31
|
+
|hash| hash['id'] == shared_storage_id
|
32
|
+
}
|
33
|
+
else
|
34
|
+
raise Fog::Errors::NotFound.new('The requested resource could
|
35
|
+
not be found.')
|
36
|
+
end
|
37
|
+
|
38
|
+
# Return Response Object to User
|
39
|
+
response = Excon::Response.new
|
40
|
+
response.status = 202
|
41
|
+
response.body = shared_storage['servers']
|
42
|
+
response
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end # Mock
|
47
|
+
|
48
|
+
end # OneAndOne
|
49
|
+
end # Compute
|
50
|
+
end # Fog
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of all shared storages on your account
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_get]
|
10
|
+
##
|
11
|
+
def list_shared_storages(page: nil, per_page: nil, sort: nil, q: nil,
|
12
|
+
fields: nil)
|
13
|
+
|
14
|
+
# Build hash for query parameters
|
15
|
+
keyword_args = {
|
16
|
+
:page => page,
|
17
|
+
:per_page => per_page,
|
18
|
+
:sort => sort,
|
19
|
+
:q => q,
|
20
|
+
:fields => fields
|
21
|
+
}
|
22
|
+
|
23
|
+
# Clean out null query parameters
|
24
|
+
query = clean_hash(keyword_args)
|
25
|
+
|
26
|
+
# Request
|
27
|
+
params = {
|
28
|
+
'method' => :get,
|
29
|
+
'endpoint' => '/shared_storages',
|
30
|
+
'params' => query
|
31
|
+
}
|
32
|
+
|
33
|
+
request(params)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end # Real
|
38
|
+
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
|
42
|
+
def list_shared_storages(page: nil, per_page: nil, sort: nil, q: nil,
|
43
|
+
fields: nil)
|
44
|
+
|
45
|
+
response = Excon::Response.new
|
46
|
+
response.status = 200
|
47
|
+
response.body = self.data[:shared_storages]
|
48
|
+
response
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end # Mock
|
53
|
+
|
54
|
+
end # OneAndOne
|
55
|
+
end # Compute
|
56
|
+
end # Fog
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of your usages
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#usages_get]
|
10
|
+
##
|
11
|
+
def list_usages(page: nil, per_page: nil, sort: nil, q: nil, fields: nil,
|
12
|
+
period: 'LAST_24H', start_date: nil, end_date: nil)
|
13
|
+
|
14
|
+
# Build hash for query parameters
|
15
|
+
keyword_args = {
|
16
|
+
:page => page,
|
17
|
+
:per_page => per_page,
|
18
|
+
:sort => sort,
|
19
|
+
:q => q,
|
20
|
+
:fields => fields,
|
21
|
+
:period => period,
|
22
|
+
:start_date => start_date,
|
23
|
+
:end_date => end_date
|
24
|
+
}
|
25
|
+
|
26
|
+
# Clean out null query parameters
|
27
|
+
query = clean_hash(keyword_args)
|
28
|
+
|
29
|
+
# Request
|
30
|
+
params = {
|
31
|
+
'method' => :get,
|
32
|
+
'endpoint' => '/usages',
|
33
|
+
'params' => query
|
34
|
+
}
|
35
|
+
|
36
|
+
request(params)
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end # Real
|
41
|
+
|
42
|
+
|
43
|
+
class Mock
|
44
|
+
|
45
|
+
def list_usages(page: nil, per_page: nil, sort: nil, q: nil, fields: nil,
|
46
|
+
period: 'LAST_24H', start_date: nil, end_date: nil)
|
47
|
+
Fog::Mock.not_implemented
|
48
|
+
end
|
49
|
+
|
50
|
+
end # Mock
|
51
|
+
|
52
|
+
end # OneAndOne
|
53
|
+
end # Compute
|
54
|
+
end # Fog
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns a list of all VPN's on your account
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#vpns_get]
|
10
|
+
##
|
11
|
+
def list_vpns(page: nil, per_page: nil, sort: nil, q: nil,
|
12
|
+
fields: nil)
|
13
|
+
|
14
|
+
# Build hash for query parameters
|
15
|
+
keyword_args = {
|
16
|
+
:page => page,
|
17
|
+
:per_page => per_page,
|
18
|
+
:sort => sort,
|
19
|
+
:q => q,
|
20
|
+
:fields => fields
|
21
|
+
}
|
22
|
+
|
23
|
+
# Clean out null query parameters
|
24
|
+
query = clean_hash(keyword_args)
|
25
|
+
|
26
|
+
# Request
|
27
|
+
params = {
|
28
|
+
'method' => :get,
|
29
|
+
'endpoint' => '/vpns',
|
30
|
+
'params' => query
|
31
|
+
}
|
32
|
+
|
33
|
+
request(params)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end # Real
|
38
|
+
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
|
42
|
+
def list_vpns(page: nil, per_page: nil, sort: nil, q: nil,
|
43
|
+
fields: nil)
|
44
|
+
|
45
|
+
response = Excon::Response.new
|
46
|
+
response.status = 200
|
47
|
+
response.body = self.data[:vpns]
|
48
|
+
response
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end # Mock
|
53
|
+
|
54
|
+
end # OneAndOne
|
55
|
+
end # Compute
|
56
|
+
end # Fog
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Loads a DVD into the virtual DVD unit of a server
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__dvd_put]
|
10
|
+
##
|
11
|
+
def load_dvd(server_id: nil, dvd_id: nil)
|
12
|
+
|
13
|
+
# Build PUT body
|
14
|
+
dvd_specs = {
|
15
|
+
'id' => dvd_id
|
16
|
+
}
|
17
|
+
|
18
|
+
# Stringify the PUT body
|
19
|
+
string_body = Fog::JSON.encode(dvd_specs)
|
20
|
+
|
21
|
+
# Request
|
22
|
+
params = {
|
23
|
+
'method' => :put,
|
24
|
+
'endpoint' => "/servers/#{server_id}/dvd",
|
25
|
+
'body' => string_body
|
26
|
+
}
|
27
|
+
|
28
|
+
request(params)
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end # Real
|
33
|
+
|
34
|
+
|
35
|
+
class Mock
|
36
|
+
|
37
|
+
def load_dvd(server_id: nil, dvd_id: nil)
|
38
|
+
|
39
|
+
# Search for server
|
40
|
+
if server = self.data[:servers].find {
|
41
|
+
|hash| hash['id'] == server_id
|
42
|
+
}
|
43
|
+
dvd = {
|
44
|
+
'id' => dvd_id
|
45
|
+
}
|
46
|
+
|
47
|
+
server['dvd'] = dvd
|
48
|
+
else
|
49
|
+
raise Fog::Errors::NotFound.new('The requested resource could
|
50
|
+
not be found.')
|
51
|
+
end
|
52
|
+
|
53
|
+
# Return Response Object to User
|
54
|
+
response = Excon::Response.new
|
55
|
+
response.status = 200
|
56
|
+
response.body = server
|
57
|
+
response
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end # Mock
|
62
|
+
|
63
|
+
end # OneAndOne
|
64
|
+
end # Compute
|
65
|
+
end # Fog
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
##
|
8
|
+
# Returns "PONG" if API is running.
|
9
|
+
# URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#ping_get]
|
10
|
+
##
|
11
|
+
def ping
|
12
|
+
|
13
|
+
# Request
|
14
|
+
params = {
|
15
|
+
'method' => :get,
|
16
|
+
'endpoint' => '/ping'
|
17
|
+
}
|
18
|
+
|
19
|
+
request(params)
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end # Real
|
24
|
+
|
25
|
+
|
26
|
+
class Mock
|
27
|
+
|
28
|
+
def ping
|
29
|
+
|
30
|
+
Fog::Mock.not_implemented
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end # Mock
|
35
|
+
|
36
|
+
end # OneAndOne
|
37
|
+
end # Compute
|
38
|
+
end # Fog
|