API Glossary

Contents:

This library provides an easy way to script administration tasks for the Pure Storage FlashArray.

When passing arguments to methods that take **kwargs, the exact parameters that can be passed can be found in the REST API guide for the given release of Purity running on the FlashArray.

class purestorage.FlashArray(target, username=None, password=None, api_token=None, rest_version=None, verify_https=False, ssl_cert=None, user_agent=None)[source]

Represents a Pure Storage FlashArray and exposes administrative APIs.

Parameters:
  • target (str) – IP address or domain name of the target array’s management interface.
  • username (str, optional) – Username of the user with which to log in.
  • password (str, optional) – Password of the user with which to log in.
  • api_token (str, optional) – API token of the user with which to log in.
  • rest_version (str, optional) – REST API version to use when communicating with target array.
  • verify_https (bool, optional) – Enable SSL certificate verification for HTTPS requests.
  • ssl_cert (str, optional) – Path to SSL certificate or CA Bundle file. Ignored if verify_https=False.
  • user_agent (str, optional) – String to be used as the HTTP User-Agent for requests.
Raises:

PureError

  • If the target array cannot be found.
  • If the target array does not support any of the REST versions used by this library.
  • If the username and password or api_token are invalid.
Raises:

ValueError

  • If no api_token or username and password are specified.
  • If an api_token and a username or password are specified.
  • If the specified rest_version is not supported by this library or by the target array.

Note

The FlashArray constructor requires either a username and password or an api_token but not both.

Note

If a rest_version is not specified, the FlashArray object uses the highest REST API version supported by both the target array and this library. If the REST API version should become deprecated during the lifetime of the FlashArray object, the object renegotiates a REST version to use and continues running.

Note

If a rest_version is specified, that version is used so long as it is supported by both the target array and this library. In this case, the FlashArray object does not attempt to renegotiate the REST API version.

add_hgroup(hgroup, pgroup)[source]

Add an hgroup to a pgroup.

Parameters:
  • hgroup (str) – Name of the hgroup to add to pgroup.
  • pgroup (str) – pgroup to which to add hgroup.
Returns:

A dictionary mapping “name” to hgroup and “protection_group” to pgroup.

Return type:

ResponseDict

add_host(host, pgroup)[source]

Add a host to a pgroup.

Parameters:
  • host (str) – Name of the host to add to pgroup.
  • pgroup (str) – pgroup to which to add host.
Returns:

A dictionary mapping “name” to host and “protection_group” to pgroup.

Return type:

ResponseDict

add_volume(volume, pgroup)[source]

Add a volume to a pgroup.

Parameters:
  • volume (str) – Name of the volume to add to pgroup.
  • pgroup (str) – pgroup to which to add volume.
Returns:

A dictionary mapping “name” to volume and “protection_group” to pgroup.

Return type:

ResponseDict

Note

Requires use of REST API 1.7 or later.

clear_message(message_id)[source]

Clear an alert message or audit record flag.

Parameters:message_id (int or str) – ID of the message to unflag.
Returns:A dictionary mapping “id” to message_id.
Return type:ResponseDict
connect_array(address, connection_key, connection_type, **kwargs)[source]

Connect this array with another one.

Parameters:
  • address (str) – IP address or DNS name of other array.
  • connection_key (str) – Connection key of other array.
  • connection_type (list) – Type(s) of connection desired.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST array/connection
Returns:

A dictionary describing the connection to the other array.

Return type:

ResponseDict

Note

Currently, the only type of connection is “replication”.

Note

Requires use of REST API 1.2 or later.

connect_hgroup(hgroup, volume, **kwargs)[source]

Create a shared connection between a host group and a volume.

Parameters:
  • hgroup (str) – Name of hgroup to connect to volume.
  • volume (str) – Name of volume to connect to hgroup.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST hgroup/:hgroup/volume/:volume
Returns:

A dictionary describing the connection between the hgroup and volume.

Return type:

ResponseDict

connect_host(host, volume, **kwargs)[source]

Create a connection between a host and a volume.

Parameters:
  • host (str) – Name of host to connect to volume.
  • volume (str) – Name of volume to connect to host.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST host/:host/volume/:volume
Returns:

A dictionary describing the connection between the host and volume.

Return type:

ResponseDict

copy_volume(source, dest, **kwargs)[source]

Clone a volume and return a dictionary describing the new volume.

Parameters:
  • source (str) – Name of the source volume.
  • dest (str) – Name of the destination volume.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST volume/:volume
Returns:

A dictionary describing the destination volume.

Return type:

ResponseDict

create_alert_recipient(address)[source]

Add an alert recipient.

Parameters:address (str) – Email address of alert recipient to be created.
Returns:A dictionary mapping “name” to address and “enabled” to True.
Return type:ResponseDict
create_api_token(admin)[source]

Create an API token for an admin.

