Sha256: b263021d80b6b7a222cdcfb65e066ed3b1091f5fe56dce9b71ce16cd3dae9c3f

Contents?: true

Size: 1.34 KB

Versions: 17

Compression:

Stored size: 1.34 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

17 entries across 17 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-ecloud-0.0.2 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-ecloud-0.0.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.25.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
nsidc-fog-1.24.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.24.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.11 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.10 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.9 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.8 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.7 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.6 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.23.0 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.4 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.3 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
ns-fog-1.22.2 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb
fog-1.22.1 lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb