# openstackclient.api package

## Submodules

## openstackclient.api.api module

Base API Library

class openstackclient.api.api.BaseAPI(session: Any = None, service_type: str | None = None, endpoint: str | None = None, **kwargs: Any)

  Bases: `KeystoneSession`

  Base API

  create(url: str, session: Any = None, method: str | None = None, **params: Any) → Any

    Create a new resource

    Parameters:

      - url (string) – The API-specific portion of the URL path

      - session (Session) – HTTP client session

      - method (string) – HTTP method (default POST)

  delete(url: str, session: Any = None, **params: Any) → Any

    Delete a resource

    Parameters:

      - url (string) – The API-specific portion of the URL path

      - session (Session) – HTTP client session

  find(path: str, value: str, attr: str) → Any

    Find a single resource by name or ID

    Parameters:

      - path (string) – The API-specific portion of the URL path

      - value (string) – search expression

      - attr (string) – name of attribute for secondary search

  find_attr(path: str, value: str | None = None, attr: str | None = None, resource: str | None = None) → Any

    Find a resource via attribute or ID

    Most APIs return a list wrapped by a dict with the resource name as key. Some APIs (Identity) return a dict when a query string is present and there is one return value. Take steps to unwrap these bodies and return a single dict without any resource wrappers.

    Parameters:

      - path (string) – The API-specific portion of the URL path

      - value (string) – value to search for

      - attr (string) – attribute to use for resource search

      - resource (string) – plural of the object resource name; defaults to path

    For example:

      n = find(netclient, ‘network’, ‘networks’, ‘matrix’)

  find_bulk(path: str, **kwargs: Any) → Any

    Bulk load and filter locally

    Parameters:

      - path (string) – The API-specific portion of the URL path

      - kwargs – A dict of AVPs to match - logical AND

    Returns:

      list of resource dicts

  find_one(path: str, **kwargs: Any) → Any

    Find a resource by name or ID

    Parameters:

      path (string) – The API-specific portion of the URL path

    Returns:

      resource dict

  list(path: str, session: Any = None, body: Any = None, detailed: bool = False, **params: Any) → Any

    Return a list of resources

    GET ${ENDPOINT}/${PATH}?${PARAMS}

    path is often the object’s plural resource type

    Parameters:

      - path (string) – The API-specific portion of the URL path

      - session (Session) – HTTP client session

      - body – data that will be encoded as JSON and passed in POST request (GET will be sent by default)

      - detailed (bool) – Adds ‘/details’ to path for some APIs to return extended attributes

    Returns:

      JSON-decoded response, could be a list or a dict-wrapped-list

class openstackclient.api.api.KeystoneSession(session: Any = None, endpoint: str | None = None, **kwargs: Any)

  Bases: `object`

  Wrapper for the Keystone Session

  Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world.

## openstackclient.api.compute_v2 module

Compute v2 API Library

A collection of wrappers for deprecated Compute v2 APIs that are not intentionally supported by SDK. Most of these are proxy APIs.

openstackclient.api.compute_v2.create_floating_ip(compute_client: Any, network: str) → Any

  Create a new floating ip

  https://docs.openstack.org/api-ref/compute/#create-allocate-floating-ip-address

  Parameters:

    network – Name of floating IP pool

  Returns:

    A floating IP object

openstackclient.api.compute_v2.create_network(compute_client: Any, name: str, subnet: str, share_subnet: bool | None = None) → Any

  Create a new network

  https://docs.openstack.org/api-ref/compute/#create-network

  Parameters:

    - compute_client – A compute client

    - name (str) – Network label

    - subnet (int) – Subnet for IPv4 fixed addresses in CIDR notation

    - share_subnet (bool) – Shared subnet between projects

  Returns:

    A network object

openstackclient.api.compute_v2.create_security_group(compute_client: Any, name: str | None = None, description: str | None = None) → Any

  Create a new security group

  https://docs.openstack.org/api-ref/compute/#create-security-group

  Parameters:

    - compute_client – A compute client

    - name (str) – Security group name

    - description (str) – Security group description

  Returns:

    A security group object

openstackclient.api.compute_v2.create_security_group_rule(compute_client: Any, security_group_id: str | None = None, ip_protocol: str | None = None, from_port: int | None = None, to_port: int | None = None, remote_ip: str | None = None, remote_group: str | None = None) → Any

  Create a new security group rule

  https://docs.openstack.org/api-ref/compute/#create-security-group-rule

  Parameters:

    - compute_client – A compute client

    - security_group_id (str) – Security group ID

    - ip_protocol (str) – IP protocol, ‘tcp’, ‘udp’ or ‘icmp’

    - from_port (int) – Source port

    - to_port (int) – Destination port

    - remote_ip (str) – Source IP address in CIDR notation

    - remote_group (str) – Remote security group

  Returns:

    A security group object

