Sha256: 2a8224ebf94ab5b01ce007e8556ff9f34cbd8738d6358bb7f66f8bfe2ac05753

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Fog
  module Compute
    class OneAndOne
      class SshKey < Fog::Model

        # Declare Model Attributes
        identity  :id

        attribute :name
        attribute :description
        attribute :state
        attribute :servers
        attribute :md5
        attribute :public_key
        attribute :creation_date

        
        def save

          # Perform Request
          response = service.create_ssh_key(name: name, description: description,
            public_key: public_key)

          # Merge Attributes
          merge_attributes(response.body)

          true

        end


        def update(options = {})

          requires :id

          response = service.update_ssh_key(ssh_key_id: id,
            name: options[:name], description: options[:description])

          # Merge Attributes
          merge_attributes(response.body)

          true

        end


        def destroy

          requires :id

          service.delete_ssh_key(id)
          
          true

        end


        def ready?

          state == 'ACTIVE'

        end

      end # SshKey
    end # OneAndOne
  end # Compute
end # Fog

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-oneandone-1.2 lib/oneandone/models/compute/ssh_key.rb