Parameters:admin (str) – Name of admin for whom to create an API token.
Returns:A dictionary mapping “name” to admin, “api_token” to the new API token, and “created” to the time the token was created as an ISO formatted string.
Return type:ResponseDict
create_hgroup(hgroup, **kwargs)[source]

Create a host group and return a dictionary describing it.

Parameters:
  • hgroup (str) – Name of hgroup to be created.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST hgroup/:hgroup
Returns:

A dictionary describing the created hgroup

Return type:

ResponseDict

create_host(host, **kwargs)[source]

Create a host are return a dictionary describing it.

Parameters:
  • host (str) – Name of host to be created.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST host/:host
Returns:

A dictionary describing the created host.

Return type:

ResponseDict

create_pgroup(pgroup, **kwargs)[source]

Create pgroup with specified name.

Parameters:
  • pgroup (str) – Name of pgroup to be created.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST pgroup/:pgroup
Returns:

A dictionary describing the created pgroup.

Return type:

ResponseDict

Note

Requires use of REST API 1.2 or later.

create_pgroup_snapshot(source, **kwargs)[source]

Create snapshot of pgroup from specified source.

Parameters:
  • source (str) – Name of pgroup of which to take snapshot.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST pgroup
Returns:

A dictionary describing the created snapshot.

Return type:

ResponseDict

Note

Requires use of REST API 1.2 or later.

create_pgroup_snapshots(sources, **kwargs)[source]

Create snapshots of pgroups from specified sources.

Parameters:
  • sources (list of str) – Names of pgroups of which to take snapshots.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST pgroup
Returns:

A list of dictionaries describing the created snapshots.

Return type:

ResponseList

Note

Requires use of REST API 1.2 or later.

create_snapshot(volume, **kwargs)[source]

Create a snapshot of the given volume.

Parameters:
  • volume (str) – Name of the volume of which to take a snapshot.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST volume
Returns:

A dictionary describing the new snapshot.

Return type:

ResponseDict

create_snapshots(volumes, **kwargs)[source]

Create snapshots of the listed volumes.

Parameters:
  • volumes (list of str) – List of names of the volumes to snapshot.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST volume
Returns:

A list of dictionaries describing the new snapshots.

Return type:

ResponseDict

create_snmp_manager(manager, host, **kwargs)[source]

Create an SNMP manager.

Parameters:
  • manager (str) – Name of manager to be created.
  • host (str) – IP address or DNS name of SNMP server to be used.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST snmp/:manager
Returns:

A dictionary describing the created SNMP manager.

Return type:

ResponseDict

create_subnet(subnet, prefix, **kwargs)[source]

Create a subnet.

Parameters:
  • subnet (str) – Name of subnet to be created.
  • prefix (str) – Routing prefix of subnet to be created.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST subnet/:subnet
Returns:

A dictionary describing the created subnet.

Return type:

ResponseDict

Note

prefix should be specified as an IPv4 CIDR address. (“xxx.xxx.xxx.xxx/nn”, representing prefix and prefix length)

Note

Requires use of REST API 1.5 or later.

create_vlan_interface(interface, subnet, **kwargs)[source]

Create a vlan interface

Parameters:
  • interface (str) – Name of interface to be created.
  • subnet (str) – Subnet associated with interface to be created
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: POST network/vif/:vlan_interface
Returns:

A dictionary describing the created interface

Return type:

ResponseDict

Note

Requires use of REST API 1.5 or later.

create_volume(volume, size)[source]

Create a volume and return a dictionary describing it.

Parameters:
  • volume (str) – Name of the volume to be created.
  • size (int or str) – Size in bytes, or string representing the size of the volume to be created.
Returns:

A dictionary describing the created volume.

Return type:

ResponseDict

Note

The maximum volume size supported is 4 petabytes (4 * 2^50).

Note

If size is an int, it must be a multiple of 512.

Note

If size is a string, it must consist of an integer followed by a valid suffix.

Accepted Suffixes

Suffix Size Bytes
S Sector (2^9)
K Kilobyte (2^10)
M Megabyte (2^20)
G Gigabyte (2^30)
T Terabyte (2^40)
P Petabyte (2^50)
delete_alert_recipient(address)[source]

Delete an alert recipient.

Parameters:address (str) – Email address of alert recipient to be deleted.
Returns:A dictionary mapping “name” to address.
Return type:ResponseDict
delete_api_token(admin)[source]

Delete the API token of an admin.

Parameters:admin (str) – Name of admin whose API token is to be deleted.
Returns:A dictionary mapping “name” to admin and “api_token” to None.
Return type:ResponseDict
delete_hgroup(hgroup)[source]

Delete a host group.

Parameters:hgroup (str) – Name of the hgroup to be deleted.
Returns:A dictionary mapping “name” to hgroup.
Return type:ResponseDict
delete_host(host)[source]