openstackclient.api.compute_v2.delete_floating_ip(compute_client: Any, floating_ip_id: str) → None

  Delete a floating IP

  https://docs.openstack.org/api-ref/compute/#delete-deallocate-floating-ip-address

  Parameters:

    floating_ip_id (string) – The floating IP address

  Returns:

    None

openstackclient.api.compute_v2.delete_network(compute_client: Any, network_id: str) → None

  Delete a network

  https://docs.openstack.org/api-ref/compute/#delete-network

  Parameters:

    - compute_client – A compute client

    - network_id (string) – The network ID

  Returns:

    None

openstackclient.api.compute_v2.delete_security_group(compute_client: Any, security_group_id: str | None = None) → None

  Delete a security group

  https://docs.openstack.org/api-ref/compute/#delete-security-group

  Parameters:

    - compute_client – A compute client

    - security_group_id (str) – Security group ID

  Returns:

    None

openstackclient.api.compute_v2.delete_security_group_rule(compute_client: Any, security_group_rule_id: str | None = None) → None

  Delete a security group rule

  https://docs.openstack.org/api-ref/compute/#delete-security-group-rule

  Parameters:

    - compute_client – A compute client

    - security_group_rule_id (str) – Security group rule ID

  Returns:

    None

openstackclient.api.compute_v2.find_network(compute_client: Any, name_or_id: str) → Any

  Find the network for a given name or ID

  https://docs.openstack.org/api-ref/compute/#show-network-details

  Parameters:

    - compute_client – A compute client

    - name_or_id – The name or ID of the network to look up

  Returns:

    A network object

  Raises:

    exception.NotFound – If a matching network could not be found or more than one match was found

openstackclient.api.compute_v2.find_security_group(compute_client: Any, name_or_id: str) → Any

  Find the security group for a given name or ID

  https://docs.openstack.org/api-ref/compute/#show-security-group-details

  Parameters:

    - compute_client – A compute client

    - name_or_id – The name or ID of the security group to look up

  Returns:

    A security group object

  Raises:

    exception.NotFound – If a matching security group could not be found or more than one match was found

openstackclient.api.compute_v2.get_floating_ip(compute_client: Any, floating_ip_id: str) → Any

  Get a floating IP

  https://docs.openstack.org/api-ref/compute/#show-floating-ip-address-details

  Parameters:

    floating_ip_id (string) – The floating IP address

  Returns:

    A floating IP object

openstackclient.api.compute_v2.list_floating_ip_pools(compute_client: Any) → Any

  Get all floating IP pools

  https://docs.openstack.org/api-ref/compute/#list-floating-ip-pools

  Parameters:

    compute_client – A compute client

  Returns:

    A list of floating IP pool objects

openstackclient.api.compute_v2.list_floating_ips(compute_client: Any) → Any

  Get all floating IPs

  https://docs.openstack.org/api-ref/compute/#list-floating-ip-addresses

  Returns:

    A list of floating IP objects

openstackclient.api.compute_v2.list_networks(compute_client: Any) → Any

  Get all networks

  https://docs.openstack.org/api-ref/compute/#list-networks

  Parameters:

    compute_client – A compute client

  Returns:

    A list of network objects

openstackclient.api.compute_v2.list_security_groups(compute_client: Any, all_projects: bool | None = None) → Any

  Get all security groups

  https://docs.openstack.org/api-ref/compute/#list-security-groups

  Parameters:

    - compute_client – A compute client

    - all_projects (bool) – If true, list from all projects

  Returns:

    A list of security group objects

openstackclient.api.compute_v2.update_security_group(compute_client: Any, security_group_id: str, name: str | None = None, description: str | None = None) → Any

  Update an existing security group

  https://docs.openstack.org/api-ref/compute/#update-security-group

  Parameters:

    - compute_client – A compute client

    - security_group_id (str) – The ID of the security group to update

    - name (str) – Security group name

    - description (str) – Security group description

  Returns:

    A security group object

## openstackclient.api.object_store_v1 module

Object Store v1 API Library

