ibmcloud_python_sdk.power package

Submodules

ibmcloud_python_sdk.power.event module

class ibmcloud_python_sdk.power.event.Event[source]

Bases: object

get_event(instance, event)[source]

Retrieve specific event for a specific cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • event (str) – Event ID

Returns

Event information

Return type

dict

get_events(instance, time)[source]

Retrieve event list from a timestamp for a specific cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • time (str) – A time in either ISO 8601 or unix epoch format

Returns

List of events

Return type

dict

ibmcloud_python_sdk.power.image module

class ibmcloud_python_sdk.power.image.Image[source]

Bases: object

create_instance_image(**kwargs)[source]

Create image for a cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • source (str) – Source of the image

  • image_id (str, optional) – Image ID of existing source image

  • name (str, optional) – Name to give created image

  • region (str, optional) – Cloud Storage Region

  • file (str, optional) – Cloud Storage image filename

  • bucket (str, optional) – Cloud Storage bucket name

  • access_key (str, optional) – Cloud Storage access key

  • secret_key (str, optional) – Cloud Storage secret key

  • os_type (str, optional) – Image OS Type

  • disk_type (str, optional) – Type of Disk

Returns

Image information

Return type

dict

delete_instance_image(instance, image)[source]

Delete cloud instance image

Parameters
  • instance (str) – Cloud instance ID

  • image (str) – Image ID of existing source image

Returns

Deletion status

Return type

dict

export_instance_image(**kwargs)[source]

Export an image for a cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • image (str) – Image ID of existing source image

  • region (str, optional) – Cloud Storage Region

  • bucket (str, optional) – Cloud Storage bucket name

  • access_key (str, optional) – Cloud Storage access key

  • secret_key (str, optional) – Cloud Storage secret key

Returns

Export image information

Return type

dict

get_image(image)[source]

Retrieve specific image by name or by ID

Parameters

image (str) – Image name or ID

Returns

Image information

Return type

dict

get_image_by_id(id)[source]

Retrieve specific image by ID

Parameters

id (str) – Image ID

Returns

Image information

Return type

dict

get_image_by_name(name)[source]

Retrieve specific image by name

Parameters

name (str) – Image name

Returns

Image information

Return type

dict

get_images()[source]

Retrieve image list

Returns

List of images

Return type

list

get_instance_image(instance, image)[source]

Retrieve specific image by name or by ID for a cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • image (str) – Image name or ID

Returns

Image information

Return type

dict

get_instance_image_by_id(instance, id)[source]

Retrieve specific image by ID for a cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • id (str) – Image ID

Returns

Image information

Return type

dict

get_instance_image_by_name(instance, name)[source]

Retrieve specific image by name

Parameters
  • instance (str) – Cloud instance ID

  • name (str) – Image name

Returns

Image information

Return type

dict

get_instance_images(instance)[source]

Retrieve images for a cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

List of images per instance

Return type

list

ibmcloud_python_sdk.power.instance module

class ibmcloud_python_sdk.power.instance.Instance[source]

Bases: object

delete_instance(instance)[source]

Delete cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

Deletion status

Return type

dict

get_instance(instance)[source]

Retrieve information about cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

Cloud instance information

Return type

dict

ibmcloud_python_sdk.power.key module

class ibmcloud_python_sdk.power.key.Key[source]

Bases: object

create_key(**kwargs)[source]

Create key

Parameters
  • tenant (str) – Tenant ID (Account ID)

  • name (str) – User defined name for the SSH key

  • public_key (str) – A unique public SSH key to import

Returns

Key information

Return type

dict

delete_key(tenant, key)[source]

Delete key

Parameters
  • tenant (str) – Tenant ID (Account ID)

  • key (str) – Key name

Returns

Deletion status

Return type

dict

get_key(tenant, key)[source]

Retrieve specific key for a specific tenant

Parameters
  • tenant (str) – Tenant ID (Account ID)

  • key (str) – Key name

Returns

Key information

Return type

dict

get_keys(tenant)[source]

Retrieve keys for a specific tenant

Parameters

tenant (str) – Tenant ID (Account ID)

Returns

List of keys

Return type

list

ibmcloud_python_sdk.power.network module

class ibmcloud_python_sdk.power.network.Network[source]

Bases: object

create_network(**kwargs)[source]

Create network

Parameters
  • instance (str) – Instance name or ID

  • type (str) – Type of network

  • name (str) – Network name

  • cidr (str) – Network in CIDR notation

  • gateway (str, optional) – Gateway IP address

  • dns_servers (list, optional) – DNS servers

  • ip_address_ranges (list, optional) – IP address ranges

Returns

Network information

Return type

dict

create_port(**kwargs)[source]

Create network

Parameters
  • instance (str) – Instance name or ID

  • network (str) – Network name or ID

  • description (str, optional) – Description of the port

  • ip_address (str, optional) – The requested ip address of this port

Returns

Port information

Return type

dict

delete_network(instance, network)[source]