Delete a host.

Parameters:host (str) – Name of host to be deleted.
Returns:A dictionary mapping “name” to host.
Return type:ResponseDict
delete_snmp_manager(manager)[source]

Delete an SNMP manager.

Parameters:manager (str) – Name of SNMP manager to be deleted.
Returns:A dictionary mapping “name” to manager.
Return type:ResponseDict
delete_subnet(subnet)[source]

Delete a subnet.

Parameters:subnet (str) – Name of the subnet to be deleted.
Returns:A dictionary mapping “name” to subnet.
Return type:ResponseDict

Note

Requires use of REST API 1.5 or later.

delete_vlan_interface(interface)[source]

Delete a vlan interface.

Parameters:interface (str) – Name of the interface to be deleted.
Returns:A dictionary mapping “name” to interface.
Return type:ResponseDict

Note

Requires use of REST API 1.5 or later.

destroy_pgroup(pgroup)[source]

Destroy an existing pgroup.

Parameters:pgroup (str) – Name of pgroup to be destroyed.
Returns:A dictionary mapping “name” to pgroup.
Return type:ResponseDict

Note

Requires use of REST API 1.2 or later.

destroy_volume(volume)[source]

Destroy an existing volume or snapshot.

Parameters:volume (str) – Name of the volume to be destroyed.
Returns:A dictionary mapping “name” to volume.
Return type:ResponseDict
disable_alert_recipient(address)[source]

Disable alerts to an alert recipient.

Parameters:address (str) – Email address of alert recipient to be disabled.
Returns:A dictionary mapping “name” to address and “enabled” to False.
Return type:ResponseDict
disable_console_lock()[source]

Disable root lockout from the array at the physical console.

Returns:A dictionary mapping “console_lock” to “disabled”.
Return type:ResponseDict
disable_directory_service(check_peer=False)[source]

Disable the directory service.

Parameters:check_peer (bool, optional) – If True, disables server authenticity enforcement. If False, disables directory service integration.
Returns:A dictionary describing the status of the directory service.
Return type:ResponseDict
disable_network_interface(interface)[source]

Disable a network interface.

Parameters:interface (str) – Name of network interface to be disabled.
Returns:A dictionary describing the interface.
Return type:ResponseDict
disable_pgroup_replication(pgroup)[source]

Disable replication schedule for pgroup.

Parameters:pgroup (str) – Name of pgroup for which to disable replication schedule.
Returns:A dictionary describing pgroup.
Return type:ResponseDict

Note

Requires use of REST API 1.2 or later.

disable_pgroup_snapshots(pgroup)[source]

Disable snapshot schedule for pgroup.

Return type:ResponseDict
Returns:A dictionary describing pgroup.

Note

Requires use of REST API 1.2 or later.

disable_phonehome()[source]

Disable hourly phonehome.

Returns:A dictionary mapping “phonehome” to “disabled”.
Return type:ResponseDict
disable_remote_assist()[source]

Disable remote assist.

Returns:A dictionary describing the status of the remote assist connection.
Return type:ResponseDict
disable_subnet(subnet)[source]

Disable a subnet.

Parameters:subnet (str) – Name of subnet to be disabled.
Returns:A dictionary describing the subnet.
Return type:ResponseDict

Note

Requires use of REST API 1.5 or later.

disconnect_array(address)[source]

Disconnect this array from another one.

Parameters:address (str) – IP address or DNS name of other array.
Returns:A dictionary mapping “name” to address.
Return type:ResponseDict

Note

Requires use of REST API 1.2 or later.

disconnect_hgroup(hgroup, volume)[source]

Delete a shared connection between a host group and a volume.

Parameters:
  • hgroup (str) – Name of hgroup to be disconnected from volume.
  • volume (str) – Name of volume to be disconnected from hgroup.
Returns:

A dictionary mapping “name” to hgroup and “vol” to volume.

Return type:

ResponseDict

disconnect_host(host, volume)[source]

Delete a connection between a host and a volume.

Parameters:
  • host (str) – Name of host to be disconnected from volume.
  • volume (str) – Name of volume to be disconnected from host.
Returns:

A dictionary mapping “name” to host and “vol” to volume.

Return type:

ResponseDict

enable_alert_recipient(address)[source]

Enable alerts to an alert recipient.

Parameters:address (str) – Email address of alert recipient to be enabled.
Returns:A dictionary mapping “name” to address and “enabled” to True.
Return type:ResponseDict
enable_console_lock()[source]

Enable root lockout from the array at the physical console.

Returns:A dictionary mapping “console_lock” to “enabled”.
Return type:ResponseDict
enable_directory_service(check_peer=False)[source]

Enable the directory service.

Parameters:check_peer (bool, optional) – If True, enables server authenticity enforcement. If False, enables directory service integration.
Returns:A dictionary describing the status of the directory service.
Return type:ResponseDict
enable_network_interface(interface)[source]

