Sha256: 025dd2fcee4395e18750436d3b98cbdd4c3ff381bcba152ffaf58db1a32b6351

Contents?: true

Size: 1.21 KB

Versions: 17

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] = "#{service.base_path}/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

17 entries across 17 versions & 5 rubygems

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