class openstackclient.api.object_store_v1.APIv1(**kwargs: Any)

  Bases: `BaseAPI`

  Object Store v1 API

  account_set(properties: dict[str, str]) → None

    Set account properties

    Parameters:

      properties (dict) – properties to add or update for the account

  account_show() → dict[str, Any]

    Show account details

  account_unset(properties: dict[str, str]) → None

    Unset account properties

    Parameters:

      properties (dict) – properties to remove from the account

  container_create(container: str, public: bool = False, storage_policy: str | None = None) → dict[str, Any | None]

    Create a container

    Parameters:

      - container (string) – name of container to create

      - public (bool) – Boolean value indicating if the container should be publicly readable. Defaults to False.

      - storage_policy (string) – Name of the a specific storage policy to use. If not specified swift will use its default storage policy.

    Returns:

      dict of returned headers

  container_delete(container: str) → None

    Delete a container

    Parameters:

      container (string) – name of container to delete

  container_list(full_listing: bool = False, limit: int | None = None, marker: str | None = None, end_marker: str | None = None, prefix: str | None = None, **params: Any) → Any

    Get containers in an account

    Parameters:

      - full_listing (boolean) – if True, return a full listing, else returns a max of 10000 listings

      - limit (integer) – query return count limit

      - marker (string) – query marker

      - end_marker (string) – query end_marker

      - prefix (string) – query prefix

    Returns:

      list of container names

  container_save(container: str) → None

    Save all the content from a container

    Parameters:

      container (string) – name of container to save

  container_set(container: str, properties: dict[str, str]) → None

    Set container properties

    Parameters:

      - container (string) – name of container to modify

      - properties (dict) – properties to add or update for the container

  container_show(container: str) → dict[str, Any]

    Get container details

    Parameters:

      container (string) – name of container to show

    Returns:

      dict of returned headers

  container_unset(container: str, properties: dict[str, str]) → None

    Unset container properties

    Parameters:

      - container (string) – name of container to modify

      - properties (dict) – properties to remove from the container

  object_create(container: str, object: str, name: str | None = None) → dict[str, Any]

    Create an object inside a container

    Parameters:

      - container (string) – name of container to store object

      - object (string) – local path to object

      - name (string) – name of object to create

    Returns:

      dict of returned headers

  object_delete(container: str, object: str) → None

    Delete an object from a container

    Parameters:

      - container (string) – name of container that stores object

      - object (string) – name of object to delete

  object_list(container: str, full_listing: bool = False, limit: int | None = None, marker: str | None = None, end_marker: str | None = None, delimiter: str | None = None, prefix: str | None = None, **params: Any) → Any

    List objects in a container

    Parameters:

      - container (string) – container name to get a listing for

      - full_listing (boolean) – if True, return a full listing, else returns a max of 10000 listings

      - limit (integer) – query return count limit

      - marker (string) – query marker

      - end_marker (string) – query end_marker

      - prefix (string) – query prefix

      - delimiter (string) – string to delimit the queries on

    Returns:

      a tuple of (response headers, a list of objects) The response headers will be a dict and all header names will be lowercase.

  object_save(container: str, object: str, file: str | None = None) → None

    Save an object stored in a container

    Parameters:

      - container (string) – name of container that stores object

      - object (string) – name of object to save

      - file (string) – local name of object

  object_set(container: str, object: str, properties: dict[str, str]) → None

    Set object properties

    Parameters:

      - container (string) – container name for object to modify

      - object (string) – name of object to modify

      - properties (dict) – properties to add or update for the container

  object_show(container: str, object: str) → dict[str, Any]

    Get object details

    Parameters:

      - container (string) – container name for object to get

      - object (string) – name of object to get

    Returns:

      dict of object properties

  object_unset(container: str, object: str, properties: dict[str, str]) → None

    Unset object properties

    Parameters:

      - container (string) – container name for object to modify

      - object (string) – name of object to modify

      - properties (dict) – properties to remove from the object

## openstackclient.api.volume_v2 module

Volume v2 API Library

A collection of wrappers for deprecated Block Storage v2 APIs that are not intentionally supported by SDK.

openstackclient.api.volume_v2.find_consistency_group(compute_client: Any, name_or_id: str) → Any

  Find the consistency group for a given name or ID

  https://docs.openstack.org/api-ref/block-storage/v3/#show-a-consistency-group-s-details

  Parameters:

    - volume_client – A volume client

    - name_or_id – The name or ID of the consistency group to look up

  Returns:

    A consistency group object

  Raises:

    exception.NotFound – If a matching consistency group could not be found or more than one match was found

## openstackclient.api.volume_v3 module

Volume v3 API Library

A collection of wrappers for deprecated Block Storage v3 APIs that are not intentionally supported by SDK.

openstackclient.api.volume_v3.find_consistency_group(compute_client: Any, name_or_id: str) → Any

  Find the consistency group for a given name or ID

  https://docs.openstack.org/api-ref/block-storage/v3/#show-a-consistency-group-s-details

  Parameters:

    - volume_client – A volume client

    - name_or_id – The name or ID of the consistency group to look up

  Returns:

    A consistency group object

  Raises:

    exception.NotFound – If a matching consistency group could not be found or more than one match was found

## Module contents

this page last updated: 2026-07-15 15:33:41

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.