Sha256: 6ec7bf1ccde781f7a5801170e96bf208c289d9c77e632ac0eb5294eaf4bab507

Contents?: true

Size: 1.72 KB

Versions: 13

Compression:

Stored size: 1.72 KB

Contents

module Fog
  class Vcloud
    module Terremark
      class Ecloud
        class BackupInternetService < Fog::Vcloud::Model

          identity :href, :aliases => :Href

          ignore_attributes :xmlns, :xmlns_i

          attribute :name, :aliases => :Name
          attribute :id, :aliases => :Id
          attribute :protocol, :aliases => :Protocol
          attribute :enabled, :aliases => :Enabled
          attribute :description, :aliases => :Description
          attribute :timeout, :aliases => :Timeout
          attribute :redirect_url, :aliases => :RedirectURL
          attribute :monitor, :aliases => :Monitor

          def delete
            requires :href

            connection.delete_internet_service( href )
          end

          def monitor=(new_monitor = {})
            if new_monitor.nil? || new_monitor.empty?
              attributes[:monitor] = nil
            end
          end

          def save
            if new_record?
              result = connection.add_backup_internet_service( collection.href, _compose_service_data )
              merge_attributes(result.body)
            else
              connection.configure_backup_internet_service( href, _compose_service_data )
            end
          end

          def nodes
            @nodes ||= Fog::Vcloud::Terremark::Ecloud::Nodes.new( :connection => connection, :href => href + "/nodeServices" )
          end

          private

          def _compose_service_data
            #For some reason inject didn't work
            service_data = {}
            self.class.attributes.select{ |attribute| !send(attribute).nil? }.each { |attribute| service_data[attribute] = send(attribute) }
            service_data
          end

        end
      end
    end
  end
end


Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
fog-0.5.3 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.5.2 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.5.1 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.5.0 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
phpfog-fog-0.4.1.3 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
phpfog-fog-0.4.1.2 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
phpfog-fog-0.4.1.1 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
phpfog-fog-0.4.1 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.4.1 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.4.0 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.3.34 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.3.33 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb
fog-0.3.32 lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb