Sha256: 7571fc1de525b9fb78cc7ca0388bc633691d6516590fdae65d42668f77754967

Contents?: true

Size: 1.36 KB

Versions: 77

Compression:

Stored size: 1.36 KB

Contents

module Fog
  module Compute
    class Ecloud

      class Real
        include Shared

        def trusted_network_groups_edit(data)
          validate_data([:name], data)
          unless (data[:hosts] || data[:networks])
            raise ArgumentError.new("Required data missing: Either hosts or networks must be present")
          end
          

          request(
            :body => generate_edit_trusted_network_groups_request(data),
            :expects => 202,
            :method => "PUT",
            :headers => {},
            :uri => data[:uri],
            :parse => true
          )
        end

        private

        def generate_edit_trusted_network_groups_request(data)
          xml = Builder::XmlMarkup.new
          xml.TrustedNetworkGroup(:name => data[:name]) do
            if data[:hosts]
              xml.Hosts do
                data[:hosts].each do |ip|
                  xml.IpAddress ip
                end
              end
            end
            if data[:networks]
              xml.Networks do
                data[:networks].each do |network|
                  address, subnet = network.split('/')
                  xml.Network do
                    xml.Address address
                    xml.Size subnet
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end          

Version data entries

77 entries across 77 versions & 12 rubygems

Version Path
fog-1.15.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
gapinc-fog-1.14.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.14.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.13.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
gapinc-fog-1.12.1.2 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
gapinc-fog-1.12.1.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
gapinc-fog-1.12.1a lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
gapinc-fog-1.12.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.12.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.12.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
hpfog-0.0.20 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-nirvanix-1.8.2 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.11.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.11.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-nirvanix-1.8.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.10.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-parser-fix-1.6.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb