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.15.0 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
tag-fog-1.0.1 lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/ecloud/models/compute/backup_internet_service.rb
fog-1.0.0 lib/fog/ecloud/models/compute/backup_internet_service.rb
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/ecloud/backup_internet_service.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/ecloud/backup_internet_service.rb
fog-0.11.0 lib/fog/compute/models/ecloud/backup_internet_service.rb
fog-0.10.0 lib/fog/compute/models/ecloud/backup_internet_service.rb
fog4encbs-0.9.0.1 lib/fog/compute/models/ecloud/backup_internet_service.rb
fog4encbs-0.9.0 lib/fog/compute/models/ecloud/backup_internet_service.rb
fog-0.9.0 lib/fog/compute/models/ecloud/backup_internet_service.rb