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,128 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
class Firewall < Fog::Model
|
5
|
+
|
6
|
+
# Declare Model Attributes
|
7
|
+
identity :id
|
8
|
+
|
9
|
+
attribute :name
|
10
|
+
attribute :description
|
11
|
+
attribute :state
|
12
|
+
attribute :creation_date
|
13
|
+
attribute :rules
|
14
|
+
attribute :server_ips
|
15
|
+
|
16
|
+
|
17
|
+
def save
|
18
|
+
|
19
|
+
requires :name, :rules
|
20
|
+
|
21
|
+
# Perform Request
|
22
|
+
response = service.create_firewall(name: name, rules: rules,
|
23
|
+
description: description)
|
24
|
+
|
25
|
+
# Merge Attributes
|
26
|
+
merge_attributes(response.body)
|
27
|
+
|
28
|
+
true
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def update(options = {})
|
34
|
+
|
35
|
+
requires :id
|
36
|
+
|
37
|
+
response = service.update_firewall(firewall_id: id, name: options[:name],
|
38
|
+
description: options[:description])
|
39
|
+
|
40
|
+
# Merge Attributes
|
41
|
+
merge_attributes(response.body)
|
42
|
+
|
43
|
+
true
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def add_ips(options = {})
|
49
|
+
|
50
|
+
requires :id
|
51
|
+
|
52
|
+
response = service.add_firewall_ips(firewall_id: id,
|
53
|
+
ips: options[:ips])
|
54
|
+
|
55
|
+
# Merge Attributes
|
56
|
+
merge_attributes(response.body)
|
57
|
+
|
58
|
+
true
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def remove_ip(options = {})
|
64
|
+
|
65
|
+
requires :id
|
66
|
+
|
67
|
+
response = service.remove_firewall_ip(firewall_id: id,
|
68
|
+
ip_id: options[:ip_id])
|
69
|
+
|
70
|
+
# Merge Attributes
|
71
|
+
merge_attributes(response.body)
|
72
|
+
|
73
|
+
true
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
def add_rules(options = {})
|
79
|
+
|
80
|
+
requires :id
|
81
|
+
|
82
|
+
response = service.add_firewall_rules(firewall_id: id,
|
83
|
+
rules: options[:rules])
|
84
|
+
|
85
|
+
# Merge Attributes
|
86
|
+
merge_attributes(response.body)
|
87
|
+
|
88
|
+
true
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
def delete_rule(options = {})
|
94
|
+
|
95
|
+
requires :id
|
96
|
+
|
97
|
+
response = service.delete_firewall_rule(firewall_id: id,
|
98
|
+
rule_id: options[:rule_id])
|
99
|
+
|
100
|
+
# Merge Attributes
|
101
|
+
merge_attributes(response.body)
|
102
|
+
|
103
|
+
true
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def destroy
|
109
|
+
|
110
|
+
requires :id
|
111
|
+
|
112
|
+
service.delete_firewall(id)
|
113
|
+
|
114
|
+
true
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
def ready?
|
120
|
+
|
121
|
+
state == 'ACTIVE'
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end # Firewall
|
126
|
+
end # OneAndOne
|
127
|
+
end # Compute
|
128
|
+
end # Fog
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'firewall'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class OneAndOne
|
6
|
+
class Firewalls < Fog::Collection
|
7
|
+
model Fog::Compute::OneAndOne::Firewall
|
8
|
+
|
9
|
+
def all
|
10
|
+
response = service.list_firewalls
|
11
|
+
load(response.body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
response = service.get_firewall(id)
|
16
|
+
new(response.body)
|
17
|
+
rescue Excon::Errors::NotFound
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
end # Firewalls
|
22
|
+
end # OneAndOne
|
23
|
+
end # Compute
|
24
|
+
end # Fog
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
class Image < Fog::Model
|
5
|
+
|
6
|
+
# Declare Model Attributes
|
7
|
+
identity :id
|
8
|
+
|
9
|
+
attribute :name
|
10
|
+
attribute :description
|
11
|
+
attribute :datacenter
|
12
|
+
attribute :min_hdd_size
|
13
|
+
attribute :state
|
14
|
+
attribute :hdds
|
15
|
+
attribute :server_id
|
16
|
+
attribute :frequency
|
17
|
+
attribute :num_images
|
18
|
+
attribute :creation_date
|
19
|
+
|
20
|
+
|
21
|
+
def save
|
22
|
+
|
23
|
+
requires :name, :server_id, :frequency, :num_images
|
24
|
+
|
25
|
+
# Perform Request
|
26
|
+
response = service.create_image(name: name, description: description,
|
27
|
+
server_id: server_id, frequency: frequency, num_images: num_images)
|
28
|
+
|
29
|
+
# Merge Attributes
|
30
|
+
merge_attributes(response.body)
|
31
|
+
|
32
|
+
true
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def update(options = {})
|
38
|
+
|
39
|
+
requires :id
|
40
|
+
|
41
|
+
response = service.update_image(image_id: id, name: options[:name],
|
42
|
+
description: options[:description], frequency: options[:frequency])
|
43
|
+
|
44
|
+
# Merge Attributes
|
45
|
+
merge_attributes(response.body)
|
46
|
+
|
47
|
+
true
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def destroy
|
53
|
+
|
54
|
+
requires :id
|
55
|
+
|
56
|
+
service.delete_image(id)
|
57
|
+
|
58
|
+
true
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def ready?
|
64
|
+
|
65
|
+
state == 'ENABLED'
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end # Image
|
70
|
+
end # OneAndOne
|
71
|
+
end # Compute
|
72
|
+
end # Fog
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'image'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class OneAndOne
|
6
|
+
class Images < Fog::Collection
|
7
|
+
model Fog::Compute::OneAndOne::Image
|
8
|
+
|
9
|
+
def all
|
10
|
+
response = service.list_images
|
11
|
+
load(response.body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
response = service.get_image(id)
|
16
|
+
new(response.body)
|
17
|
+
rescue Excon::Errors::NotFound
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
end # Images
|
22
|
+
end # OneAndOne
|
23
|
+
end # Compute
|
24
|
+
end # Fog
|
@@ -0,0 +1,149 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
class LoadBalancer < Fog::Model
|
5
|
+
|
6
|
+
# Declare Model Attributes
|
7
|
+
identity :id
|
8
|
+
|
9
|
+
attribute :name
|
10
|
+
attribute :description
|
11
|
+
attribute :state
|
12
|
+
attribute :rules
|
13
|
+
attribute :datacenter
|
14
|
+
attribute :datacenter_id
|
15
|
+
attribute :health_check_test
|
16
|
+
attribute :health_check_interval
|
17
|
+
attribute :persistence
|
18
|
+
attribute :persistence_time
|
19
|
+
attribute :method
|
20
|
+
attribute :health_check_path
|
21
|
+
attribute :health_check_parse
|
22
|
+
attribute :creation_date
|
23
|
+
attribute :server_ips
|
24
|
+
|
25
|
+
|
26
|
+
def save
|
27
|
+
|
28
|
+
requires :name, :rules, :health_check_test, :health_check_interval,
|
29
|
+
:persistence, :persistence_time, :method
|
30
|
+
|
31
|
+
# Perform Request
|
32
|
+
response = service.create_load_balancer(name: name,
|
33
|
+
description: description, health_check_test: health_check_test,
|
34
|
+
health_check_interval: health_check_interval,
|
35
|
+
persistence: persistence, persistence_time: persistence_time,
|
36
|
+
method: method, rules: rules, health_check_path: health_check_path,
|
37
|
+
health_check_parse: health_check_parse, datacenter_id: datacenter_id)
|
38
|
+
|
39
|
+
# Merge Attributes
|
40
|
+
merge_attributes(response.body)
|
41
|
+
|
42
|
+
true
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def update(options = {})
|
48
|
+
|
49
|
+
requires :id
|
50
|
+
|
51
|
+
response = service.update_load_balancer(load_balancer_id: id,
|
52
|
+
name: options[:name], description: options[:description],
|
53
|
+
health_check_test: options[:health_check_test],
|
54
|
+
health_check_interval: options[:health_check_interval],
|
55
|
+
persistence: options[:persistence],
|
56
|
+
persistence_time: options[:persistence_time],
|
57
|
+
method: options[:method],
|
58
|
+
health_check_path: options[:health_check_path],
|
59
|
+
health_check_parse: options[:health_check_parse])
|
60
|
+
|
61
|
+
# Merge Attributes
|
62
|
+
merge_attributes(response.body)
|
63
|
+
|
64
|
+
true
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def add_ips(options = {})
|
70
|
+
|
71
|
+
requires :id
|
72
|
+
|
73
|
+
response = service.add_load_balancer_ips(load_balancer_id: id,
|
74
|
+
ips: options[:ips])
|
75
|
+
|
76
|
+
# Merge Attributes
|
77
|
+
merge_attributes(response.body)
|
78
|
+
|
79
|
+
true
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def remove_ip(options = {})
|
85
|
+
|
86
|
+
requires :id
|
87
|
+
|
88
|
+
response = service.remove_load_balancer_ip(load_balancer_id: id,
|
89
|
+
ip_id: options[:ip_id])
|
90
|
+
|
91
|
+
# Merge Attributes
|
92
|
+
merge_attributes(response.body)
|
93
|
+
|
94
|
+
true
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
def add_rules(options = {})
|
100
|
+
|
101
|
+
requires :id
|
102
|
+
|
103
|
+
response = service.add_load_balancer_rules(load_balancer_id: id,
|
104
|
+
rules: options[:rules])
|
105
|
+
|
106
|
+
# Merge Attributes
|
107
|
+
merge_attributes(response.body)
|
108
|
+
|
109
|
+
true
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
def delete_rule(options = {})
|
115
|
+
|
116
|
+
requires :id
|
117
|
+
|
118
|
+
response = service.delete_load_balancer_rule(load_balancer_id: id,
|
119
|
+
rule_id: options[:rule_id])
|
120
|
+
|
121
|
+
# Merge Attributes
|
122
|
+
merge_attributes(response.body)
|
123
|
+
|
124
|
+
true
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def destroy
|
130
|
+
|
131
|
+
requires :id
|
132
|
+
|
133
|
+
service.delete_load_balancer(id)
|
134
|
+
|
135
|
+
true
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
def ready?
|
141
|
+
|
142
|
+
state == 'ACTIVE'
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
end # LoadBalancer
|
147
|
+
end # OneAndOne
|
148
|
+
end # Compute
|
149
|
+
end # Fog
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'load_balancer'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class OneAndOne
|
6
|
+
class LoadBalancers < Fog::Collection
|
7
|
+
model Fog::Compute::OneAndOne::LoadBalancer
|
8
|
+
|
9
|
+
def all
|
10
|
+
response = service.list_load_balancers
|
11
|
+
load(response.body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
response = service.get_load_balancer(id)
|
16
|
+
new(response.body)
|
17
|
+
rescue Excon::Errors::NotFound
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
end # LoadBalancers
|
22
|
+
end # OneAndOne
|
23
|
+
end # Compute
|
24
|
+
end # Fog
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'monitoring_policy'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class OneAndOne
|
6
|
+
class MonitoringPolicies < Fog::Collection
|
7
|
+
model Fog::Compute::OneAndOne::MonitoringPolicy
|
8
|
+
|
9
|
+
def all
|
10
|
+
response = service.list_monitoring_policies
|
11
|
+
load(response.body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
response = service.get_monitoring_policy(id)
|
16
|
+
new(response.body)
|
17
|
+
rescue Excon::Errors::NotFound
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
end # MonitoringPolicies
|
22
|
+
end # OneAndOne
|
23
|
+
end # Compute
|
24
|
+
end # Fog
|
@@ -0,0 +1,196 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OneAndOne
|
4
|
+
class MonitoringPolicy < Fog::Model
|
5
|
+
|
6
|
+
# Declare Model Attributes
|
7
|
+
identity :id
|
8
|
+
|
9
|
+
attribute :name
|
10
|
+
attribute :description
|
11
|
+
attribute :email
|
12
|
+
attribute :agent
|
13
|
+
attribute :thresholds
|
14
|
+
attribute :ports
|
15
|
+
attribute :processes
|
16
|
+
|
17
|
+
attribute :state
|
18
|
+
attribute :creation_date
|
19
|
+
attribute :servers
|
20
|
+
|
21
|
+
|
22
|
+
def save
|
23
|
+
|
24
|
+
requires :name, :agent, :email, :thresholds, :ports, :processes
|
25
|
+
|
26
|
+
# Perform Request
|
27
|
+
response = service.create_monitoring_policy(name: name,
|
28
|
+
description: description, email: email, agent: agent,
|
29
|
+
thresholds: thresholds, ports: ports, processes: processes)
|
30
|
+
|
31
|
+
# Merge Attributes
|
32
|
+
merge_attributes(response.body)
|
33
|
+
|
34
|
+
true
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def update(options = {})
|
40
|
+
|
41
|
+
requires :id
|
42
|
+
|
43
|
+
response = service.update_monitoring_policy(monitoring_policy_id: id,
|
44
|
+
name: options[:name], description: options[:description],
|
45
|
+
email: options[:email], thresholds: options[:thresholds])
|
46
|
+
|
47
|
+
# Merge Attributes
|
48
|
+
merge_attributes(response.body)
|
49
|
+
|
50
|
+
true
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def add_ports(options = {})
|
56
|
+
|
57
|
+
requires :id
|
58
|
+
|
59
|
+
response = service.add_ports(monitoring_policy_id: id,
|
60
|
+
ports: options[:ports])
|
61
|
+
|
62
|
+
# Merge Attributes
|
63
|
+
merge_attributes(response.body)
|
64
|
+
|
65
|
+
true
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def delete_port(options = {})
|
71
|
+
|
72
|
+
requires :id
|
73
|
+
|
74
|
+
response = service.delete_port(monitoring_policy_id: id,
|
75
|
+
port_id: options[:port_id])
|
76
|
+
|
77
|
+
# Merge Attributes
|
78
|
+
merge_attributes(response.body)
|
79
|
+
|
80
|
+
true
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def update_port(options = {})
|
86
|
+
|
87
|
+
requires :id
|
88
|
+
|
89
|
+
response = service.update_port(monitoring_policy_id: id,
|
90
|
+
port_id: options[:port_id], new_port: options[:new_port])
|
91
|
+
|
92
|
+
# Merge Attributes
|
93
|
+
merge_attributes(response.body)
|
94
|
+
|
95
|
+
true
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
def add_processes(options = {})
|
101
|
+
|
102
|
+
requires :id
|
103
|
+
|
104
|
+
response = service.add_processes(monitoring_policy_id: id,
|
105
|
+
processes: options[:processes])
|
106
|
+
|
107
|
+
# Merge Attributes
|
108
|
+
merge_attributes(response.body)
|
109
|
+
|
110
|
+
true
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
def delete_process(options = {})
|
116
|
+
|
117
|
+
requires :id
|
118
|
+
|
119
|
+
response = service.delete_process(monitoring_policy_id: id,
|
120
|
+
process_id: options[:process_id])
|
121
|
+
|
122
|
+
# Merge Attributes
|
123
|
+
merge_attributes(response.body)
|
124
|
+
|
125
|
+
true
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
def update_process(options = {})
|
131
|
+
|
132
|
+
requires :id
|
133
|
+
|
134
|
+
response = service.update_process(monitoring_policy_id: id,
|
135
|
+
process_id: options[:process_id],
|
136
|
+
new_process: options[:new_process])
|
137
|
+
|
138
|
+
# Merge Attributes
|
139
|
+
merge_attributes(response.body)
|
140
|
+
|
141
|
+
true
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
def add_servers(options = {})
|
147
|
+
|
148
|
+
requires :id
|
149
|
+
|
150
|
+
response = service.add_mp_servers(monitoring_policy_id: id,
|
151
|
+
servers: options[:servers])
|
152
|
+
|
153
|
+
# Decode and Merge Attributes
|
154
|
+
merge_attributes(response.body)
|
155
|
+
|
156
|
+
true
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
|
161
|
+
def remove_server(options = {})
|
162
|
+
|
163
|
+
requires :id
|
164
|
+
|
165
|
+
response = service.remove_mp_server(monitoring_policy_id: id,
|
166
|
+
server_id: options[:server_id])
|
167
|
+
|
168
|
+
# Merge Attributes
|
169
|
+
merge_attributes(response.body)
|
170
|
+
|
171
|
+
true
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
|
176
|
+
def destroy
|
177
|
+
|
178
|
+
requires :id
|
179
|
+
|
180
|
+
service.delete_monitoring_policy(id)
|
181
|
+
|
182
|
+
true
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
def ready?
|
188
|
+
|
189
|
+
state == 'ACTIVE'
|
190
|
+
|
191
|
+
end
|
192
|
+
|
193
|
+
end # MonitoringPolicy
|
194
|
+
end # OneAndOne
|
195
|
+
end # Compute
|
196
|
+
end # Fog
|