Module: Fog::Vcloud::Terremark::Ecloud::Shared
- Defined in:
- lib/fog/vcloud/terremark/ecloud.rb,
lib/fog/vcloud/terremark/ecloud/requests/add_node.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb,
lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb,
lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb,
lib/fog/vcloud/terremark/ecloud/requests/add_backup_internet_service.rb
Instance Method Summary collapse
- #ecloud_xmlns ⇒ Object
- #validate_backup_internet_service_data(service_data, configure = false) ⇒ Object
- #validate_internet_service_data(service_data, configure = false) ⇒ Object
- #validate_internet_service_monitor(monitor) ⇒ Object
Instance Method Details
#ecloud_xmlns ⇒ Object
72 73 74 75 76 77 |
# File 'lib/fog/vcloud/terremark/ecloud.rb', line 72 def ecloud_xmlns { "xmlns" => "urn:tmrk:eCloudExtensions-2.6", "xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance" } end |
#validate_backup_internet_service_data(service_data, configure = false) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/vcloud/terremark/ecloud/requests/add_backup_internet_service.rb', line 6 def validate_backup_internet_service_data(service_data, configure=false) required_opts = [:name, :protocol, :description, :enabled] if configure required_opts + [ :id, :href, :timeout ] end unless required_opts.all? { |opt| service_data.keys.include?(opt) } raise ArgumentError.new("Required Backup Internet Service data missing: #{(required_opts - service_data.keys).map(&:inspect).join(", ")}") end end |
#validate_internet_service_data(service_data, configure = false) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb', line 27 def validate_internet_service_data(service_data, configure=false) required_opts = [:name, :protocol, :port, :description, :enabled] if configure required_opts + [ :id, :href, :timeout ] end unless required_opts.all? { |opt| service_data.keys.include?(opt) } raise ArgumentError.new("Required Internet Service data missing: #{(required_opts - service_data.keys).map(&:inspect).join(", ")}") end end |
#validate_internet_service_monitor(monitor) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb', line 6 def validate_internet_service_monitor(monitor) #FIXME: Refactor this type of function into something generic required_opts = [:type, :url_send_string, :http_headers, :receive_string, :is_enabled] unless required_opts.all? { |opt| monitor.keys.include?(opt) && monitor[opt] } raise ArgumentError.new("Required Monitor data missing: #{(required_opts - monitor.keys).map(&:inspect).join(", ")}") end unless ['HTTP','ECV'].include?(monitor[:type]) raise ArgumentError.new("Supported monitor types are: ECV & HTTP") end unless monitor[:http_headers].is_a?(Array) || monitor[:http_headers].is_a?(String) raise ArgumentError.new("Monitor :http_headers must be a String or Array") end unless [true, false, "true", "false"].include?(monitor[:is_enabled]) raise ArgumentError.new("Monitor :is_enabled must be true or false") end end |