Images

OneAndOne::Image()

The Image class allows a user to perform actions against the 1and1 API.

create(server_id: nil, name: nil, description: nil, frequency: nil, num_images: nil)

Create a new image.

Parameters:
  • server_id (str) – the ID of the server to be copied.
  • name (str) – image name.
  • description (str) – image description.
  • frequency (str) – image creation policy. Possible values are 'ONCE', 'DAILY', and 'WEEKLY'.
  • num_images (int) – the number of images to create.
Return type:

JSON

modify(image_id: @id, name: nil, description: nil, frequency: nil)

Modify an image.

Parameters:
  • image_id (str) – the unique identifier for the image.
  • name (str) – image name.
  • description (str) – image description.
  • frequency (str) – can only be changed to 'ONCE'
Return type:

JSON

delete(image_id: @id)

Delete an image.

Parameters:
  • image_id (str) – the unique identifier for the image.
Return type:

JSON

get(image_id: @id)

Retrieve an image’s current specs.

Parameters:
  • image_id (str) – the unique identifier for the image.
Return type:

JSON

list(page: nil, per_page: nil, sort: nil, q: nil, fields: nil)

Return a list of all images.

Parameters:
  • page (int) – Allows the use of pagination. Indicate which page to start on.
  • per_page (int) – Number of items per page.
  • sort (str) – sort: 'name' retrieves a list of elements sorted alphabetically. sort: 'creation_date' retrieves a list of elements sorted by their creation date in descending order.
  • q (str) – q is for query. Use this parameter to return only the items that match your search query.
  • fields (str) – Returns only the parameters requested. (i.e. fields: ‘id, name, description, hardware.ram’)
Return type:

JSON

wait_for()

Polls the image until an “ACTIVE” state is returned. Use this when chaining actions.

Return type:nil