Delete network from cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • network (str) – Network name or ID

Returns

Deletion status

Return type

dict

delete_port(instance, network, port)[source]

Delete port from network

Parameters
  • instance (str) – Cloud instance ID

  • network (str) – Network name or ID

  • port (str) – Port name or ID

Returns

Deletion status

Return type

dict

get_network(instance, network)[source]

Retrieve specific network by name or by ID

Parameters
  • instance (str) – Cloud instance ID

  • network (str) – Network name or ID

Returns

Network information

Return type

dict

get_network_by_id(instance, id)[source]

Retrieve specific network by ID

Parameters
  • instance (str) – Cloud instance ID

  • id (str) – Network ID

Returns

Network information

Return type

dict

get_network_by_name(instance, name)[source]

Retrieve specific network by name

Parameters
  • instance (str) – Cloud instance ID

  • name (str) – Network name

Returns

Network information

Return type

dict

get_networks(instance)[source]

Retrieve network list from cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

Network list

Return type

list

get_port(instance, network, port)[source]

Retrieve specific port by ID

Parameters
  • instance (str) – Cloud instance ID

  • network – Network name or ID

  • port (str) – Port ID

Returns

Port information

Return type

dict

get_ports(instance, network)[source]

Retrieve port list from from network

Parameters
  • instance (str) – Cloud instance ID

  • network – Network name or ID

Returns

Port list

Return type

list

ibmcloud_python_sdk.power.pool module

class ibmcloud_python_sdk.power.pool.Pool[source]

Bases: object

get_pools(instance)[source]

Retrieve system pools for a specific cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

List of system pools

Return type

list

ibmcloud_python_sdk.power.pvm module

class ibmcloud_python_sdk.power.pvm.Pvm[source]

Bases: object

delete_pvm(instance, pvm)[source]

Delete Power Virtual Instance

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

Returns

Deletion status

Return type

dict

delete_pvm_network(instance, pvm, network)[source]

Delete Power Virtual Instance network

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

  • network (str) – Network name or ID

Returns

Deletion status

Return type

dict

get_pvm(instance, pvm)[source]

Retrieve specific Power Virtual Instance by name or by ID

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

Returns

PVM information

Return type

dict

get_pvm_by_id(instance, id)[source]

Retrieve specific Power Virtual Instance by ID

Parameters
  • instance (str) – Cloud instance ID

  • id (str) – Power Virtual Instance ID

Returns

PVM information

Return type

dict

get_pvm_by_name(instance, name)[source]

Retrieve specific Power Virtual Instance by name

Parameters
  • instance (str) – Cloud instance ID

  • name (str) – Power Virtual Instance name

Returns

PVM information

Return type

dict

get_pvm_network(instance, pvm, network)[source]

Retrieve specific network from Power Virtual Instance by name or by ID

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

  • network (str) – Network name or ID

Returns

PVM network information

Return type

dict

get_pvm_network_by_id(instance, pvm, id)[source]

Retrieve specific network from Power Virtual Instance by ID

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

  • id (str) – Network ID

Returns

PVM network information

Return type

dict

get_pvm_network_by_name(instance, pvm, name)[source]

Retrieve specific Power Virtual Instance by name

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

  • name (str) – Network name

Returns

PVM network information

Return type

dict

get_pvm_networks(instance, pvm)[source]

Retrieve networks list for Power Virtual Instance

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

Returns

PVM network list

Return type

list

get_pvms(instance)[source]

Retrieve Power Virtual Instance list for specific cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

PVM list

Return type

list

perform_action(**kwargs)[source]

Perform an action on Power Virtual Machine

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

  • action (str) – Name of the action to take

Returns

Action information

Return type

dict

ibmcloud_python_sdk.power.snapshot module

class ibmcloud_python_sdk.power.snapshot.Sanpshot[source]

Bases: object

delete_snapshot(instance, snapshot)[source]

Delete cloud instance

Parameters
  • instance (str) – Cloud instance ID

  • snapshot (str) – Snapshot name or ID

Returns

Deletion status

Return type

dict

get_snapshot(instance, snapshot)[source]

Retrieve specific snapshot by name or by ID

Parameters
  • instance (str) – Cloud instance ID

  • snapshot (str) – Snapshot name or ID

Returns

Snapshot information

Return type

dict

get_snapshot_by_id(instance, id)[source]

Retrieve specific snapshot by ID

Parameters
  • instance (str) – Cloud instance ID

  • id (str) – Snapshot ID

Returns

Snapshot information

Return type

dict

get_snapshot_by_name(instance, name)[source]

Retrieve specific snapshot by name

Parameters
  • instance (str) – Cloud instance ID

  • name (str) – Snapshot name

Returns

Snapshot information

Return type

dict

get_snapshots(instance)[source]

Retrieve snapshot list for a specific cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

List of snapshots

Return type

list

ibmcloud_python_sdk.power.task module

class ibmcloud_python_sdk.power.task.Task[source]

Bases: object

delete_task(task)[source]

Delete task