Enable a network interface.

Parameters:interface (str) – Name of network interface to be enabled.
Returns:A dictionary describing the interface.
Return type:ResponseDict
enable_pgroup_replication(pgroup)[source]

Enable replication schedule for pgroup.

Parameters:pgroup (str) – Name of pgroup for which to enable replication schedule.
Returns:A dictionary describing pgroup.
Return type:ResponseDict

Note

Requires use of REST API 1.2 or later.

enable_pgroup_snapshots(pgroup)[source]

Enable snapshot schedule for pgroup.

Parameters:pgroup (str) – Name of pgroup for which to enable snapshot schedule.
Returns:A dictionary describing pgroup.
Return type:ResponseDict

Note

Requires use of REST API 1.2 or later.

enable_phonehome()[source]

Enable hourly phonehome.

Returns:A dictionary mapping “phonehome” to “enabled”.
Return type:ResponseDict
enable_remote_assist()[source]

Enable remote assist.

Returns:A dictionary describing the status of the remote assist connection.
Return type:ResponseDict
enable_subnet(subnet)[source]

Enable a subnet.

Parameters:subnet (str) – Name of subnet to be enabled.
Returns:A dictionary describing the subnet.
Return type:ResponseDict

Note

Requires use of REST API 1.5 or later.

eradicate_pgroup(pgroup)[source]

Eradicate a destroyed pgroup.

Parameters:pgroup (str) – Name of pgroup to be eradicated.
Returns:A dictionary mapping “name” to pgroup.
Return type:ResponseDict

Note

Requires use of REST API 1.2 or later.

eradicate_volume(volume)[source]

Eradicate a destroyed volume or snapshot.

Parameters:volume (str) – Name of the volume to be eradicated.
Returns:A dictionary mapping “name” to volume.
Return type:ResponseDict

Note

This operation fails if volume is not destroyed.

extend_volume(volume, size)[source]

Extend a volume to a new, larger size.

Parameters:
  • volume (str) – Name of the volume to be extended.
  • size (int or str) – Size in bytes, or string representing the size of the volume to be created.
Returns:

A dictionary mapping “name” to volume and “size” to the volume’s new size in bytes.

Return type:

ResponseDict

Note

The new size must be larger than the volume’s old size.

Note

The maximum volume size supported is 4 petabytes (4 * 2^50).

Note

If size is an int, it must be a multiple of 512.

Note

If size is a string, it must consist of an integer followed by a valid suffix.

Accepted Suffixes

Suffix Size Bytes
S Sector (2^9)
K Kilobyte (2^10)
M Megabyte (2^20)
G Gigabyte (2^30)
T Terabyte (2^40)
P Petabyte (2^50)
flag_message(message_id)[source]

Flag an alert message or audit record.

Parameters:message_id (int or str) – ID of message to be flagged.
Returns:A dictionary mapping “id” to message_id.
Return type:ResponseDict
get(**kwargs)[source]

Get array attributes.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET array
Returns:A dictionary describing the array or a list of dictionaries describing multiple array attributes, depending on the arguments passed in.
Return type:ResponseDict or ResponseList
get_alert_recipient(address)[source]

Return a dictionary describing an alert recipient.

Parameters:address (str) – Email address of alert recipient to get information about.
Returns:A dictionary mapping “name” to address and “enabled” to True if that alert recipient is enabled, False otherwise.
Return type:ResponseDict
get_api_token(admin)[source]

Returns a dictionary describing an admin’s API token.

Parameters:admin (str) – Name of admin whose API token to get.
Returns:A dictionary mapping “name” to admin, “api_token” to the admin’s API token, and “created” to the time the token was created as an ISO formatted string.
Return type:ResponseDict
get_certificate(**kwargs)[source]

Get the attributes of the current array certificate.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET cert
Returns:A dictionary describing the configured array certificate.
Return type:ResponseDict

Note

Requires use of REST API 1.3 or later.

get_certificate_signing_request(**kwargs)[source]

Construct a certificate signing request (CSR) for signing by a certificate authority (CA).

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET cert/certificate_signing_request
Returns:A dictionary mapping “certificate_signing_request” to the CSR.
Return type:ResponseDict

Note

Requires use of REST API 1.3 or later.

get_console_lock_status()[source]

Get console-lock status of the array.

Returns:A dictionary mapping “console_lock” to “enabled” if console_lock is enabled, else “disabled”.
Return type:ResponseDict
get_directory_service(**kwargs)[source]

Return a dictionary describing directory service configuration.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET directoryservice
Returns:A dictionary describing the status of the directory service.
Return type:ResponseDict
get_dns()[source]

Get current DNS settings.

Returns:A dictionary describing current DNS settings.
Return type:ResponseDict
get_drive(drive)[source]

