Sha256: 82196f9b8a8cda67121d8a5ae4ec2c1fb11f995f197214f0bc02b89f5645ee36

Contents?: true

Size: 1.6 KB

Versions: 32

Compression:

Stored size: 1.6 KB

Contents

module Fog
  module Compute
    class Ecloud
      class BackupInternetService < Fog::Ecloud::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::Compute::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

Version data entries

32 entries across 32 versions & 8 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
michiels-fog-1.3.1 lib/fog/ecloud/models/compute/backup_internet_service.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
fog-1.3.1 lib/fog/ecloud/models/compute/backup_internet_service.rb
fog-1.3.0 lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
fog-1.2.0 lib/fog/ecloud/models/compute/backup_internet_service.rb
ktheory-fog-1.1.2 lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
fog-1.1.2 lib/fog/ecloud/models/compute/backup_internet_service.rb
fog_tractical-1.1.4 lib/fog/ecloud/models/compute/backup_internet_service.rb
fog_tractical-1.1.3 lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
fog-1.1.1 lib/fog/ecloud/models/compute/backup_internet_service.rb
fog-1.1.0 lib/fog/ecloud/models/compute/backup_internet_service.rb