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:


13253
13254
13255
# File 'lib/ovirtsdk4/services.rb', line 13253

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:


13280
13281
13282
# File 'lib/ovirtsdk4/services.rb', line 13280

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:


13307
13308
13309
# File 'lib/ovirtsdk4/services.rb', line 13307

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:


13334
13335
13336
# File 'lib/ovirtsdk4/services.rb', line 13334

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:


13378
13379
13380
# File 'lib/ovirtsdk4/services.rb', line 13378

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:


13366
13367
13368
# File 'lib/ovirtsdk4/services.rb', line 13366

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.


13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
# File 'lib/ovirtsdk4/services.rb', line 13389

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