Getting started with the OpenStack SDK

Getting started with the OpenStack SDK

For a listing of terms used throughout the SDK, including the names of projects and services supported by it, see the glossary.

Installation

The OpenStack SDK is available on PyPI under the name openstacksdk. To install it, use pip:

$ pip install openstacksdk

User Guides

These guides walk you through how to make use of the libraries we provide to work with each OpenStack service. If you’re looking for a cookbook approach, this is where you’ll want to begin.

API Documentation

Service APIs are exposed through a two-layered approach. The classes exposed through our Connection Interface are the place to start if you’re an application developer consuming an OpenStack cloud. The Resource Interface is the layer upon which the Connection Interface is built, with methods on Service Proxies accepting and returning Resource objects.

The Cloud Abstraction layer has a data model.

Connection Interface

A Connection instance maintains your cloud config, session and authentication information providing you with a set of higher-level interfaces to work with OpenStack services.

Once you have a Connection instance, services are accessed through instances of BaseProxy or subclasses of it that exist as attributes on the Connection.

class openstack.proxy.BaseProxy(session=None, task_manager=None, *args, **kwargs)

Represents a service.

wait_for_status(**kwargs)

Wait for a resource to be in a particular status.

param value:The resource to wait on to reach the status. The resource must have a status attribute.
type value:Resource
param status:Desired status of the resource.
param list failures:
 Statuses that would indicate the transition failed such as ‘ERROR’.
param interval:Number of seconds to wait between checks.
param wait:Maximum number of seconds to wait for the change.
return:Method returns resource on success.
raises:ResourceTimeout transition to status failed to occur in wait seconds.
raises:ResourceFailure resource transitioned to one of the failure states.
raises:AttributeError if the resource does not have a status attribute

Deprecated in 0.9.14, to be removed in 2.0.0. This is no longer a part of the proxy base, service-specific subclasses should expose this as needed. See resource.wait_for_status for this behavior

wait_for_delete(**kwargs)

Wait for the resource to be deleted.

param value:The resource to wait on to be deleted.
type value:Resource
param interval:Number of seconds to wait between checks.
param wait:Maximum number of seconds to wait for the delete.
return:Method returns resource on success.
raises:ResourceTimeout transition to delete failed to occur in wait seconds.

Deprecated in 0.9.14, to be removed in 2.0.0. This is no longer a part of the proxy base, service-specific subclasses should expose this as needed. See resource.wait_for_delete for this behavior

Service Proxies

The following service proxies exist on the Connection. The service proxies are all always present on the Connection object, but the combination of your CloudRegion and the catalog of the cloud in question control which services can be used.

Resource Interface

The Resource layer is a lower-level interface to communicate with OpenStack services. While the classes exposed by the Service Proxies build a convenience layer on top of this, Resource objects can be used directly. However, the most common usage of this layer is in receiving an object from a class in the Connection Interface_, modifying it, and sending it back to the Service Proxies layer, such as to update a resource on the server.

The following services have exposed Resource classes.

Low-Level Classes

The following classes are not commonly used by application developers, but are used to construct applications to talk to OpenStack APIs. Typically these parts are managed through the Connection Interface, but their use can be customized.

Presentations

Creative Commons Attribution 3.0 License

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