Module: Fog::Compute::Ecloud::Shared
- Defined in:
- lib/fog/ecloud/compute.rb,
lib/fog/ecloud/requests/compute/add_node.rb,
lib/fog/ecloud/requests/compute/configure_node.rb,
lib/fog/ecloud/requests/compute/configure_vapp.rb,
lib/fog/ecloud/requests/compute/add_internet_service.rb,
lib/fog/ecloud/requests/compute/configure_network_ip.rb,
lib/fog/ecloud/requests/compute/instantiate_vapp_template.rb,
lib/fog/ecloud/requests/compute/configure_internet_service.rb,
lib/fog/ecloud/requests/compute/add_backup_internet_service.rb
Instance Attribute Summary collapse
-
#versions_uri ⇒ Object
readonly
Returns the value of attribute versions_uri.
Instance Method Summary collapse
- #default_organization_uri ⇒ Object
-
#do_login ⇒ Object
login handles the auth, but we just need the Set-Cookie header from that call.
- #ecloud_xmlns ⇒ Object
- #ensure_monitor_defaults!(monitor) ⇒ Object
- #ensure_unparsed(uri) ⇒ Object
- #supported_versions ⇒ 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
- #xmlns ⇒ Object
Instance Attribute Details
#versions_uri ⇒ Object (readonly)
Returns the value of attribute versions_uri.
897 898 899 |
# File 'lib/fog/ecloud/compute.rb', line 897 def versions_uri @versions_uri end |
Instance Method Details
#default_organization_uri ⇒ Object
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 |
# File 'lib/fog/ecloud/compute.rb', line 899 def default_organization_uri @default_organization_uri ||= begin unless @login_results do_login end case @login_results.body[:Org] when Array @login_results.body[:Org].first[:href] when Hash @login_results.body[:Org][:href] else nil end end end |
#do_login ⇒ Object
login handles the auth, but we just need the Set-Cookie header from that call.
917 918 919 920 |
# File 'lib/fog/ecloud/compute.rb', line 917 def do_login @login_results = login @cookie = @login_results.headers['Set-Cookie'] end |
#ecloud_xmlns ⇒ Object
922 923 924 925 926 927 |
# File 'lib/fog/ecloud/compute.rb', line 922 def ecloud_xmlns { "xmlns" => "urn:tmrk:eCloudExtensions-2.6", "xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance" } end |
#ensure_monitor_defaults!(monitor) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/fog/ecloud/requests/compute/add_internet_service.rb', line 44 def ensure_monitor_defaults!(monitor) if monitor[:http_headers].is_a?(String) monitor[:http_headers] = [ monitor[:http_headers] ] end unless monitor[:retries] monitor[:retries] = 3 end unless monitor[:response_timeout] monitor[:response_timeout] = 2 end unless monitor[:down_time] monitor[:down_time] = 30 end unless monitor[:interval] monitor[:interval] = 5 end end |
#ensure_unparsed(uri) ⇒ Object
929 930 931 932 933 934 935 |
# File 'lib/fog/ecloud/compute.rb', line 929 def ensure_unparsed(uri) if uri.is_a?(String) uri else uri.to_s end end |
#supported_versions ⇒ Object
937 938 939 |
# File 'lib/fog/ecloud/compute.rb', line 937 def supported_versions @supported_versions ||= get_versions(@versions_uri).body[:VersionInfo] end |
#validate_backup_internet_service_data(service_data, configure = false) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/fog/ecloud/requests/compute/add_backup_internet_service.rb', line 5 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
34 35 36 37 38 39 40 41 42 |
# File 'lib/fog/ecloud/requests/compute/add_internet_service.rb', line 34 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
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/ecloud/requests/compute/add_internet_service.rb', line 5 def validate_internet_service_monitor(monitor) #FIXME: Refactor this type of function into something generic unless ['Disabled','HTTP','ECV'].include?(monitor[:type]) raise ArgumentError.new("Supported monitor types are: ECV & HTTP") end required_opts = case monitor[:type] when "Disabled" [:type, :is_enabled] else [:type, :url_send_string, :http_headers, :receive_string, :is_enabled] end 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 case monitor[:type] when "HTTP", "ECV" 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 end unless [true, false, "true", "false"].include?(monitor[:is_enabled]) raise ArgumentError.new("Monitor :is_enabled must be true or false") end end |
#xmlns ⇒ Object
941 942 943 944 945 |
# File 'lib/fog/ecloud/compute.rb', line 941 def xmlns { "xmlns" => "http://www.vmware.com/vcloud/v0.8", "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" } end |