Sha256: e1cadc6ebd1233ae8a66a6ef06692c507f505996039288d36f37ad3385d55fb3

Contents?: true

Size: 1.29 KB

Versions: 43

Compression:

Stored size: 1.29 KB

Contents

module Fog
  module Compute
    class IBM
      class Real
        # Clones image specified by image_id
        #
        # ==== Parameters
        # * image_id<~String> - id of image to be cloned
        # * name<~String> - name of new image
        # * description<~String> - description of new image
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'ImageID'<~String>: id of new image
        def clone_image(image_id, name, description)
          request(
            :method   => 'POST',
            :expects  => 200,
            :path     => "/offerings/image/#{image_id}",
            :body     => {
              'name' => name,
              'description' => description
            }
          )
        end
      end
      class Mock
        def clone_image(image_id, name, description)
          response = Excon::Response.new
          if image_exists? image_id
            id = Fog::IBM::Mock.instance_id
            self.data[:images][id] = self.data[:images][image_id].merge('id' => id, 'name' => name, 'description' => description)
            response.status = 200
            response.body   = { "ImageID" => id }
          else
            response.status = 404
          end
          response
        end
      end
    end
  end
end

Version data entries

43 entries across 41 versions & 6 rubygems

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