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:



12235
12236
12237
# File 'lib/ovirtsdk4/services.rb', line 12235

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:



12262
12263
12264
# File 'lib/ovirtsdk4/services.rb', line 12262

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:



12289
12290
12291
# File 'lib/ovirtsdk4/services.rb', line 12289

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:



12316
12317
12318
# File 'lib/ovirtsdk4/services.rb', line 12316

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:



12360
12361
12362
# File 'lib/ovirtsdk4/services.rb', line 12360

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:



12348
12349
12350
# File 'lib/ovirtsdk4/services.rb', line 12348

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.



12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
# File 'lib/ovirtsdk4/services.rb', line 12371

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