Sha256: a896389d20e3c2c073c37c9817648efbe07b482fa57c40142e0a5f8830d3c9df

Contents?: true

Size: 1.83 KB

Versions: 9

Compression:

Stored size: 1.83 KB

Contents

require 'fog/compute/models/server'

module Fog
  module Compute
    class Glesys

      class Server < Fog::Compute::Server
        extend Fog::Deprecation

        identity :serverid

        attribute :hostname
        attribute :datacenter
        attribute :cpucores
        attribute :memorysize
        attribute :disksize
        attribute :transfer
        attribute :templatename
        attribute :managedhosting
        attribute :platform
        attribute :cost
        attribute :rootpassword
        attribute :keepip
        attribute :state
        attribute :iplist
        attribute :ipversion
        attribute :ip

        def ready?
          state == 'running'
        end

        def start
          requires :identity
          connection.start(:serverid => identity)
        end

        def stop
          requires :identity
          connection.stop(:serverid => identity)
        end

        def destroy
          requires :identity
          connection.destroy(:serverid => identity, :keepip => keepip)
        end

        def save
          raise "Operation not supported" if self.identity
          requires :hostname, :rootpassword

          options = {
            :datacenter     => datacenter   || "Falkenberg",
            :platform       => platform     || "Xen",
            :hostname       => hostname,
            :templatename   => templatename || "Debian-6 x64",
            :disksize       => disksize     || "10",
            :memorysize     => memorysize   || "512",
            :cpucores       => cpucores     || "1",
            :rootpassword   => rootpassword,
            :transfer       => transfer     || "500",
          } 
          data = connection.create(options)
          merge_attributes(data.body['response']['server'])
          data.status == 200 ? true : false
        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 5 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/glesys/models/compute/server.rb
michiels-fog-1.3.1 lib/fog/glesys/models/compute/server.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/glesys/models/compute/server.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/glesys/models/compute/server.rb
fog-1.3.1 lib/fog/glesys/models/compute/server.rb
fog-1.3.0 lib/fog/glesys/models/compute/server.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/glesys/models/compute/server.rb
fog-1.2.0 lib/fog/glesys/models/compute/server.rb
ktheory-fog-1.1.2 lib/fog/glesys/models/compute/server.rb