Sha256: 4a7a6fbac7ea8ad14a77ba4631e40f580453e0bfade0b51335325f84a1a398d1

Contents?: true

Size: 956 Bytes

Versions: 4

Compression:

Stored size: 956 Bytes

Contents

module Fog
  module Image
    class HuaweiCloud
      class V2
        class Real
          def get_image_by_id(image_id)
            request(
              :expects => [200],
              :method  => 'GET',
              :path    => "images/#{image_id}"
            )
          end
        end

        class Mock
          def get_image_by_id(_image_id)
            response = Excon::Response.new
            response.status = [200][rand(2)]
            response.body = {
              "images" => [{
                "name"             => "mock-image-name",
                "size"             => 25165824,
                "disk_format"      => "ami",
                "container_format" => "ami",
                "id"               => "0e09fbd6-43c5-448a-83e9-0d3d05f9747e",
                "checksum"         => "2f81976cae15c16ef0010c51e3a6c163"
              }]
            }
            response
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/image/huaweicloud/v2/requests/get_image_by_id.rb
fog-huaweicloud-0.0.2 lib/fog/image/huaweicloud/v2/requests/get_image_by_id.rb
fog-huaweicloud-0.1.3 lib/fog/image/huaweicloud/v2/requests/get_image_by_id.rb
fog-huaweicloud-0.1.2 lib/fog/image/huaweicloud/v2/requests/get_image_by_id.rb