# ibmcloud_python_sdk.power package

## Submodules

## ibmcloud_python_sdk.power.event module

class ibmcloud_python_sdk.power.event.Event

  Bases: `object`

  get_event(instance, event)

    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)

    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

  Bases: `object`

  create_instance_image(**kwargs)

    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)

    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)

    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)

    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)

    Retrieve specific image by ID

    Parameters

      id (str) – Image ID

    Returns

      Image information

    Return type

      dict

  get_image_by_name(name)

    Retrieve specific image by name

    Parameters

      name (str) – Image name

    Returns

      Image information

    Return type

      dict

  get_images()

    Retrieve image list

    Returns

      List of images

    Return type

      list

  get_instance_image(instance, image)

    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)

    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)

    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)

    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

  Bases: `object`

  delete_instance(instance)

    Delete cloud instance

    Parameters

      instance (str) – Cloud instance ID

    Returns

      Deletion status

    Return type

      dict

  get_instance(instance)

    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

  Bases: `object`

  create_key(**kwargs)

    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)

    Delete key

    Parameters

      - tenant (str) – Tenant ID (Account ID)

      - key (str) – Key name

    Returns

      Deletion status

    Return type

      dict

  get_key(tenant, key)

    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)

    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

  Bases: `object`

  create_network(**kwargs)

    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)

    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)

    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)

    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)

    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)

    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)

    Retrieve specific network by name

    Parameters

      - instance (str) – Cloud instance ID

      - name (str) – Network name

    Returns

      Network information

    Return type

      dict

  get_networks(instance)

    Retrieve network list from cloud instance

    Parameters

      instance (str) – Cloud instance ID

    Returns

      Network list

    Return type

      list

  get_port(instance, network, port)

    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)

    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

  Bases: `object`

  get_pools(instance)

    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

  Bases: `object`

  delete_pvm(instance, pvm)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    Retrieve Power Virtual Instance list for specific cloud instance

    Parameters

      instance (str) – Cloud instance ID

    Returns

      PVM list

    Return type

      list

  perform_action(**kwargs)

    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

  Bases: `object`

  delete_snapshot(instance, snapshot)

    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)

    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)

    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)

    Retrieve specific snapshot by name

    Parameters

      - instance (str) – Cloud instance ID

      - name (str) – Snapshot name

    Returns

      Snapshot information

    Return type

      dict

  get_snapshots(instance)

    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

  Bases: `object`

  delete_task(task)

    Delete task

    Parameters

      task (str) – Task ID

    Returns

      Deletion status

    Return type

      dict

  get_task(task)

    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

  Bases: `object`

  get_state(tenant)

    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

  Bases: `object`

  attach_volume(**kwargs)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    Retrieve specific volume by name

    Parameters

      - instance (str) – Cloud instance ID

      - name (str) – Volume name

    Returns

      Volume information

    Return type

      dict

  get_volumes(instance)

    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)

  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