Get drive attributes.

Parameters:drive (str) – Name of drive to get information about.
Returns:A dictionary describing drive.
Return type:ResponseDict
get_hardware(component, **kwargs)[source]

Returns a dictionary describing a hardware component.

Parameters:
  • component (str) – Name of hardware component to get information about.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET hardware/:component
Returns:

A dictionary describing component.

Return type:

ResponseDict

get_hgroup(hgroup, **kwargs)[source]

Return a list of dictionaries describing a host group.

Parameters:
  • hgroup (str) – Name of hgroup to get information about.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET hgroup/:hgroup
Returns:

A dictionary describing hgroup.

Return type:

ResponseDict

get_host(host, **kwargs)[source]

Return a dictionary describing a host.

Parameters:
  • host (str) – Name of host to get information about.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET host/:host
Returns:

A dictionary describing host.

Return type:

ResponseDict

get_manual_phonehome_status()[source]

Get manually-initiated phonehome status.

Returns:A dictionary describing the current status of a manually-initiated phonehome.
Return type:ResponseDict
get_network_interface(interface)[source]

Return a dictionary describing a network interface.

Parameters:interface (str) – Name of network interface to get information about.
Returns:A dictionary describing the interface.
Return type:ResponseDict
get_pgroup(pgroup, **kwargs)[source]

Return dictionary describing a pgroup or snapshot.

Parameters:
  • pgroup (str) – Name of pgroup to get information about.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET pgroup
Returns:

A list describing snapshots of the pgroup if the paramater snap is passed as True, else a dictionary describing the pgroup.

Return type:

ResponseDict or ResponseList

Note

Requires use of REST API 1.2 or later.

get_phonehome()[source]

Return a dictionary describing if hourly phonehome is enabled.

Returns:A dictionary mapping “phonehome” to “enabled” if hourly phonehome is enabled, mapping to “disabled” otherwise.
Return type:ResponseDict
get_publickey(admin)[source]

Returns a dictionary describing an admin’s public key.

Parameters:admin (str) – Name of admin whose public key to get.
Returns:A dictionary mapping “name” to admin and “publickey” to “****”.
Return type:ResponseDict
get_remote_assist_status()[source]

Return a dictionary describing whether remote assist is enabled.

Returns:A dictionary describing the current status of the remote assist connection.
Return type:ResponseDict
get_rest_version()[source]

Get the REST API version being used by this object.

Returns:The REST API version.
Return type:str
get_snmp_engine_id()[source]

Return the SNMP v3 engine ID generated for the array.

Returns:A dictionary mapping “engine_id” to the array’s SNMP engine ID.
Return type:ResponseDict

Note

Requires use of SNMP v3.

get_snmp_manager(manager)[source]

Return a dictionary describing an SNMP manager.

Parameters:manager (str) – Name of SNMP manager to get information about.
Returns:A dictionary describing manager.
Return type:ResponseDict
get_subnet(subnet)[source]

Return a dictionary describing a subnet.

Parameters:subnet (str) – Name of the subnet to get information about.
Returns:A dictionary describing the subnet.
Return type:ResponseDict

Note

Requires use of REST API 1.5 or later.

get_volume(volume, **kwargs)[source]

Return a dictionary describing a volume or snapshot.

Parameters:
  • volume (str) – Name of the volume to get information about.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET volume/:volume
Returns:

A list describing snapshots of the volume if the paramater snap is passed as True, else a dictionary describing the volume.

Return type:

ResponseDict or ResponseList

End the REST API session by invalidating the current session cookie.

Note

Calling any other methods again creates a new cookie. This method is intended to be called when the FlashArray object is no longer needed.

list_alert_recipients()[source]

Return a list of dictionaries describing alert recipients.

Returns:A list of dictionaries mapping “name” to a recipient’s address and “enabled” to True if that recipient is enabled, False otherwise, for each alert recipient.
Return type:ResponseList
list_api_tokens(**kwargs)[source]

Returns a list of dictionaries describing REST API tokens.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET admin
Returns:A list of dictionaries mapping “name” to admin, “api_token” to the admin’s API token, and “created” to the time the token was created as an ISO formatted string for each admin with an API token set.
Return type:ResponseList

Note

The API tokens are replaced with “****” unless the parameter expose is passed as True.

list_array_connections(**kwargs)[source]

Return list of connected arrays.

Returns:A list of dictionaries describing each connection to another array.
Return type:ResponseList

Note

Requires use of REST API 1.2 or later.

list_drives()[source]

Returns a list of dictionaries describing SSD and NVRAM modules.

Returns:A list of dictionaries describing each drive.
Return type:ResponseList
list_hardware(**kwargs)[source]

Returns a list of dictionaries describing hardware.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET hardware
Returns:A list of dictionaries describing each hardware component.
Return type:ResponseList
list_hgroup_connections(hgroup)[source]

