1and1 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/1and1-1.0.gem +0 -0
- data/1and1.gemspec +20 -0
- data/Gemfile +4 -0
- data/LICENSE +201 -0
- data/README.md +499 -0
- data/docs/reference.md +2447 -0
- data/examples/dvd_examples.rb +15 -0
- data/examples/example_app.rb +100 -0
- data/examples/firewall_examples.rb +137 -0
- data/examples/image_examples.rb +48 -0
- data/examples/load_balancer_examples.rb +145 -0
- data/examples/log_examples.rb +15 -0
- data/examples/monitoring_center_examples.rb +15 -0
- data/examples/monitoring_policy_examples.rb +343 -0
- data/examples/private_network_examples.rb +86 -0
- data/examples/public_ip_examples.rb +42 -0
- data/examples/role_examples.rb +113 -0
- data/examples/server_appliance_examples.rb +15 -0
- data/examples/server_examples.rb +438 -0
- data/examples/shared_storage_examples.rb +108 -0
- data/examples/usage_examples.rb +6 -0
- data/examples/user_examples.rb +113 -0
- data/examples/vpn_examples.rb +56 -0
- data/lib/1and1/datacenter.rb +73 -0
- data/lib/1and1/dvd.rb +73 -0
- data/lib/1and1/firewall.rb +427 -0
- data/lib/1and1/image.rb +231 -0
- data/lib/1and1/load_balancer.rb +448 -0
- data/lib/1and1/log.rb +77 -0
- data/lib/1and1/monitoring_center.rb +84 -0
- data/lib/1and1/monitoring_policy.rb +598 -0
- data/lib/1and1/oneandone.rb +57 -0
- data/lib/1and1/ping.rb +41 -0
- data/lib/1and1/ping_auth.rb +41 -0
- data/lib/1and1/pricing.rb +41 -0
- data/lib/1and1/private_network.rb +333 -0
- data/lib/1and1/public_ip.rb +192 -0
- data/lib/1and1/role.rb +381 -0
- data/lib/1and1/server.rb +1208 -0
- data/lib/1and1/server_appliance.rb +73 -0
- data/lib/1and1/shared_storage.rb +379 -0
- data/lib/1and1/usage.rb +58 -0
- data/lib/1and1/user.rb +374 -0
- data/lib/1and1/vpn.rb +249 -0
- data/lib/oneandone.rb +27 -0
- data/sphinx/Makefile +192 -0
- data/sphinx/_build/doctrees/dvds.doctree +0 -0
- data/sphinx/_build/doctrees/environment.pickle +0 -0
- data/sphinx/_build/doctrees/firewalls.doctree +0 -0
- data/sphinx/_build/doctrees/images.doctree +0 -0
- data/sphinx/_build/doctrees/index.doctree +0 -0
- data/sphinx/_build/doctrees/load_balancers.doctree +0 -0
- data/sphinx/_build/doctrees/logs.doctree +0 -0
- data/sphinx/_build/doctrees/monitoring_center.doctree +0 -0
- data/sphinx/_build/doctrees/monitoring_policies.doctree +0 -0
- data/sphinx/_build/doctrees/private_networks.doctree +0 -0
- data/sphinx/_build/doctrees/public_ips.doctree +0 -0
- data/sphinx/_build/doctrees/server_appliances.doctree +0 -0
- data/sphinx/_build/doctrees/servers.doctree +0 -0
- data/sphinx/_build/doctrees/shared_storages.doctree +0 -0
- data/sphinx/_build/doctrees/usages.doctree +0 -0
- data/sphinx/_build/doctrees/users.doctree +0 -0
- data/sphinx/_build/html/.buildinfo +4 -0
- data/sphinx/_build/html/_sources/dvds.txt +42 -0
- data/sphinx/_build/html/_sources/firewalls.txt +189 -0
- data/sphinx/_build/html/_sources/images.txt +101 -0
- data/sphinx/_build/html/_sources/index.txt +499 -0
- data/sphinx/_build/html/_sources/load_balancers.txt +231 -0
- data/sphinx/_build/html/_sources/logs.txt +55 -0
- data/sphinx/_build/html/_sources/monitoring_center.txt +55 -0
- data/sphinx/_build/html/_sources/monitoring_policies.txt +288 -0
- data/sphinx/_build/html/_sources/private_networks.txt +146 -0
- data/sphinx/_build/html/_sources/public_ips.txt +78 -0
- data/sphinx/_build/html/_sources/server_appliances.txt +42 -0
- data/sphinx/_build/html/_sources/servers.txt +630 -0
- data/sphinx/_build/html/_sources/shared_storages.txt +160 -0
- data/sphinx/_build/html/_sources/usages.txt +45 -0
- data/sphinx/_build/html/_sources/users.txt +172 -0
- data/sphinx/_build/html/_static/ajax-loader.gif +0 -0
- data/sphinx/_build/html/_static/alabaster.css +585 -0
- data/sphinx/_build/html/_static/basic.css +599 -0
- data/sphinx/_build/html/_static/comment-bright.png +0 -0
- data/sphinx/_build/html/_static/comment-close.png +0 -0
- data/sphinx/_build/html/_static/comment.png +0 -0
- data/sphinx/_build/html/_static/doctools.js +263 -0
- data/sphinx/_build/html/_static/down-pressed.png +0 -0
- data/sphinx/_build/html/_static/down.png +0 -0
- data/sphinx/_build/html/_static/file.png +0 -0
- data/sphinx/_build/html/_static/jquery-1.11.1.js +10308 -0
- data/sphinx/_build/html/_static/jquery.js +4 -0
- data/sphinx/_build/html/_static/minus.png +0 -0
- data/sphinx/_build/html/_static/plus.png +0 -0
- data/sphinx/_build/html/_static/pygments.css +63 -0
- data/sphinx/_build/html/_static/searchtools.js +651 -0
- data/sphinx/_build/html/_static/underscore-1.3.1.js +999 -0
- data/sphinx/_build/html/_static/underscore.js +31 -0
- data/sphinx/_build/html/_static/up-pressed.png +0 -0
- data/sphinx/_build/html/_static/up.png +0 -0
- data/sphinx/_build/html/_static/websupport.js +808 -0
- data/sphinx/_build/html/dvds.html +151 -0
- data/sphinx/_build/html/firewalls.html +397 -0
- data/sphinx/_build/html/genindex.html +114 -0
- data/sphinx/_build/html/images.html +236 -0
- data/sphinx/_build/html/index.html +571 -0
- data/sphinx/_build/html/load_balancers.html +409 -0
- data/sphinx/_build/html/logs.html +160 -0
- data/sphinx/_build/html/monitoring_center.html +160 -0
- data/sphinx/_build/html/monitoring_policies.html +530 -0
- data/sphinx/_build/html/objects.inv +0 -0
- data/sphinx/_build/html/private_networks.html +316 -0
- data/sphinx/_build/html/public_ips.html +215 -0
- data/sphinx/_build/html/rb-modindex.html +106 -0
- data/sphinx/_build/html/search.html +99 -0
- data/sphinx/_build/html/searchindex.js +1 -0
- data/sphinx/_build/html/server_appliances.html +153 -0
- data/sphinx/_build/html/servers.html +994 -0
- data/sphinx/_build/html/shared_storages.html +349 -0
- data/sphinx/_build/html/usages.html +140 -0
- data/sphinx/_build/html/users.html +363 -0
- data/sphinx/conf.py +287 -0
- data/sphinx/dvds.rst +42 -0
- data/sphinx/firewalls.rst +189 -0
- data/sphinx/images.rst +101 -0
- data/sphinx/index.rst +499 -0
- data/sphinx/load_balancers.rst +231 -0
- data/sphinx/logs.rst +55 -0
- data/sphinx/make.bat +263 -0
- data/sphinx/monitoring_center.rst +55 -0
- data/sphinx/monitoring_policies.rst +288 -0
- data/sphinx/private_networks.rst +146 -0
- data/sphinx/public_ips.rst +78 -0
- data/sphinx/server_appliances.rst +42 -0
- data/sphinx/servers.rst +630 -0
- data/sphinx/shared_storages.rst +160 -0
- data/sphinx/usages.rst +45 -0
- data/sphinx/users.rst +172 -0
- data/test/mock-api/add-firewall.json +66 -0
- data/test/mock-api/add-hdd.json +49 -0
- data/test/mock-api/add-lb.json +71 -0
- data/test/mock-api/add-new-ip.json +18 -0
- data/test/mock-api/add-pn.json +66 -0
- data/test/mock-api/add-port-mp.json +81 -0
- data/test/mock-api/add-process-mp.json +20 -0
- data/test/mock-api/add-rule-fp.json +33 -0
- data/test/mock-api/add-rule-lb.json +40 -0
- data/test/mock-api/add-server-ip.json +66 -0
- data/test/mock-api/add-server-mp.json +66 -0
- data/test/mock-api/assign-ip-fp.json +32 -0
- data/test/mock-api/assign-server-lb.json +39 -0
- data/test/mock-api/attach-server-pn.json +14 -0
- data/test/mock-api/attach-server-storage.json +24 -0
- data/test/mock-api/change-api-key.json +15 -0
- data/test/mock-api/change-password.json +5 -0
- data/test/mock-api/change-server-status.json +70 -0
- data/test/mock-api/clone-server.json +29 -0
- data/test/mock-api/create-fp.json +26 -0
- data/test/mock-api/create-image.json +30 -0
- data/test/mock-api/create-lb.json +33 -0
- data/test/mock-api/create-mp.json +81 -0
- data/test/mock-api/create-pn.json +11 -0
- data/test/mock-api/create-public-ip.json +10 -0
- data/test/mock-api/create-server.json +34 -0
- data/test/mock-api/create-snapshot.json +74 -0
- data/test/mock-api/create-storage.json +13 -0
- data/test/mock-api/create-user.json +14 -0
- data/test/mock-api/delete-fp.json +26 -0
- data/test/mock-api/delete-image.json +26 -0
- data/test/mock-api/delete-ip.json +15 -0
- data/test/mock-api/delete-lb.json +33 -0
- data/test/mock-api/delete-mp.json +71 -0
- data/test/mock-api/delete-pn.json +11 -0
- data/test/mock-api/delete-public-ip.json +10 -0
- data/test/mock-api/delete-rule-fp.json +26 -0
- data/test/mock-api/delete-server.json +50 -0
- data/test/mock-api/delete-snapshot.json +74 -0
- data/test/mock-api/delete-storage.json +24 -0
- data/test/mock-api/delete-user.json +15 -0
- data/test/mock-api/detach-server-lb.json +33 -0
- data/test/mock-api/detach-server-mp.json +65 -0
- data/test/mock-api/detach-server-storage.json +19 -0
- data/test/mock-api/edit-image.json +26 -0
- data/test/mock-api/eject-dvd.json +66 -0
- data/test/mock-api/fixed-server-flavors.json +70 -0
- data/test/mock-api/get-appliance.json +16 -0
- data/test/mock-api/get-dvd.json +9 -0
- data/test/mock-api/get-firewall.json +26 -0
- data/test/mock-api/get-fixed-server.json +17 -0
- data/test/mock-api/get-fp-rule.json +7 -0
- data/test/mock-api/get-hardware.json +13 -0
- data/test/mock-api/get-hdd.json +5 -0
- data/test/mock-api/get-image.json +26 -0
- data/test/mock-api/get-lb-rule.json +7 -0
- data/test/mock-api/get-lb-server.json +5 -0
- data/test/mock-api/get-load-balancer.json +33 -0
- data/test/mock-api/get-log.json +23 -0
- data/test/mock-api/get-monitoring-center.json +161 -0
- data/test/mock-api/get-mp-port.json +7 -0
- data/test/mock-api/get-mp-process.json +6 -0
- data/test/mock-api/get-mp-server.json +4 -0
- data/test/mock-api/get-mp.json +65 -0
- data/test/mock-api/get-pn-server.json +4 -0
- data/test/mock-api/get-private-network.json +20 -0
- data/test/mock-api/get-public-ip.json +10 -0
- data/test/mock-api/get-server-dvd.json +4 -0
- data/test/mock-api/get-server-image.json +4 -0
- data/test/mock-api/get-server-ip-fp.json +4 -0
- data/test/mock-api/get-server-ip.json +8 -0
- data/test/mock-api/get-server-pn.json +16 -0
- data/test/mock-api/get-server-status.json +4 -0
- data/test/mock-api/get-server-storage.json +5 -0
- data/test/mock-api/get-server.json +44 -0
- data/test/mock-api/get-storage.json +19 -0
- data/test/mock-api/get-usage.json +161 -0
- data/test/mock-api/get-user-api-key.json +3 -0
- data/test/mock-api/get-user-api.json +7 -0
- data/test/mock-api/get-user.json +15 -0
- data/test/mock-api/list-appliances.json +66 -0
- data/test/mock-api/list-credentials.json +5 -0
- data/test/mock-api/list-dvds.json +128 -0
- data/test/mock-api/list-firewalls.json +54 -0
- data/test/mock-api/list-fp-rules.json +16 -0
- data/test/mock-api/list-hdds.json +7 -0
- data/test/mock-api/list-images.json +54 -0
- data/test/mock-api/list-lb-rules.json +16 -0
- data/test/mock-api/list-lb-servers.json +12 -0
- data/test/mock-api/list-load-balancers.json +68 -0
- data/test/mock-api/list-logs.json +49 -0
- data/test/mock-api/list-monitoring-center-usages.json +90 -0
- data/test/mock-api/list-mp-ports.json +16 -0
- data/test/mock-api/list-mp-processes.json +14 -0
- data/test/mock-api/list-mp-servers.json +10 -0
- data/test/mock-api/list-mps.json +152 -0
- data/test/mock-api/list-pn-servers.json +10 -0
- data/test/mock-api/list-private-networks.json +24 -0
- data/test/mock-api/list-public-ips.json +44 -0
- data/test/mock-api/list-server-fps.json +4 -0
- data/test/mock-api/list-server-ips-fp.json +7 -0
- data/test/mock-api/list-server-ips.json +10 -0
- data/test/mock-api/list-server-lbs.json +6 -0
- data/test/mock-api/list-server-pns.json +6 -0
- data/test/mock-api/list-servers.json +66 -0
- data/test/mock-api/list-snapshots.json +7 -0
- data/test/mock-api/list-storages.json +47 -0
- data/test/mock-api/list-usages.json +144 -0
- data/test/mock-api/list-user-ips.json +5 -0
- data/test/mock-api/list-users.json +31 -0
- data/test/mock-api/load-dvd.json +63 -0
- data/test/mock-api/modify-fp.json +26 -0
- data/test/mock-api/modify-lb.json +33 -0
- data/test/mock-api/modify-mp.json +81 -0
- data/test/mock-api/modify-pn.json +20 -0
- data/test/mock-api/modify-port-mp.json +81 -0
- data/test/mock-api/modify-process-mp.json +73 -0
- data/test/mock-api/modify-public-ip.json +10 -0
- data/test/mock-api/modify-server-hardware.json +44 -0
- data/test/mock-api/modify-server-hdd.json +54 -0
- data/test/mock-api/modify-server.json +44 -0
- data/test/mock-api/modify-storage.json +19 -0
- data/test/mock-api/modify-user-api.json +15 -0
- data/test/mock-api/modify-user.json +15 -0
- data/test/mock-api/reinstall-image.json +52 -0
- data/test/mock-api/remove-firewall-policy.json +26 -0
- data/test/mock-api/remove-hdd.json +54 -0
- data/test/mock-api/remove-ip-fp.json +26 -0
- data/test/mock-api/remove-lb.json +66 -0
- data/test/mock-api/remove-pn.json +71 -0
- data/test/mock-api/remove-port-mp.json +73 -0
- data/test/mock-api/remove-process-mp.json +66 -0
- data/test/mock-api/remove-rule-lb.json +33 -0
- data/test/mock-api/remove-server-ip.json +58 -0
- data/test/mock-api/remove-server-pn.json +16 -0
- data/test/mock-api/restore-snapshot.json +55 -0
- data/test/mock-api/storage-servers.json +12 -0
- data/test/test_mock_dvd.rb +55 -0
- data/test/test_mock_firewall.rb +309 -0
- data/test/test_mock_image.rb +123 -0
- data/test/test_mock_load_balancer.rb +312 -0
- data/test/test_mock_log.rb +55 -0
- data/test/test_mock_monitoring_center.rb +55 -0
- data/test/test_mock_monitoring_policy.rb +587 -0
- data/test/test_mock_private_network.rb +206 -0
- data/test/test_mock_public_ip.rb +118 -0
- data/test/test_mock_server.rb +929 -0
- data/test/test_mock_server_appliance.rb +55 -0
- data/test/test_mock_shared_storage.rb +256 -0
- data/test/test_mock_usage.rb +34 -0
- data/test/test_mock_user.rb +270 -0
- metadata +360 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
# List all logs by time period
|
2
|
+
log = OneAndOne::Log.new()
|
3
|
+
|
4
|
+
response = log.list(period: 'LAST_24H')
|
5
|
+
|
6
|
+
puts JSON.pretty_generate(response)
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# Returns information about a log
|
11
|
+
log = OneAndOne::Log.new()
|
12
|
+
|
13
|
+
response = log.get(log_id: '<LOG-ID>')
|
14
|
+
|
15
|
+
puts JSON.pretty_generate(response)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# List all usages and alerts of monitoring servers
|
2
|
+
monitoring_center = OneAndOne::MonitoringCenter.new()
|
3
|
+
|
4
|
+
response = monitoring_center.list
|
5
|
+
|
6
|
+
puts JSON.pretty_generate(response)
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# Returns the usage of the resources for the specified time range
|
11
|
+
monitoring_center = OneAndOne::MonitoringCenter.new()
|
12
|
+
|
13
|
+
response = monitoring_center.get(server_id: '<SERVER-ID>', period: 'LAST_24H')
|
14
|
+
|
15
|
+
puts JSON.pretty_generate(response)
|
@@ -0,0 +1,343 @@
|
|
1
|
+
# List all monitoring policies on your account
|
2
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
3
|
+
|
4
|
+
response = monitoring_policy.list
|
5
|
+
|
6
|
+
puts JSON.pretty_generate(response)
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# Create a monitoring policy
|
11
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
12
|
+
|
13
|
+
### Create threshold limits
|
14
|
+
thresholds = {
|
15
|
+
'cpu' => {
|
16
|
+
'warning' => {
|
17
|
+
'value' => 90,
|
18
|
+
'alert' => false
|
19
|
+
},
|
20
|
+
'critical' => {
|
21
|
+
'value' => 95,
|
22
|
+
'alert' => false
|
23
|
+
}
|
24
|
+
},
|
25
|
+
'ram' => {
|
26
|
+
'warning' => {
|
27
|
+
'value' => 90,
|
28
|
+
'alert' => false
|
29
|
+
},
|
30
|
+
'critical' => {
|
31
|
+
'value' => 95,
|
32
|
+
'alert' => false
|
33
|
+
}
|
34
|
+
},
|
35
|
+
'disk' => {
|
36
|
+
'warning' => {
|
37
|
+
'value' => 90,
|
38
|
+
'alert' => false
|
39
|
+
},
|
40
|
+
'critical' => {
|
41
|
+
'value' => 95,
|
42
|
+
'alert' => false
|
43
|
+
}
|
44
|
+
},
|
45
|
+
'transfer' => {
|
46
|
+
'warning' => {
|
47
|
+
'value' => 1000,
|
48
|
+
'alert' => false
|
49
|
+
},
|
50
|
+
'critical' => {
|
51
|
+
'value' => 2000,
|
52
|
+
'alert' => false
|
53
|
+
}
|
54
|
+
},
|
55
|
+
'internal_ping' => {
|
56
|
+
'warning' => {
|
57
|
+
'value' => 50,
|
58
|
+
'alert' => false
|
59
|
+
},
|
60
|
+
'critical' => {
|
61
|
+
'value' => 100,
|
62
|
+
'alert' => false
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
### Add ports
|
68
|
+
port1 = {
|
69
|
+
'protocol' => 'TCP',
|
70
|
+
'port' => 80,
|
71
|
+
'alert_if' => 'NOT_RESPONDING',
|
72
|
+
'email_notification' => true
|
73
|
+
}
|
74
|
+
|
75
|
+
ports = [port1]
|
76
|
+
|
77
|
+
### Add processes
|
78
|
+
process1 = {
|
79
|
+
'process' => 'test',
|
80
|
+
'alert_if' => 'NOT_RUNNING',
|
81
|
+
'email_notification' => true
|
82
|
+
}
|
83
|
+
|
84
|
+
processes = [process1]
|
85
|
+
|
86
|
+
response = monitoring_policy.create(name: 'Test Monitoring Policy',
|
87
|
+
email: 'test@example.com', agent: true, thresholds: thresholds, ports: ports,
|
88
|
+
processes: processes)
|
89
|
+
|
90
|
+
puts JSON.pretty_generate(response)
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
# Returns a monitoring policy's current specs
|
95
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
96
|
+
|
97
|
+
response = monitoring_policy.get(monitoring_policy_id: '<MONITORING-POLICY-ID>')
|
98
|
+
|
99
|
+
puts JSON.pretty_generate(response)
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
# Modify a monitoring policy and its thresholds
|
104
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new
|
105
|
+
|
106
|
+
new_thresholds = {
|
107
|
+
'cpu' => {
|
108
|
+
'warning' => {
|
109
|
+
'value' => 80,
|
110
|
+
'alert' => false
|
111
|
+
},
|
112
|
+
'critical' => {
|
113
|
+
'value' => 85,
|
114
|
+
'alert' => false
|
115
|
+
}
|
116
|
+
},
|
117
|
+
'ram' => {
|
118
|
+
'warning' => {
|
119
|
+
'value' => 80,
|
120
|
+
'alert' => false
|
121
|
+
},
|
122
|
+
'critical' => {
|
123
|
+
'value' => 85,
|
124
|
+
'alert' => false
|
125
|
+
}
|
126
|
+
},
|
127
|
+
'disk' => {
|
128
|
+
'warning' => {
|
129
|
+
'value' => 80,
|
130
|
+
'alert' => false
|
131
|
+
},
|
132
|
+
'critical' => {
|
133
|
+
'value' => 85,
|
134
|
+
'alert' => false
|
135
|
+
}
|
136
|
+
},
|
137
|
+
'transfer' => {
|
138
|
+
'warning' => {
|
139
|
+
'value' => 750,
|
140
|
+
'alert' => false
|
141
|
+
},
|
142
|
+
'critical' => {
|
143
|
+
'value' => 1250,
|
144
|
+
'alert' => false
|
145
|
+
}
|
146
|
+
},
|
147
|
+
'internal_ping' => {
|
148
|
+
'warning' => {
|
149
|
+
'value' => 75,
|
150
|
+
'alert' => true
|
151
|
+
},
|
152
|
+
'critical' => {
|
153
|
+
'value' => 90,
|
154
|
+
'alert' => true
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
response = monitoring_policy.modify(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
160
|
+
name: 'New Name', thresholds: new_thresholds)
|
161
|
+
|
162
|
+
puts JSON.pretty_generate(response)
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
# Delete a monitoring policy
|
167
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
168
|
+
|
169
|
+
response = monitoring_policy.delete(monitoring_policy_id: '<MONITORING-POLICY-ID>')
|
170
|
+
|
171
|
+
puts JSON.pretty_generate(response)
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
# List a monitoring policy's ports
|
176
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
177
|
+
|
178
|
+
response = monitoring_policy.ports(monitoring_policy_id: '<MONITORING-POLICY-ID>')
|
179
|
+
|
180
|
+
puts JSON.pretty_generate(response)
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
# Add ports to a monitoring policy
|
185
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
186
|
+
|
187
|
+
port2 = {
|
188
|
+
'protocol' => 'TCP',
|
189
|
+
'port' => 90,
|
190
|
+
'alert_if' => 'NOT_RESPONDING',
|
191
|
+
'email_notification' => true
|
192
|
+
}
|
193
|
+
|
194
|
+
ports = [port2]
|
195
|
+
|
196
|
+
response = monitoring_policy.add_ports(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
197
|
+
ports: ports)
|
198
|
+
|
199
|
+
puts JSON.pretty_generate(response)
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
# Returns information about a monitoring policy's port
|
204
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
205
|
+
|
206
|
+
response = monitoring_policy.port(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
207
|
+
port_id: '<PORT-ID>')
|
208
|
+
|
209
|
+
puts JSON.pretty_generate(response)
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
# Delete a monitoring policy's port
|
214
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
215
|
+
|
216
|
+
response = monitoring_policy.delete_port(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
217
|
+
port_id: '<PORT-ID>')
|
218
|
+
|
219
|
+
puts JSON.pretty_generate(response)
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
# Modify a monitoring policy's port
|
224
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
225
|
+
|
226
|
+
port = {
|
227
|
+
'protocol' => 'TCP',
|
228
|
+
'port' => 80,
|
229
|
+
'alert_if' => 'RESPONDING',
|
230
|
+
'email_notification' => false
|
231
|
+
}
|
232
|
+
|
233
|
+
response = monitoring_policy.modify_port(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
234
|
+
port_id: '<PORT-ID>', new_port: port)
|
235
|
+
|
236
|
+
puts JSON.pretty_generate(response)
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
# List a monitoring policy's processes
|
241
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
242
|
+
|
243
|
+
response = monitoring_policy.processes(monitoring_policy_id: '<MONITORING-POLICY-ID>')
|
244
|
+
|
245
|
+
puts JSON.pretty_generate(response)
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
# Returns information about a monitoring policy's process
|
250
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
251
|
+
|
252
|
+
response = monitoring_policy.process(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
253
|
+
process_id: '<PROCESS-ID>')
|
254
|
+
|
255
|
+
puts JSON.pretty_generate(response)
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
# Add processes to a monitoring policy
|
261
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
262
|
+
|
263
|
+
process2 = {
|
264
|
+
'process' => 'logger',
|
265
|
+
'alert_if' => 'NOT_RUNNING',
|
266
|
+
'email_notification' => true
|
267
|
+
}
|
268
|
+
|
269
|
+
processes = [process2]
|
270
|
+
|
271
|
+
response = monitoring_policy.add_processes(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
272
|
+
processes: processes)
|
273
|
+
|
274
|
+
puts JSON.pretty_generate(response)
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
# Modify a monitoring policy's process
|
279
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
280
|
+
|
281
|
+
process = {
|
282
|
+
'process' => 'test',
|
283
|
+
'alert_if' => 'RUNNING',
|
284
|
+
'email_notification' => false
|
285
|
+
}
|
286
|
+
|
287
|
+
response = monitoring_policy.modify_process(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
288
|
+
process_id: '<PROCESS-ID>', new_process: process)
|
289
|
+
|
290
|
+
puts JSON.pretty_generate(response)
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
# Delete a monitoring policy's process
|
295
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
296
|
+
|
297
|
+
response = monitoring_policy.delete_process(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
298
|
+
process_id: '<PROCESS-ID>')
|
299
|
+
|
300
|
+
puts JSON.pretty_generate(response)
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
# List a monitoring policy's servers
|
305
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
306
|
+
|
307
|
+
response = monitoring_policy.servers(monitoring_policy_id: '<MONITORING-POLICY-ID>')
|
308
|
+
|
309
|
+
puts JSON.pretty_generate(response)
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
# Returns information about a monitoring policy's server
|
314
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
315
|
+
|
316
|
+
response = monitoring_policy.server(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
317
|
+
server_id: '<SERVER-ID>')
|
318
|
+
|
319
|
+
puts JSON.pretty_generate(response)
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
# Add servers to a monitoring policy
|
324
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
325
|
+
|
326
|
+
server1 = '<SERVER-ID>'
|
327
|
+
|
328
|
+
servers = [server1]
|
329
|
+
|
330
|
+
response = monitoring_policy.add_servers(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
331
|
+
servers: servers)
|
332
|
+
|
333
|
+
puts JSON.pretty_generate(response)
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
# Remove a monitoring policy's server
|
338
|
+
monitoring_policy = OneAndOne::MonitoringPolicy.new()
|
339
|
+
|
340
|
+
response = monitoring_policy.remove_server(monitoring_policy_id: '<MONITORING-POLICY-ID>',
|
341
|
+
server_id: '<SERVER-ID>')
|
342
|
+
|
343
|
+
puts JSON.pretty_generate(response)
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# List all private networks on your account
|
2
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
3
|
+
|
4
|
+
response = private_network.list
|
5
|
+
|
6
|
+
puts JSON.pretty_generate(response)
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# Create a private network
|
11
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
12
|
+
|
13
|
+
response = private_network.create(name: 'Test PN')
|
14
|
+
|
15
|
+
puts JSON.pretty_generate(response)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
# Returns a private network's current specs
|
20
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
21
|
+
|
22
|
+
response = private_network.get(private_network_id: '<PRIVATE-NETWORK-ID>')
|
23
|
+
|
24
|
+
puts JSON.pretty_generate(response)
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
# Modify a private network
|
29
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
30
|
+
|
31
|
+
response = private_network.modify(private_network_id: '<PRIVATE-NETWORK-ID>',
|
32
|
+
name: 'New PN Name')
|
33
|
+
|
34
|
+
puts JSON.pretty_generate(response)
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
# Delete a private network
|
39
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
40
|
+
|
41
|
+
response = private_network.delete(private_network_id: '<PRIVATE-NETWORK-ID>')
|
42
|
+
|
43
|
+
puts JSON.pretty_generate(response)
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
# List a private network's servers
|
48
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
49
|
+
|
50
|
+
response = private_network.servers(private_network_id: '<PRIVATE-NETWORK-ID>')
|
51
|
+
|
52
|
+
puts JSON.pretty_generate(response)
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
# Returns information about a private network's server
|
57
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
58
|
+
|
59
|
+
response = private_network.server(private_network_id: '<PRIVATE-NETWORK-ID>',
|
60
|
+
server_id: '<SERVER-ID>')
|
61
|
+
|
62
|
+
puts JSON.pretty_generate(response)
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
# Remove a private network's server
|
67
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
68
|
+
|
69
|
+
response = private_network.remove_server(private_network_id: '<PRIVATE-NETWORK-ID>',
|
70
|
+
server_id: '<SERVER-ID>')
|
71
|
+
|
72
|
+
puts JSON.pretty_generate(response)
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
# Add servers to a private network
|
77
|
+
private_network = OneAndOne::PrivateNetwork.new()
|
78
|
+
|
79
|
+
server1 = '<SERVER-ID>'
|
80
|
+
|
81
|
+
servers = [server1]
|
82
|
+
|
83
|
+
response = private_network.add_servers(private_network_id: '<PRIVATE-NETWORK-ID>',
|
84
|
+
servers: servers)
|
85
|
+
|
86
|
+
puts JSON.pretty_generate(response)
|