fog-storm_on_demand 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +17 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +15 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +38 -0
- data/Rakefile +11 -0
- data/fog-storm_on_demand.gemspec +34 -0
- data/gemfiles/Gemfile.1.9.2- +8 -0
- data/gemfiles/Gemfile.1.9.3+ +7 -0
- data/lib/fog/account/storm_on_demand.rb +51 -0
- data/lib/fog/account/storm_on_demand/models/token.rb +14 -0
- data/lib/fog/account/storm_on_demand/models/tokens.rb +14 -0
- data/lib/fog/account/storm_on_demand/requests/create_token.rb +14 -0
- data/lib/fog/account/storm_on_demand/requests/expire_token.rb +14 -0
- data/lib/fog/billing/storm_on_demand.rb +57 -0
- data/lib/fog/billing/storm_on_demand/models/invoice.rb +19 -0
- data/lib/fog/billing/storm_on_demand/models/invoices.rb +24 -0
- data/lib/fog/billing/storm_on_demand/models/payment.rb +8 -0
- data/lib/fog/billing/storm_on_demand/models/payments.rb +14 -0
- data/lib/fog/billing/storm_on_demand/requests/get_invoice.rb +14 -0
- data/lib/fog/billing/storm_on_demand/requests/list_invoices.rb +14 -0
- data/lib/fog/billing/storm_on_demand/requests/make_payment.rb +14 -0
- data/lib/fog/billing/storm_on_demand/requests/next_invoice.rb +14 -0
- data/lib/fog/bin/storm_on_demand.rb +29 -0
- data/lib/fog/compute/storm_on_demand.rb +115 -0
- data/lib/fog/compute/storm_on_demand/models/config.rb +31 -0
- data/lib/fog/compute/storm_on_demand/models/configs.rb +19 -0
- data/lib/fog/compute/storm_on_demand/models/image.rb +35 -0
- data/lib/fog/compute/storm_on_demand/models/images.rb +24 -0
- data/lib/fog/compute/storm_on_demand/models/notification.rb +25 -0
- data/lib/fog/compute/storm_on_demand/models/notifications.rb +24 -0
- data/lib/fog/compute/storm_on_demand/models/product.rb +31 -0
- data/lib/fog/compute/storm_on_demand/models/products.rb +22 -0
- data/lib/fog/compute/storm_on_demand/models/server.rb +87 -0
- data/lib/fog/compute/storm_on_demand/models/servers.rb +24 -0
- data/lib/fog/compute/storm_on_demand/models/template.rb +20 -0
- data/lib/fog/compute/storm_on_demand/models/templates.rb +19 -0
- data/lib/fog/compute/storm_on_demand/requests/clone_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/create_image.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/create_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/current_notifications.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/delete_image.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/delete_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_config_details.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_image_details.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_notification.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_product.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_product_code.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_product_price.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_product_starting_price.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/get_template_details.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/list_configs.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/list_images.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/list_notifications.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/list_products.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/list_servers.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/list_templates.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/reboot_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/resize_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/resolve_notification.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/restore_image.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/restore_template.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/server_history.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/server_status.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/shutdown_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/start_server.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/update_image.rb +14 -0
- data/lib/fog/compute/storm_on_demand/requests/update_server.rb +14 -0
- data/lib/fog/dns/storm_on_demand.rb +82 -0
- data/lib/fog/dns/storm_on_demand/models/domain.rb +25 -0
- data/lib/fog/dns/storm_on_demand/models/domains.rb +14 -0
- data/lib/fog/dns/storm_on_demand/models/record.rb +55 -0
- data/lib/fog/dns/storm_on_demand/models/records.rb +24 -0
- data/lib/fog/dns/storm_on_demand/models/reverse.rb +8 -0
- data/lib/fog/dns/storm_on_demand/models/reverses.rb +17 -0
- data/lib/fog/dns/storm_on_demand/models/zone.rb +32 -0
- data/lib/fog/dns/storm_on_demand/models/zones.rb +24 -0
- data/lib/fog/dns/storm_on_demand/requests/check_zone_delegation.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/create_record.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/create_record_region.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/create_zone.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/delete_record.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/delete_record_region.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/delete_reverse.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/delete_zone.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/get_record.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/get_zone.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/list_domains.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/list_records.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/list_zones.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/renew_domain.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/update_record.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/update_record_region.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/update_reverse.rb +14 -0
- data/lib/fog/dns/storm_on_demand/requests/update_zone.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand.rb +65 -0
- data/lib/fog/monitoring/storm_on_demand/models/bandwidth.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/models/bandwidths.rb +18 -0
- data/lib/fog/monitoring/storm_on_demand/models/load.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/models/loads.rb +18 -0
- data/lib/fog/monitoring/storm_on_demand/models/monitor_service.rb +13 -0
- data/lib/fog/monitoring/storm_on_demand/models/monitor_services.rb +27 -0
- data/lib/fog/monitoring/storm_on_demand/requests/get_bandwidth_graph.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/requests/get_bandwidth_stats.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/requests/get_load_graph.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/requests/get_load_stats.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/requests/get_service.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/requests/get_service_status.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/requests/monitoring_ips.rb +14 -0
- data/lib/fog/monitoring/storm_on_demand/requests/update_service.rb +14 -0
- data/lib/fog/network/storm_on_demand.rb +115 -0
- data/lib/fog/network/storm_on_demand/models/balancer.rb +50 -0
- data/lib/fog/network/storm_on_demand/models/balancers.rb +37 -0
- data/lib/fog/network/storm_on_demand/models/firewall.rb +12 -0
- data/lib/fog/network/storm_on_demand/models/firewalls.rb +28 -0
- data/lib/fog/network/storm_on_demand/models/network_ip.rb +15 -0
- data/lib/fog/network/storm_on_demand/models/network_ips.rb +43 -0
- data/lib/fog/network/storm_on_demand/models/pool.rb +24 -0
- data/lib/fog/network/storm_on_demand/models/pools.rb +23 -0
- data/lib/fog/network/storm_on_demand/models/private_ip.rb +9 -0
- data/lib/fog/network/storm_on_demand/models/private_ips.rb +33 -0
- data/lib/fog/network/storm_on_demand/models/ruleset.rb +19 -0
- data/lib/fog/network/storm_on_demand/models/rulesets.rb +24 -0
- data/lib/fog/network/storm_on_demand/models/zone.rb +19 -0
- data/lib/fog/network/storm_on_demand/models/zones.rb +19 -0
- data/lib/fog/network/storm_on_demand/requests/add_balancer_node.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/add_balancer_service.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/add_ip_to_server.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/attach_server_to_private_ip.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/check_balancer_available.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/check_server_attached.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/create_balancer.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/create_pool.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/create_ruleset.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/delete_balancer.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/delete_pool.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/detach_server_from_private_ip.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_assignments.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_balancer_details.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_balancer_possible_nodes.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_balancer_strategies.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_firewall.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_firewall_basic_options.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_firewall_rules.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_ip_details.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_pool.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_private_ip.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_ruleset.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/get_zone.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/list_balancers.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/list_ip_public_accounts.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/list_network_ips.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/list_network_public_ips.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/list_private_ips.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/list_rulesets.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/list_zones.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/remove_balancer_node.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/remove_balancer_service.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/remove_ip_from_server.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/request_new_ips.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/set_default_zone.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/update_balancer.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/update_firewall.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/update_pool.rb +14 -0
- data/lib/fog/network/storm_on_demand/requests/update_ruleset.rb +14 -0
- data/lib/fog/storage/storm_on_demand.rb +62 -0
- data/lib/fog/storage/storm_on_demand/models/cluster.rb +11 -0
- data/lib/fog/storage/storm_on_demand/models/clusters.rb +14 -0
- data/lib/fog/storage/storm_on_demand/models/volume.rb +45 -0
- data/lib/fog/storage/storm_on_demand/models/volumes.rb +24 -0
- data/lib/fog/storage/storm_on_demand/requests/attach_volume_to_server.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/create_volume.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/delete_volume.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/detach_volume_from_server.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/get_volume.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/list_clusters.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/list_volumes.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/resize_volume.rb +14 -0
- data/lib/fog/storage/storm_on_demand/requests/update_volume.rb +14 -0
- data/lib/fog/storm_on_demand.rb +57 -0
- data/lib/fog/storm_on_demand/shared.rb +53 -0
- data/lib/fog/storm_on_demand/version.rb +5 -0
- data/lib/fog/support/storm_on_demand.rb +63 -0
- data/lib/fog/support/storm_on_demand/models/alert.rb +10 -0
- data/lib/fog/support/storm_on_demand/models/alerts.rb +14 -0
- data/lib/fog/support/storm_on_demand/models/ticket.rb +64 -0
- data/lib/fog/support/storm_on_demand/models/tickets.rb +27 -0
- data/lib/fog/support/storm_on_demand/requests/add_feedback.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/add_transaction_feedback.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/authenticate.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/close_ticket.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/create_ticket.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/get_active_alert.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/get_ticket_details.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/list_ticket_types.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/list_tickets.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/reopen_ticket.rb +14 -0
- data/lib/fog/support/storm_on_demand/requests/reply_ticket.rb +14 -0
- data/lib/fog/vpn/storm_on_demand.rb +53 -0
- data/lib/fog/vpn/storm_on_demand/models/vpn.rb +22 -0
- data/lib/fog/vpn/storm_on_demand/models/vpns.rb +23 -0
- data/lib/fog/vpn/storm_on_demand/requests/create_vpn.rb +14 -0
- data/lib/fog/vpn/storm_on_demand/requests/get_vpn.rb +14 -0
- data/lib/fog/vpn/storm_on_demand/requests/list_vpn_users.rb +14 -0
- data/lib/fog/vpn/storm_on_demand/requests/update_vpn.rb +14 -0
- data/spec/minitest_helper.rb +31 -0
- metadata +371 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class StormOnDemand < Fog::Service
|
4
|
+
autoload :Cluster, 'fog/storage/storm_on_demand/models/cluster'
|
5
|
+
autoload :Clusters, 'fog/storage/storm_on_demand/models/clusters'
|
6
|
+
autoload :Volume, 'fog/storage/storm_on_demand/models/volume'
|
7
|
+
autoload :Volumes, 'fog/storage/storm_on_demand/models/volumes'
|
8
|
+
|
9
|
+
requires :storm_on_demand_username, :storm_on_demand_password
|
10
|
+
recognizes :storm_on_demand_auth_url
|
11
|
+
|
12
|
+
model_path 'fog/storage/storm_on_demand/models'
|
13
|
+
model :cluster
|
14
|
+
collection :clusters
|
15
|
+
model :volume
|
16
|
+
collection :volumes
|
17
|
+
|
18
|
+
request_path 'fog/storage/storm_on_demand/requests'
|
19
|
+
request :list_clusters
|
20
|
+
request :attach_volume_to_server
|
21
|
+
request :create_volume
|
22
|
+
request :delete_volume
|
23
|
+
request :detach_volume_from_server
|
24
|
+
request :get_volume
|
25
|
+
request :list_volumes
|
26
|
+
request :resize_volume
|
27
|
+
request :update_volume
|
28
|
+
|
29
|
+
class Mock
|
30
|
+
def self.data
|
31
|
+
@data ||= Hash.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.reset
|
35
|
+
@data = nil
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.reset_data(keys=data.keys)
|
39
|
+
for key in [*keys]
|
40
|
+
data.delete(key)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize(options = {})
|
45
|
+
@storm_on_demand_username = options[:storm_on_demand_username]
|
46
|
+
end
|
47
|
+
|
48
|
+
def data
|
49
|
+
self.class.data[@storm_on_demand_username]
|
50
|
+
end
|
51
|
+
|
52
|
+
def reset_data
|
53
|
+
self.class.data.delete(@storm_on_demand_username)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Real
|
58
|
+
include Fog::StormOnDemand::Shared
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class StormOnDemand
|
4
|
+
class Clusters < Fog::Collection
|
5
|
+
model Fog::Storage::StormOnDemand::Cluster
|
6
|
+
|
7
|
+
def all(options = {})
|
8
|
+
data = service.list_clusters(options).body['items']
|
9
|
+
load(data)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class StormOnDemand
|
4
|
+
class Volume < Fog::Model
|
5
|
+
identity :uniq_id
|
6
|
+
attribute :attachedTo
|
7
|
+
attribute :cross_attach
|
8
|
+
attribute :domain
|
9
|
+
attribute :label
|
10
|
+
attribute :size
|
11
|
+
attribute :status
|
12
|
+
attribute :zone
|
13
|
+
|
14
|
+
def attach_to(server_id)
|
15
|
+
requires :identity
|
16
|
+
service.attach_volume_to_server(:uniq_id => identity,
|
17
|
+
:to => server_id).body
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
requires :identity
|
22
|
+
service.delete_volume(:uniq_id => identity)
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def detach_from(server_id)
|
27
|
+
requires :identity
|
28
|
+
service.detach_volume_from_server(:uniq_id => identity,
|
29
|
+
:detach_from => server_id).body
|
30
|
+
end
|
31
|
+
|
32
|
+
def resize(new_size)
|
33
|
+
requires :identity
|
34
|
+
service.resize_volume(:uniq_id => identity,
|
35
|
+
:new_size => new_size).body
|
36
|
+
end
|
37
|
+
|
38
|
+
def update(options = {})
|
39
|
+
requires :identity
|
40
|
+
service.update_volume({:uniq_id => identity}.merge!(options))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class StormOnDemand
|
4
|
+
class Volumes < Fog::Collection
|
5
|
+
model Fog::Storage::StormOnDemand::Volume
|
6
|
+
|
7
|
+
def create(options)
|
8
|
+
vol = service.create_volume(options).body
|
9
|
+
new(vol)
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(uniq_id)
|
13
|
+
vol = service.get_volume(:uniq_id => uniq_id).body
|
14
|
+
new(vol)
|
15
|
+
end
|
16
|
+
|
17
|
+
def all(options = {})
|
18
|
+
vols = service.list_volumes(options).body['items']
|
19
|
+
load(vols)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'fog/storm_on_demand/version'
|
2
|
+
require 'fog/core'
|
3
|
+
require 'fog/json'
|
4
|
+
|
5
|
+
module Fog
|
6
|
+
module StormOnDemand
|
7
|
+
autoload :Shared, 'fog/storm_on_demand/shared'
|
8
|
+
|
9
|
+
extend Fog::Provider
|
10
|
+
|
11
|
+
service(:storm_on_demand, 'Compute')
|
12
|
+
service(:storm_on_demand, 'Network')
|
13
|
+
service(:storm_on_demand, 'Storage')
|
14
|
+
service(:storm_on_demand, 'DNS')
|
15
|
+
service(:storm_on_demand, 'Billing')
|
16
|
+
service(:storm_on_demand, 'Monitoring')
|
17
|
+
service(:storm_on_demand, 'Support')
|
18
|
+
service(:models, 'Account')
|
19
|
+
service(:storm_on_demand, 'VPN')
|
20
|
+
end
|
21
|
+
|
22
|
+
module Account
|
23
|
+
autoload :StormOnDemand, 'fog/account/storm_on_demand'
|
24
|
+
end
|
25
|
+
|
26
|
+
module Billing
|
27
|
+
autoload :StormOnDemand, 'fog/billing/storm_on_demand'
|
28
|
+
end
|
29
|
+
|
30
|
+
module Compute
|
31
|
+
autoload :StormOnDemand, 'fog/compute/storm_on_demand'
|
32
|
+
end
|
33
|
+
|
34
|
+
module DNS
|
35
|
+
autoload :StormOnDemand, 'fog/dns/storm_on_demand'
|
36
|
+
end
|
37
|
+
|
38
|
+
module Monitoring
|
39
|
+
autoload :StormOnDemand, 'fog/monitoring/storm_on_demand'
|
40
|
+
end
|
41
|
+
|
42
|
+
module Network
|
43
|
+
autoload :StormOnDemand, 'fog/network/storm_on_demand'
|
44
|
+
end
|
45
|
+
|
46
|
+
module Storage
|
47
|
+
autoload :StormOnDemand, 'fog/storage/storm_on_demand'
|
48
|
+
end
|
49
|
+
|
50
|
+
module Support
|
51
|
+
autoload :StormOnDemand, 'fog/support/storm_on_demand'
|
52
|
+
end
|
53
|
+
|
54
|
+
module VPN
|
55
|
+
autoload :StormOnDemand, 'fog/vpn/storm_on_demand'
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Fog
|
2
|
+
module StormOnDemand
|
3
|
+
module Shared
|
4
|
+
API_URL = 'https://api.stormondemand.com'
|
5
|
+
API_VERSION = 'v1'
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
uri = URI.parse(options[:storm_on_demand_auth_url] ||= API_URL)
|
9
|
+
@connection_options = options[:connection_options] || {}
|
10
|
+
@host = uri.host
|
11
|
+
@path = uri.path
|
12
|
+
@persistent = options[:persistent] || false
|
13
|
+
@port = uri.port
|
14
|
+
@scheme = uri.scheme
|
15
|
+
@storm_on_demand_username = options[:storm_on_demand_username]
|
16
|
+
@storm_on_demand_password = options[:storm_on_demand_password]
|
17
|
+
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def reload
|
21
|
+
@connection.reset
|
22
|
+
end
|
23
|
+
|
24
|
+
def request(params)
|
25
|
+
begin
|
26
|
+
response = @connection.request(params.merge!({
|
27
|
+
:headers => {
|
28
|
+
'Content-Type' => 'application/json',
|
29
|
+
'Authorization' => 'Basic ' << Base64.encode64("#{@storm_on_demand_username}:#{@storm_on_demand_password}").chomp
|
30
|
+
}.merge!(params[:headers] || {}),
|
31
|
+
:path => "#{@path}/#{API_VERSION}#{params[:path]}",
|
32
|
+
:expects => 200,
|
33
|
+
:method => :post
|
34
|
+
}))
|
35
|
+
rescue Excon::Errors::HTTPStatusError => error
|
36
|
+
raise case error
|
37
|
+
when Excon::Errors::NotFound
|
38
|
+
Fog::StormOnDemand::Compute::NotFound.slurp(error)
|
39
|
+
else
|
40
|
+
error
|
41
|
+
end
|
42
|
+
end
|
43
|
+
unless response.body.empty?
|
44
|
+
response.body = Fog::JSON.decode(response.body)
|
45
|
+
end
|
46
|
+
if response.body.key?('error_class')
|
47
|
+
raise(Fog::Compute::StormOnDemand::Error, response.body.inspect)
|
48
|
+
end
|
49
|
+
response
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|