Return a list of dictionaries describing shared connected volumes.

Parameters:hgroup (str) – Name of hgroup for which to list connections.
Returns:A list of dictionaries describing hgroup’s connections.
Return type:ResponseList
list_hgroups(**kwargs)[source]

Return a list of dictionaries describing each host group.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET hgroup
Returns:A list of dictionaries describing each hgroup.
Return type:ResponseList
list_host_connections(host, **kwargs)[source]

Return a list of dictionaries describing connected volumes.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET host/:host/volume
Returns:A list of dictionaries describing host’s connections.
Return type:ResponseList
list_hosts(**kwargs)[source]

Return a list of dictionaries describing each host.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET host
Returns:A list of dictionaries describing each host.
Return type:ResponseList
list_messages(**kwargs)[source]

Return a list of alert messages.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET message
Returns:A list of dictionaries describing each message.
Return type:ResponseList
list_network_interfaces()[source]

Get a list of dictionaries describing network interfaces.

Returns:A list of dictionaries describing each network interface.
Return type:ResponseList
list_pgroups(**kwargs)[source]

Return list dictionaries describing each pgroup.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET pgroup
Returns:A list of dictionaries describing each pgroup.
Return type:ResponseList

Note

Requires use of REST API 1.2 or later.

list_ports(**kwargs)[source]

List SAN ports.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET port
Returns:A list of dictionaries describing each port.
Return type:ResponseList
list_publickeys()[source]

Return a list of dictionaries describing public keys.

Returns:A list of dictionaries mapping “name” to a username and “publickey” to “****” for each admin with a public key set.
Return type:ResponseList
list_snmp_managers()[source]

Return a list of dictionaries describing SNMP managers.

Returns:A list of dictionaries describing each SNMP manager.
Return type:ResponseList
list_subnets(**kwargs)[source]

Get a list of dictionaries describing subnets.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET subnet
Returns:A list of dictionaries describing each subnet.
Return type:ResponseList

Note

Requires use of REST API 1.5 or later.

list_volume_block_differences(volume, **kwargs)[source]

Return a list of block differences for the specified volume.

Parameters:
  • volume (str) – Name of the volume to get information about.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET volume/:volume/diff
Returns:

A list of dictionaries describing block differences between the specified volume and the base volume.

Return type:

ResponseList

Note

Requires use of REST API 1.3 or later.

list_volume_private_connections(volume, **kwargs)[source]

Return a list of dictionaries describing connected hosts.

Parameters:volume (str) – Name of the volume for which to list the private connections.
Returns:A list of dictionaries describing the volume’s private connections.
Return type:ResponseList
list_volume_shared_connections(volume, **kwargs)[source]

Return a list of dictionaries describing connected host groups.

Parameters:volume (str) – Name of the volume for which to list the shared connections.
Returns:A list of dictionaries describing the volume’s shared connections.
Return type:ResponseList
list_volumes(**kwargs)[source]

Return a list of dictionaries describing each volume.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET volume
Returns:A list of dictionaries describing each volume.
Return type:ResponseList
static page_through(page_size, function, *args, **kwargs)[source]

Return an iterator over all pages of a REST operation.

Parameters:
  • page_size – Number of elements to retrieve per call.
  • function – FlashArray function that accepts limit as an argument.
  • *args – Positional arguments to be passed to function.
  • **kwargs – Keyword arguments to be passed to function.
Returns:

An iterator of tuples containing a page of results for the function(*args, **kwargs) and None, or None and a PureError if a call to retrieve a page fails.

Return type:

iterator

Note

Requires use of REST API 1.7 or later.

Only works with functions that accept limit as an argument.

Iterator will retrieve page_size elements per call

Iterator will yield None and an error if a call fails. The next call will repeat the same call, unless the caller sends in an alternate page token.

phonehome(action)[source]

Manually initiate or cancel a phonehome action.

Parameters:action (str) – The timeframe of logs to phonehome or cancel the current phonehome.

Note

action must be one of: (“send_today”, “send_yesterday”, “send_all”, “cancel”).

Returns:A dictionary describing the current status of the phonehome request.
Return type:ResponseDict
recover_pgroup(pgroup)[source]

Recover a destroyed pgroup that has not yet been eradicated.

Parameters:pgroup (str) – Name of pgroup to be recovered.
Returns:A dictionary mapping “name” to pgroup.
Return type:ResponseDict

Note

Requires use of REST API 1.2 or later.

recover_volume(volume)[source]

Recover a volume that has been destroyed but not eradicated.

Parameters:volume (str) – Name of volume to be recovered.
Returns:A dictionary mapping “name” to volume.
Return type:ResponseDict

Note

This must be done within the 24 hours following a volume’s destruction or it will be eradicated.