Parameters

task (str) – Task ID

Returns

Deletion status

Return type

dict

get_task(task)[source]

Retrieve specific task

Parameters

task (str) – Task ID

Returns

Task information

Return type

dict

ibmcloud_python_sdk.power.tenant module

class ibmcloud_python_sdk.power.tenant.Tenant[source]

Bases: object

get_state(tenant)[source]

Retrieve tenant state

Parameters

tenant (str) – Tenant ID (Account ID)

Returns

Tenant information

Return type

dict

ibmcloud_python_sdk.power.volume module

class ibmcloud_python_sdk.power.volume.Volume[source]

Bases: object

attach_volume(**kwargs)[source]

Attach volume to a Power Virtual Instance

Parameters
  • instance (str) – Instance name or ID

  • pvm (str) – Power Virtual Instance name or ID

  • volume (str) – Volume name or ID

Returns

Attachment status

Return type

dict

boot_volume(**kwargs)[source]

Set boot volume to a Power Virtual Instance

Parameters
  • instance (str) – Instance name or ID

  • pvm (str) – Power Virtual Instance name or ID

  • volume – Volume name or ID

Returns

Boot status

Return type

dict

clone_volume(**kwargs)[source]

Create a clone from a volume

Parameters
  • instance (str) – Instance name or ID

  • volumes (list) – List of volumes to be cloned

  • name (str) – Display name for the new cloned volumes. Cloned Volume names will be prefixed with ‘clone-‘. If multiple volumes cloned they will be suffix with a ‘-‘ and an incremental number starting with 1.

  • prefix_name (str, optional) – Prefix to use when naming the new cloned volumes

Returns

Volume clone information

Return type

dict

create_volume(**kwargs)[source]

Create volume

Parameters
  • instance (str) – Cloud instance ID

  • size (int) – Volume size

  • name (str) – Volume name

  • disk_type (str, optional) – Type of Disk, required if affinity_policy not used

  • pool (str, optional) – Volume pool where the volume will be located

  • shareable (str, optional) – Indicates if the volume is shareable between VMs

  • affinity_policy (str, optional) – Affinity policy for data volume being created; requires affinity_volume to be specified

  • affinity_volume (str, optional) – Volume (ID or Name) to base volume affinity policy against; required if affinity_policy provided

Returns

Volume information

Return type

dict

delete_volume(instance, volume)[source]

Delete volume from cloud instance

Parameters
  • instance (str) – Instance name or ID

  • volume (str) – Volume name or ID

Returns

Deletion status

Return type

dict

detach_volume(**kwargs)[source]

Detach volume to a Power Virtual Instance

Parameters
  • instance (str) – Instance name or ID

  • pvm (str) – Power Virtual Instance name or ID

  • volume (str) – Volume name or ID

Returns

Dettachement status

Return type

dict

get_pvm_volume(instance, pvm, volume)[source]

Retrieve specific volume from Power Virtual Instance by name or by ID

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

  • volume (str) – Volume name or ID

Returns

PVM volume information

Return type

dict

get_pvm_volume_by_id(instance, pvm, id)[source]

Retrieve specific volume from Power Virtual Instance by ID :param instance: Cloud instance ID :type instance: str :param pvm: Power Virtual Instance name or ID :type pvm: str :param id: Volume ID :type id: str :return: PVM volume information :rtype: dict

get_pvm_volume_by_name(instance, pvm, name)[source]

Retrieve specific volume from Power Virtual Instance by name

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

  • name (str) – Volume name

Returns

PVM volume information

Return type

dict

get_pvm_volumes(instance, pvm)[source]

Retrieve volumes list for Power Virtual Instance

Parameters
  • instance (str) – Cloud instance ID

  • pvm (str) – Power Virtual Instance name or ID

Returns

PVM volume list

Return type

list

get_volume(instance, volume)[source]

Retrieve specific volume by name or by ID

Parameters
  • instance (str) – Cloud instance ID

  • volume (str) – Volume name or ID

Returns

Volume information

Return type

dict

get_volume_by_id(instance, id)[source]

Retrieve specific volume by ID

Parameters
  • instance (str) – Cloud instance ID

  • id (str) – Volume ID

Returns

Volume information

Return type

dict

get_volume_by_name(instance, name)[source]

Retrieve specific volume by name

Parameters
  • instance (str) – Cloud instance ID

  • name (str) – Volume name

Returns

Volume information

Return type

dict

get_volumes(instance)[source]

Retrieve volume list from cloud instance

Parameters

instance (str) – Cloud instance ID

Returns

Volume list

Return type

list

Module contents

ibmcloud_python_sdk.power.get_power_headers(**kwargs)[source]

Generates the headers used for Power authenticated HTTP request.

This function is only used by the power package which is why it’s in the __init__.py file. It replace the get_headers() method from auth.py.

Parameters
  • region – Region where the resource instance is created.

  • account – Account ID.

Parem instance

Resource instance name or ID.

Returns

Dict of headers

Return type

dict