Sha256: 2022be86f5f37b88ae9d6707151d64326d590c90cc00690c9e93d825d8712491

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

require 'fog/core/model'

module Fog
  module Terremark
    module Shared
      class NodeService < Fog::Model
        identity :Id
        attribute :Name
        attribute :Href
        attribute :Port
        attribute :Description
        attribute :IpAddress
        attribute :Enabled
        attribute :InternetServiceId

        def destroy
          service.delete_node_service(self.Id)
        end

        def save
         requires :Name, :Port, :InternetServiceId
            data = service.add_node_service(
                service_id = self.InternetServiceId,
                ip = self.IpAddress,
                name = self.Name,
                port = self.Port,
                options = {"Enabled" => 'true',
                           "Description" => self.Name,
                }

            )
            merge_attributes(data.body)
            true
        end

        private

        def href=(new_href)
          self.id = new_href.split('/').last.to_i
        end

        def type=(new_type); @type = new_type; end

        def size=(new_size); @size = new_size; end

        def Links=(new_links); @Links = new_links; end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/terremark/models/shared/nodeservice.rb
nsidc-fog-1.24.1 lib/fog/terremark/models/shared/nodeservice.rb
fog-1.24.0 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.11 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.10 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.9 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.8 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.7 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.6 lib/fog/terremark/models/shared/nodeservice.rb
fog-1.23.0 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.4 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.3 lib/fog/terremark/models/shared/nodeservice.rb
ns-fog-1.22.2 lib/fog/terremark/models/shared/nodeservice.rb
fog-1.22.1 lib/fog/terremark/models/shared/nodeservice.rb