refresh_admin(admin, **kwargs)[source]

Refresh the admin permission cache for the specified admin.

Parameters:
  • admin (str) – Name of admin whose permission cache is to be refreshed.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: GET admin
Returns:

A dictionary mapping “name” to admin and “role” to the admin’s role.

Return type:

ResponseDict

Note

Setting the optional parameter clear to True only clears the cache without doing an LDAP lookup to get new permissions.

refresh_admins()[source]

Clear the admin permission cache.

Returns:A dictionary mapping “name” to “[ALL]” and “role” to None.
Return type:ResponseDict

Note

Does not immediately do any LDAP lookups to get new permissions.

remove_hgroup(hgroup, pgroup)[source]

Remove an hgroup from a pgroup.

Parameters:
  • hgroup (str) – Name of the hgroup to remove from pgroup.
  • pgroup (str) – pgroup from which to remove hgroup.
Returns:

A dictionary mapping “name” to hgroup and “protection_group” to pgroup.

Return type:

ResponseDict

Note

Requires use of REST API 1.7 or later.

remove_host(host, pgroup)[source]

Remove a host from a pgroup.

Parameters:
  • host (str) – Name of the host to remove from pgroup.
  • pgroup (str) – pgroup from which to remove host.
Returns:

A dictionary mapping “name” to host and “protection_group” to pgroup.

Return type:

ResponseDict

Note

Requires use of REST API 1.7 or later.

remove_volume(volume, pgroup)[source]

Remove a volume from a pgroup.

Parameters:
  • volume (str) – Name of the volume to remove from pgroup.
  • pgroup (str) – pgroup from which to remove volume.
Returns:

A dictionary mapping “name” to volume and “protection_group” to pgroup.

Return type:

ResponseDict

Note

Requires use of REST API 1.7 or later.

rename(name)[source]

Rename the array.

Parameters:
  • name – The new name for the array.
  • type – str
Returns:

A dictionary mapping “array_name” to name.

Return type:

ResponseDict

rename_hgroup(hgroup, name)[source]

Rename a host group.

Parameters:
  • hgroup (str) – Name of hgroup to be renamed.
  • name (str) – New name of hgroup to be renamed.
Returns:

A dictionary mapping “name” to name.

Return type:

ResponseDict

rename_host(host, name)[source]

Rename a host.

Parameters:
  • host (str) – Name of host to be renamed.
  • name (str) – New name of host to be renamed.
Returns:

A dictionary mapping “name” to name.

Return type:

ResponseDict

rename_pgroup(pgroup, name)[source]

Rename a pgroup.

Parameters:
  • pgroup (str) – Current name of pgroup to be renamed.
  • name (str) – New name of pgroup to be renamed.
Returns:

A dictionary mapping “name” to name.

Return type:

ResponseDict

Note

Requires use of REST API 1.2 or later.

rename_snmp_manager(manager, name)[source]

Rename an SNMP manager.

Parameters:
  • manager (str) – Current name of the SNMP manager to be renamed.
  • name (str) – New name of the SNMP manager to be renamed.
Returns:

A dictionary describing the renamed SNMP manager.

Return type:

ResponseDict

rename_subnet(subnet, name)[source]

Rename a subnet.

Parameters:
  • subnet (str) – Current name of the subnet to be renamed.
  • name (str) – New name of the subnet to be renamed.
Returns:

A dictionary describing the renamed subnet.

Return type:

ResponseDict

Note

Requires use of REST API 1.5 or later.

rename_volume(volume, name)[source]

Rename a volume.

Parameters:
  • volume (str) – Name of the volume to be renamed.
  • name (str) – New name of volume to be renamed.
Returns:

A dictionary mapping “name” to name.

Return type:

ResponseDict

Note

All snapshots of the named volume also are renamed to the new name, followed by its previous suffix.

set(**kwargs)[source]

Set array attributes.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT array
Returns:A dictionary mapping the parameter that was set to its new value.
Return type:ResponseDict
set_certificate(**kwargs)[source]

Create a self-signed certificate or imports a certificate signed by a certificate authority (CA).

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT cert
Returns:A dictionary describing the configured array certificate.
Return type:ResponseDict

Note

Requires use of REST API 1.3 or later.

set_directory_service(**kwargs)[source]

Set an attribute of the directory service configuration.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT directoryservice
Returns:A dictionary describing the status of the directory service.
Return type:ResponseDict
set_dns(**kwargs)[source]

Set DNS settings.

Parameters:**kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT dns
Returns:A dictionary describing current DNS settings.
Return type:ResponseDict
set_hardware(component, **kwargs)[source]

Set an attribute of a hardware component.

Parameters:
  • component (str) – Name of component for which to set attribute.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT hardware/:component
Returns:

A dictionary describing component.

Return type:

ResponseDict

set_hgroup(hgroup, **kwargs)[source]

