openstacksdk - doc 翻译(/doc/users/compute.rst)

Connect

In order to work with an OpenStack cloud you first need to create a
:class:~openstack.connection.Connection to it using your credentials. A
:class:~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.

(为了与openstack云交互,你应该创建一个Conenction实例去使用你的凭证。
创建它有三种方式,使用类本身,使用一个配置文件,或者环境变量。如果你是第一次使用SDK,那么建议你使用第一种方式,正如下面要讲的。)

Create Connection (创建Connection)

To create a connection you need a :class:~openstack.profile.Profile and a
:class:~openstack.connection.Connection.
(为了创建一个连接你需要一个Profile类和一个Connection类。)

.. literalinclude:: ../examples/connect.py (例子)
:pyobject: create_connection

The :class:~openstack.profile.Profile sets your preferences for each
service. You will pass it the region of the OpenStack cloud that this
connection will use. (有点奇怪,修改为:You can pass it the region of the OpenStack cloud and this
connection will use.不知道会不会有错)
(这个Profile类设置你的首选项为每个service, 你将会 )

The :class:~openstack.connection.Connection is a context for a connection
to an OpenStack cloud. You will primarily use it to set the
:class:~openstack.profile.Profile and authentication information. You can
also set the user_agent to something that describes your application

(Connection类是连接到openstack云上面的上下文,你主要用它去设置profile和验证信息。
你也能设置user_agent为其他什么的能够描述你的应用的东西。)

(e.g. my-web-app/1.3.4).

Full example at connect.py _

.. note:: To enable logging, see the :doc:logging user guide.
(打开log,你可以查看文档logging在user guide里面。)
Next


Now that you can create a connection, continue with the :ref:user_guides
to work with an OpenStack service.
(现在你能够创建连接,你可以在user_guides里面去继续查看与openstack service交互。)

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

你可能感兴趣的:(openstacksdk - doc 翻译(/doc/users/compute.rst))