Class: OvirtSDK4::ImageTransfersService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#add(image_transfer, opts = {}) ⇒ ImageTransfer

Add a new image transfer. An image, disk or disk snapshot needs to be specified in order to make a new transfer.

Important
The image attribute is deprecated since version 4.2 of the engine. Use the disk or snapshot attributes instead.

Creating a new image transfer for downloading or uploading a disk:

To create an image transfer to download or upload a disk with id 123, send the following request:

POST /ovirt-engine/api/imagetransfers

With a request body like this:

<image_transfer>
  <disk id="123"/>
  <direction>upload|download</direction>
</image_transfer>

Creating a new image transfer for downloading or uploading a disk_snapshot:

To create an image transfer to download or upload a disk_snapshot with id 456, send the following request:

POST /ovirt-engine/api/imagetransfers

With a request body like this:

<image_transfer>
  <snapshot id="456"/>
  <direction>download|upload</direction>
</image_transfer>

Parameters:

  • image_transfer (ImageTransfer)

    The image transfer to add.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



13508
13509
13510
# File 'lib/ovirtsdk4/services.rb', line 13508

def add(image_transfer, opts = {})
  internal_add(image_transfer, ImageTransfer, ADD, opts)
end

#add_for_disk(image_transfer, opts = {}) ⇒ ImageTransfer

Adds a new image_transfer.

Parameters:

  • image_transfer (ImageTransfer)

    The image transfer to add.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



13535
13536
13537
# File 'lib/ovirtsdk4/services.rb', line 13535

def add_for_disk(image_transfer, opts = {})
  internal_add(image_transfer, ImageTransfer, ADD_FOR_DISK, opts)
end

#add_for_image(image_transfer, opts = {}) ⇒ ImageTransfer

Adds a new image_transfer.

Parameters:

  • image_transfer (ImageTransfer)

    The image transfer to add.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



13562
13563
13564
# File 'lib/ovirtsdk4/services.rb', line 13562

def add_for_image(image_transfer, opts = {})
  internal_add(image_transfer, ImageTransfer, ADD_FOR_IMAGE, opts)
end

#add_for_snapshot(image_transfer, opts = {}) ⇒ ImageTransfer

Adds a new image_transfer.

Parameters:

  • image_transfer (ImageTransfer)

    The image transfer to add.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



13589
13590
13591
# File 'lib/ovirtsdk4/services.rb', line 13589

def add_for_snapshot(image_transfer, opts = {})
  internal_add(image_transfer, ImageTransfer, ADD_FOR_SNAPSHOT, opts)
end

#image_transfer_service(id) ⇒ ImageTransferService

Returns a reference to the service that manages an specific image transfer.

Parameters:

  • id (String)

    The identifier of the image_transfer.

Returns:



13633
13634
13635
# File 'lib/ovirtsdk4/services.rb', line 13633

def image_transfer_service(id)
  ImageTransferService.new(self, id)
end

#list(opts = {}) ⇒ Array<ImageTransfer>

Retrieves the list of image transfers that are currently being performed.

The order of the returned list of image transfers is not guaranteed.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



13621
13622
13623
# File 'lib/ovirtsdk4/services.rb', line 13621

def list(opts = {})
  internal_get(LIST, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
# File 'lib/ovirtsdk4/services.rb', line 13644

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return image_transfer_service(path)
  end
  return image_transfer_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end