Set an attribute of a host group.

Parameters:
  • hgroup (str) – Name of hgroup for which to set attribute.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT hgroup/:hgroup
Returns:

A dictionary describing hgroup.

Return type:

ResponseDict

set_host(host, **kwargs)[source]

Set an attribute of a host.

Parameters:
  • host (str) – Name of host for which to set attribute.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT host/:host
Returns:

A dictionary describing host.

Return type:

ResponseDict

set_network_interface(interface, **kwargs)[source]

Set network interface attributes.

Parameters:
  • interface (str) – Name of network interface for which to set attribute.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT network/:network_component
Returns:

A dictionary describing the interface.

Return type:

ResponseDict

set_password(admin, new_password, old_password)[source]

Set an admin’s password.

Parameters:
  • admin (str) – Name of admin whose password is to be set.
  • new_password (str) – New password for admin.
  • old_password (str) – Current password of admin.
Returns:

A dictionary mapping “name” to admin.

Return type:

ResponseDict

set_pgroup(pgroup, **kwargs)[source]

Set an attribute of a pgroup.

Parameters:
  • pgroup (str) – Name of pgroup for which to set attribute.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT pgroup/:pgroup
Returns:

A dictionary describing pgroup.

Return type:

ResponseDict

Note

Requires use of REST API 1.2 or later.

set_publickey(admin, key)[source]

Set the public key associated with an admin.

Parameters:
  • admin (str) – Name of admin whose public key is to be set.
  • key (str) – New public key for admin.
Returns:

A dictionary mapping “name” to admin and “publickey” to “****”

Return type:

ResponseDict

set_snmp_manager(manager, **kwargs)[source]

Set an attribute of an SNMP manager.

Parameters:
  • manager (str) – Name of the SNMP manager for which to set an attribute.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT snmp/:manager
Returns:

A dictionary describing manager.

Return type:

ResponseDict

set_subnet(subnet, **kwargs)[source]

Set subnet attributes.

Parameters:
  • subnet (str) – Name of subnet for which to set attribute.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT subnet/:subnet
Returns:

A dictionary describing the subnet.

Return type:

ResponseDict

Note

Requires use of REST API 1.5 or later.

test_alert()[source]

Send test alerts to all recipients.

Returns:A list of dictionaries describing the test outcome for each recipient.
Return type:ResponseList
test_alert_recipient(address)[source]

Send a test alert to the specified recipient.

Parameters:address (str) – Address of recipient of test alert.
Returns:A dictionary describing the test outcome.
Return type:ResponseDict
test_directory_service()[source]

Test the directory service.

Returns:A dictionary mapping “output” to the output of the directory service test.
Return type:ResponseDict
test_snmp_manager(manager)[source]

Send a test trap to a manager.

Parameters:manager (str) – SNMP manager to which to send a test trap.
Returns:A dictionary mapping “output” to the output of the test.
Return type:ResponseDict
throttle_array_connection(address, **kwargs)[source]

Set bandwidth limits on a connection.

Parameters:
  • address (str) – IP address or DNS name of other array.
  • **kwargs (optional) – See the REST API Guide on your array for the documentation on the request: PUT array/connection/:address
Returns:

A dictionary describing the connection to the other array.

Return type:

ResponseDict

Note

Requires use of REST API 1.5 or later.

truncate_volume(volume, size)[source]

Truncate a volume to a new, smaller size.

Parameters:
  • volume (str) – Name of the volume to truncate.
  • size (int or str) – Size in bytes, or string representing the size of the volume to be created.
Returns:

A dictionary mapping “name” to volume and “size” to the volume’s new size in bytes.

Return type:

ResponseDict

Note

A snapshot of the volume in its previous state is taken and immediately destroyed, but it is available for recovery for the 24 hours following the truncation.

class purestorage.PureError(reason)[source]

Exception type raised by FlashArray object.

Parameters:reason (str) – A message describing why the error occurred.
Variables:reason (str) – A message describing why the error occurred.
class purestorage.PureHTTPError(target, rest_version, response)[source]

Exception raised as a result of non-200 response status code.

Parameters:
  • target (str) – IP or DNS name of the array that received the HTTP request.
  • rest_version (str) – The REST API version that was used when making the request.
  • response (requests.Response) – The response of the HTTP request that caused the error.
Variables:
  • target (str) – IP or DNS name of the array that received the HTTP request.
  • rest_version (str) – The REST API version that was used when making the request.
  • code (int) – The HTTP response status code of the request.
  • headers (dict) – A dictionary containing the header information. Keys are case-insensitive.
  • reason (str) – The textual reason for the HTTP status code (e.g. “BAD REQUEST”).
  • text (str) – The body of the response which may contain a message explaining the error.

Note

The error message in text is not guaranteed to be consistent across REST versions, and thus should not be programmed against.

Indices and tables