Sha256: b2df493c61258018d8f820a2d26d7c5d86e7902f06a67e94bcdedda8e82811b3

Contents?: true

Size: 969 Bytes

Versions: 7

Compression:

Stored size: 969 Bytes

Contents

require 'fog/core/collection'
require 'fog/compute/models/virtual_box/nat_redirect'

module Fog
  module Compute
    class VirtualBox

      class NATRedirects < Fog::Collection

        model Fog::Compute::VirtualBox::NATRedirect

        attr_accessor :machine, :nat_engine

        def all
          requires :machine, :nat_engine
          data = nat_engine.instance_variable_get(:@raw).redirects.map do |nat_redirect|
            {
              :machine  => machine,
              :raw      => nat_redirect
            }
          end
          load(data)
        end

        def get(nat_redirect_name)
          requires :machine, :nat_engine
          all.detect do |nat_redirect|
            nat_redirect.name == nat_redirect_name
          end
        end

        def new(attributes = {})
          requires :machine, :nat_engine
          super({:machine => machine, :nat_engine => nat_engine}.merge!(attributes))
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/virtual_box/nat_redirects.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/virtual_box/nat_redirects.rb
fog-0.11.0 lib/fog/compute/models/virtual_box/nat_redirects.rb
fog-0.10.0 lib/fog/compute/models/virtual_box/nat_redirects.rb
fog4encbs-0.9.0.1 lib/fog/compute/models/virtual_box/nat_redirects.rb
fog4encbs-0.9.0 lib/fog/compute/models/virtual_box/nat_redirects.rb
fog-0.9.0 lib/fog/compute/models/virtual_box/nat_redirects.rb