Sha256: 9260ac1043396d3585c17bb048f07cfa140c74e766f301263627b705b5384ab4

Contents?: true

Size: 1.59 KB

Versions: 43

Compression:

Stored size: 1.59 KB

Contents

module Fog
  module Compute
    class Linode
      class Real
        def linode_disk_list(linode_id, disk_id=nil)
          options = {}
          if disk_id
            options.merge!(:diskId => disk_id)
          end
          request(
            :expects  => 200,
            :method   => 'GET',
            :query    => { :api_action => 'linode.disk.list', :linodeId => linode_id }.merge!(options)
          )
        end
      end

      class Mock
        def linode_disk_list(linode_id, disk_id=nil)
          response = Excon::Response.new
          response.status = 200
          body = {
            "ERRORARRAY" => [],
            "ACTION" => "linode.disk.list"
          }
          if disk_id
            mock_disk = create_mock_disk(linode_id, disk_id)
            response.body = body.merge("DATA" => [mock_disk])
          else
            mock_disks = []
            2.times do
              disk_id = rand(10000..99999)
              mock_disks << create_mock_disk(linode_id, disk_id)
            end
            response.body = body.merge("DATA" => mock_disks)
          end
          response
        end

        private

        def create_mock_disk(linode_id, disk_id)
          {
            "CREATE_DT"  => "2012-02-29 12:55:29.0",
            "DISKID"     => disk_id,
            "ISREADONLY" => 0,
            "LABEL"      => "test_#{linode_id}_main",
            "LINODEID"   => linode_id,
            "SIZE"       => 39936,
            "STATUS"     => 1,
            "TYPE"       => "ext3",
            "UPDATE_DT"  => "2012-02-29 12:55:53.0"
          }
        end
      end
    end
  end
end

Version data entries

43 entries across 41 versions & 6 rubygems

Version Path
fog-2.3.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-ifeel-2.2.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-2.2.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-2.1.0 lib/fog/linode/requests/compute/linode_disk_list.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/linode/requests/compute/linode_disk_list.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/linode/requests/compute/linode_disk_list.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.42.1 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-2.0.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.42.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.41.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.40.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.39.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.38.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.37.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.36.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.35.0 lib/fog/linode/requests/compute/linode_disk_list.rb
fog-2.0.0.pre.0 lib/fog/linode/requests/compute/linode_disk_list.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/linode/requests/compute/linode_disk_list.rb
fog-1.34.0 lib/fog/linode/requests/compute/linode_disk_list.rb