ImageManager

class SoftLayer.managers.ImageManager(client)[source]

Manages SoftLayer server images.

See product information here: https://cloud.ibm.com/docs/image-templates

Parameters:

client (SoftLayer.API.BaseClient) – the client instance

__init__(client)[source]

Methods

__init__(client)

add_locations(image_id, location_names)

Add available locations to an archive image template.

delete_image(image_id)

Deletes the specified image.

deny_share_image(image_id, account_id)

Deny sharing image template with another account.

edit(image_id[, name, note, tag])

Edit image related details.

export_image_to_uri(image_id, uri[, ibm_api_key])

Export image into the given object storage

get_image(image_id, **kwargs)

Get details about an image.

get_locations_list(image_id, location_names)

Converts a list of location names to a list of locations.

get_storage_locations(image_id)

Get available locations for public image storage.

import_image_from_uri(name, uri[, os_code, ...])

Import a new image from object storage.

list_private_images([guid, name, limit])

List all private images.

list_public_images([guid, name, limit])

List all public images.

remove_locations(image_id, location_names)

Remove available locations from an archive image template.

resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

share_image(image_id, account_id)

Permit sharing image template with another account.

Attributes

resolvers

add_locations(image_id, location_names)[source]

Add available locations to an archive image template.

Parameters:
  • image_id (int) – The ID of the image

  • location_names – Locations for the Image.

delete_image(image_id)[source]

Deletes the specified image.

Parameters:

image_id (int) – The ID of the image.

deny_share_image(image_id, account_id)[source]

Deny sharing image template with another account.

Parameters:
  • image_id (int) – The ID of the image.

  • account_id (int) – The ID of the another account to deny share the image.

edit(image_id, name=None, note=None, tag=None)[source]

Edit image related details.

Parameters:
  • image_id (int) – The ID of the image

  • name (string) – Name of the Image.

  • note (string) – Note of the image.

  • tag (string) – Tags of the image to be updated to.

export_image_to_uri(image_id, uri, ibm_api_key=None)[source]

Export image into the given object storage

Parameters:
  • image_id (int) – The ID of the image

  • uri (string) – The URI for object storage of the format swift://<objectStorageAccount>@<cluster>/<container>/<objectPath> or cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud Object Storage

  • ibm_api_key (string) – Ibm Api Key needed to communicate with IBM Cloud Object Storage

get_image(image_id, **kwargs)[source]

Get details about an image.

Parameters:
  • image (int) – The ID of the image.

  • **kwargs (dict) – response-level options (mask, limit, etc.)

get_locations_list(image_id, location_names)[source]

Converts a list of location names to a list of locations.

Parameters:
  • image_id (int) – The ID of the image.

  • location_names (list) – A list of location names strings.

Returns:

A list of locations associated with the given location names in the image.

get_storage_locations(image_id)[source]

Get available locations for public image storage.

Parameters:

image_id (int) – The ID of the image

import_image_from_uri(name, uri, os_code=None, note=None, ibm_api_key=None, root_key_crn=None, wrapped_dek=None, cloud_init=False, byol=False, is_encrypted=False)[source]

Import a new image from object storage.

Parameters:
  • name (string) – Name of the new image

  • uri (string) – The URI for an object storage object (.vhd/.iso file) of the format: swift://<objectStorageAccount>@<cluster>/<container>/<objectPath> or (.vhd/.iso/.raw file) of the format: cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud Object Storage

  • os_code (string) – The reference code of the operating system

  • note (string) – Note to add to the image

  • ibm_api_key (string) – Ibm Api Key needed to communicate with ICOS and your KMS

  • root_key_crn (string) – CRN of the root key in your KMS. Go to your KMS (Key Protect or Hyper Protect) provider to get the CRN for your root key. An example CRN: crn:v1:bluemix:public:hs-crypto:us-south:acctID:serviceID:key:keyID’ Used only when is_encrypted is True.

  • wrapped_dek (string) – Wrapped Data Encryption Key provided by your KMS. Used only when is_encrypted is True.

  • cloud_init (boolean) – Specifies if image is cloud-init

  • byol (boolean) – Specifies if image is bring your own license

  • is_encrypted (boolean) – Specifies if image is encrypted

list_private_images(guid=None, name=None, limit=100, **kwargs)[source]

List all private images.

Parameters:
  • guid (string) – filter based on GUID

  • name (string) – filter based on name

  • **kwargs (dict) – response-level options (mask, limit, etc.)

list_public_images(guid=None, name=None, limit=100, **kwargs)[source]

List all public images.

Parameters:
  • guid (string) – filter based on GUID

  • name (string) – filter based on name

  • **kwargs (dict) – response-level options (mask, limit, etc.)

remove_locations(image_id, location_names)[source]

Remove available locations from an archive image template.

Parameters:
  • image_id (int) – The ID of the image

  • location_names – Locations for the Image.

resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

What exactly ‘identifier’ can be depends on the resolvers

Parameters:

identifier (string) – identifying string

Returns list:

share_image(image_id, account_id)[source]

Permit sharing image template with another account.

Parameters:
  • image_id (int) – The ID of the image.

  • account_id (int) – The ID of the another account to share the image.