Files
deb-python-openstacksdk/doc/source/users/guides/connect.rst
Andreas Jaeger 0c7a3430ac Fix URLs for CLI Reference
The CLI Reference Guide has been moved, update links to point to new
location.

Change-Id: I5c4efe89ab11718eb561c82540a94e5a0ee8a550
2016-01-16 17:40:48 +01:00

1.8 KiB

Connect

In order to work with an OpenStack cloud you first need to create a ~openstack.connection.Connection to it using your credentials. A ~openstack.connection.Connection can be created in 3 ways, using the class itself, a file, or environment variables. If this is your first time using the SDK, we recommend simply using the class itself as illustrated below.

Note

To get your credentials Download the OpenStack RC file.

Create Connection

To create a connection you need a ~openstack.profile.Profile and a ~openstack.connection.Connection.

../examples/connect.py

The ~openstack.profile.Profile sets your preferences for each service. You will pass it the region of the OpenStack cloud that this connection will use.

The ~openstack.connection.Connection is a context for a connection to an OpenStack cloud. You will primarily use it to set the ~openstack.profile.Profile and authentication information. You can also set the user_agent to something that describes your application (e.g. my-web-app/1.3.4).

Full example at connect.py

Note

To enable logging, see the logging user guide.

Next

Now that you can create a connection, continue with the user_guides to work with an OpenStack service.

As an alternative to creating a ~openstack.connection.Connection using the class itself, you can connect using a file or environment variables. See the connect_from_config user guide.