Sha256: 54ea6fab572f68f1b9216dd59b84fd3dfd757a76977f6055499e9f4773bfbc11

Contents?: true

Size: 1.63 KB

Versions: 43

Compression:

Stored size: 1.63 KB

Contents

module Fog
  module Compute
    class IBM
      class Real
        # Requests an image to be created from an Instance
        #
        # ==== Parameters
        # * instance_id<~String> - id of instance to save
        # * name<~String> - name of image to be created
        # * description<~String> - description of image to be created
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'name'<~String>: name of new image
        #     * 'createdTime'<~Integer>: epoch time at creation
        #     * 'productCodes'<~Array>:
        #     * 'id'<~String>: id of new image
        #     * 'description'<~String>: description
        #     * 'visibility'<~String>: visibility level ("PRIVATE", etc)
        #     * 'state'<~Integer>: status of image
        def create_image(instance_id, name, description)
          request(
            :method   => 'PUT',
            :expects  => 200,
            :path     => "/instances/#{instance_id}",
            :body     => {
              'state'       => 'save',
              'name'        => name,
              'description' => description
            }
          )
        end
      end

      class Mock
        def create_image(instance_id, name, description)
          response = Excon::Response.new
          if instance_exists? instance_id
            image = Fog::IBM::Mock.private_image(name, description)
            self.data[:images][image["id"]] = image
            response.status = 200
            response.body = image
          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/create_image.rb
fog-ifeel-2.2.0 lib/fog/ibm/requests/compute/create_image.rb
fog-2.2.0 lib/fog/ibm/requests/compute/create_image.rb
fog-2.1.0 lib/fog/ibm/requests/compute/create_image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/ibm/requests/compute/create_image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/ibm/requests/compute/create_image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/ibm/requests/compute/create_image.rb
fog-1.42.1 lib/fog/ibm/requests/compute/create_image.rb
fog-2.0.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.42.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.41.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.40.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.39.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.38.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.37.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.36.0 lib/fog/ibm/requests/compute/create_image.rb
fog-1.35.0 lib/fog/ibm/requests/compute/create_image.rb
fog-2.0.0.pre.0 lib/fog/ibm/requests/compute/create_image.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/ibm/requests/compute/create_image.rb
fog-1.34.0 lib/fog/ibm/requests/compute/create_image.rb