Sha256: c70c2ce4b850a84a596126145141bcc1e2f15ae58a914a673565e8e327e6bdc0

Contents?: true

Size: 1.21 KB

Versions: 24

Compression:

Stored size: 1.21 KB

Contents

require 'fog/ecloud/models/compute/internet_service'

module Fog
  module Compute
    class Ecloud
      class InternetServices < Fog::Ecloud::Collection

        identity :href

        model Fog::Compute::Ecloud::InternetService

        def all
          data = service.get_internet_services(href).body[:InternetServices]
          if data.is_a?(Hash)
            load(data[:InternetService])
          elsif data.is_a?(String) && data.empty?
            load([])
          end
        end

        def get(uri)
          data = service.get_internet_service(uri).body
          new(data)
        rescue Fog::Errors::NotFound
          nil
        end

        def create(options)
          options[:uri] = "/cloudapi/ecloud/internetServices/publicIps/#{public_ip_id}/action/createInternetService"
          options[:protocol]           ||= "TCP"
          options[:enabled]            ||= true
          options[:description]        ||= ""
          options[:persistence]        ||= {}
          options[:persistence][:type] ||= "None"
          data = service.internet_service_create(options).body
          object = new(data)
        end

        def public_ip_id
          href.scan(/\d+/)[0]
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 6 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/ecloud/models/compute/internet_services.rb
fog-1.17.0 lib/fog/ecloud/models/compute/internet_services.rb
fog-1.16.0 lib/fog/ecloud/models/compute/internet_services.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/ecloud/models/compute/internet_services.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/ecloud/models/compute/internet_services.rb
fog-1.15.0 lib/fog/ecloud/models/compute/internet_services.rb
gapinc-fog-1.14.0 lib/fog/ecloud/models/compute/internet_services.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/ecloud/models/compute/internet_services.rb
fog-1.14.0 lib/fog/ecloud/models/compute/internet_services.rb
fog-1.13.0 lib/fog/ecloud/models/compute/internet_services.rb
gapinc-fog-1.12.1.2 lib/fog/ecloud/models/compute/internet_services.rb
gapinc-fog-1.12.1.1 lib/fog/ecloud/models/compute/internet_services.rb
gapinc-fog-1.12.1a lib/fog/ecloud/models/compute/internet_services.rb
gapinc-fog-1.12.1 lib/fog/ecloud/models/compute/internet_services.rb
fog-1.12.1 lib/fog/ecloud/models/compute/internet_services.rb
fog-1.12.0 lib/fog/ecloud/models/compute/internet_services.rb
hpfog-0.0.20 lib/fog/ecloud/models/compute/internet_services.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/models/compute/internet_services.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/models/compute/internet_services.rb
fog-1.11.1 lib/fog/ecloud/models/compute/internet_services.rb