Rework config and rest layers

This is a large and invasive change to the underlying guts. Most casual
use should not notice a difference, but advanced users, especially those
using the Profile or Authenticator interfaces or making use of pluggable
providers will be broken.

The overall intent is to align directly on top of the mechanisms that
came from os-client-config for config and to use keystoneauth1's Adapter
interface to make use of the canonical implementations of such things as
service and version discovery. The end goal is that openstacksdk
provides the REST interaction layer for python-openstackclient, shade,
Ansible and nodepool.

Replace profile with openstack.config

os-client-config is used by shade and python-openstackclient to read
and process configuration. openstacksdk also can use the
os-client-config interface, but translates it internally into the
Profile object. As os-client-config has been injested into
openstack.config, remove Profile and just use the config classes.

Make proxy subclass of adapter

This gives every service a generic passthrough for REST calls, which
means we can map unknown service-type values to a generic proxy.

Strip endpoint_filter

We're passing Adapters around, not sessions. Doing so means that
self.service and endpoint_filter have become unnecessary.

Rename _Request.uri to _Request.url

This is a stepping-stone to replacing _Request with requests.Request and
using requests.Session.prepare_request inside of _prepare_request.

Rename service proxy instances to match their official service-type.

Aliases are kept for the old versions, but make the canonical versions
match the official name.

Rename bare_metal to baremetal
Rename cluster to clustering
Rename block_store to block_storage
Rename telemetry to meter

Create generic proxies for all services in STA

Every service listed in service types authority is an OpenStack service.
Even if we don't know about it in SDK, we should at the very least have
a low-level Adapter for it so that people can use REST calls while
waiting on the SDK to add higher-level constructs.

The pypy jobs are happily green. Run them as voting rather than
non-voting.

Add syntatic sugar alias for making connections

Typing:

  import openstack.connection
  conn = openstack.connection.Connection(cloud='example')

is annoying. This allows:

  import openstack
  conn = openstack.connect(cloud='example')

Use task_manager and Adapter from shade

As a stepping-stone towards shade and sdk codepaths being rationalized,
we need to get SDK using the Adapter from shade that submits requests
into the TaskManager. For normal operation this is a passthrough/no-op
sort of thing, but it's essential for high-volume consumers such as
nodepool.

This exposes a bunch of places in tests where we're mocking a bit too
deeply. We should go back through and fix all of those via
requests_mock, but that's WAY too much for today.

This was a 'for later' task, but it turns out that the move to Adapter
was causing exceptions to be thrown that were not the exceptions that
were intended to be caught in the SDK layer, which was causing
functional tests of things like GET operations to fail. So it became a
today task.

Change-Id: I7b46e263a76d84573bdfbbece57b1048764ed939
This commit is contained in:
Monty Taylor 2017-08-11 15:58:38 -05:00
parent a25f8f3518
commit 4bad718783
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
299 changed files with 2356 additions and 3562 deletions

View File

@ -220,6 +220,7 @@
- project:
name: openstack/python-openstacksdk
templates:
- openstack-pypy-jobs
- openstacksdk-functional-tips
- openstacksdk-tox-tips
check:

View File

@ -5,15 +5,6 @@ The following diagram shows how the project is laid out.
.. literalinclude:: layout.txt
Session
-------
The :class:`openstack.session.Session` manages an authenticator,
transport, and user profile. It exposes methods corresponding to
HTTP verbs, and injects your authentication token into a request,
determines any service preferences callers may have set, gets the endpoint
from the authenticator, and sends the request out through the transport.
Resource
--------
@ -26,7 +17,7 @@ service's ``https://openstack:1234/v2/servers`` resource.
The base ``Resource`` contains methods to support the typical
`CRUD <http://en.wikipedia.org/wiki/Create,_read,_update_and_delete>`_
operations supported by REST APIs, and handles the construction of URLs
and calling the appropriate HTTP verb on the given ``Session``.
and calling the appropriate HTTP verb on the given ``Adapter``.
Values sent to or returned from the service are implemented as attributes
on the ``Resource`` subclass with type :class:`openstack.resource.prop`.
@ -63,10 +54,10 @@ Each service implements a ``Proxy`` class, within the
``openstack/<program_name>/vX/_proxy.py`` module. For example, the v2 compute
service's ``Proxy`` exists in ``openstack/compute/v2/_proxy.py``.
This ``Proxy`` class manages a :class:`~openstack.sessions.Session` and
This ``Proxy`` class contains a :class:`~keystoneauth1.adapter.Adapter` and
provides a higher-level interface for users to work with via a
:class:`~openstack.connection.Connection` instance. Rather than requiring
users to maintain their own session and work with lower-level
users to maintain their own ``Adapter`` and work with lower-level
:class:`~openstack.resource.Resource` objects, the ``Proxy`` interface
offers a place to make things easier for the caller.
@ -77,7 +68,7 @@ Each ``Proxy`` class implements methods which act on the underlying
return flavor.Flavor.list(self.session, **params)
This method is operating on the ``openstack.compute.v2.flavor.Flavor.list``
method. For the time being, it simply passes on the ``Session`` maintained
method. For the time being, it simply passes on the ``Adapter`` maintained
by the ``Proxy``, and returns what the underlying ``Resource.list`` method
does.
@ -88,9 +79,9 @@ way which will apply nicely across all of the services.
Connection
----------
The :class:`openstack.connection.Connection` class builds atop a ``Session``
object, and provides a higher level interface constructed of ``Proxy``
objects from each of the services.
The :class:`openstack.connection.Connection` class builds atop a
:class:`os_client_config.config.CloudConfig` object, and provides a higher
level interface constructed of ``Proxy`` objects from each of the services.
The ``Connection`` class' primary purpose is to act as a high-level interface
to this SDK, managing the lower level connecton bits and exposing the

View File

@ -1,7 +1,6 @@
openstack/
connection.py
resource.py
session.py
compute/
compute_service.py
v2/

View File

@ -26,9 +26,9 @@ class EnforcementError(errors.SphinxError):
def get_proxy_methods():
"""Return a set of public names on all proxies"""
names = ["openstack.bare_metal.v1._proxy",
"openstack.block_store.v2._proxy",
"openstack.cluster.v1._proxy",
names = ["openstack.baremetal.v1._proxy",
"openstack.clustering.v1._proxy",
"openstack.block_storage.v2._proxy",
"openstack.compute.v2._proxy",
"openstack.database.v1._proxy",
"openstack.identity.v2._proxy",
@ -43,8 +43,8 @@ def get_proxy_methods():
"openstack.network.v2._proxy",
"openstack.object_store.v1._proxy",
"openstack.orchestration.v1._proxy",
"openstack.telemetry.v2._proxy",
"openstack.telemetry.alarm.v2._proxy",
"openstack.meter.v2._proxy",
"openstack.meter.alarm.v2._proxy",
"openstack.workflow.v2._proxy"]
modules = (importlib.import_module(name) for name in names)

View File

@ -2,6 +2,8 @@
Configuring os-client-config Applications
===========================================
.. _config-environment-variables:
Environment Variables
---------------------
@ -22,6 +24,8 @@ for trove set
export OS_DATABASE_SERVICE_TYPE=rax:database
.. _config-clouds-yaml:
Config Files
------------

View File

@ -1,7 +1,7 @@
Using OpenStack Bare Metal
Using OpenStack Baremetal
===========================
Before working with the Bare Metal service, you'll need to create a
Before working with the Baremetal service, you'll need to create a
connection to your OpenStack cloud by following the :doc:`connect` user
guide. This will provide you with the ``conn`` variable used in the examples
below.

View File

@ -1,7 +1,7 @@
Using OpenStack Block Store
===========================
Using OpenStack Block Storage
=============================
Before working with the Block Store service, you'll need to create a
Before working with the Block Storage service, you'll need to create a
connection to your OpenStack cloud by following the :doc:`connect` user
guide. This will provide you with the ``conn`` variable used in the examples
below.

View File

@ -1,36 +0,0 @@
..
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
=======================
Using OpenStack Cluster
=======================
Before working with the Cluster service, you'll need to create a connection
to your OpenStack cloud by following the :doc:`connect` user guide. This will
provide you with the ``conn`` variable used by all examples in this guide.
The primary abstractions/resources of the Cluster service are:
.. toctree::
:maxdepth: 1
Profile Type <cluster/profile_type>
Profile <cluster/profile>
Cluster <cluster/cluster>
Node <cluster/node>
Policy Type <cluster/policy_type>
Policy <cluster/policy>
Receiver <cluster/receiver>
Action <cluster/action>
Event <cluster/event>

View File

@ -0,0 +1,37 @@
..
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
================================
Using OpenStack Clustering
================================
Before working with the Clustering service, you'll need to create a
connection to your OpenStack cloud by following the :doc:`connect` user guide.
This will provide you with the ``conn`` variable used by all examples in this
guide.
The primary abstractions/resources of the Clustering service are:
.. toctree::
:maxdepth: 1
Profile Type <clustering/profile_type>
Profile <clustering/profile>
Cluster <clustering/cluster>
Node <clustering/node>
Policy Type <clustering/policy_type>
Policy <clustering/policy>
Receiver <clustering/receiver>
Action <clustering/action>
Event <clustering/event>

View File

@ -26,7 +26,7 @@ List Policies
To examine the list of policies:
.. literalinclude:: ../../examples/cluster/policy.py
.. literalinclude:: ../../examples/clustering/policy.py
:pyobject: list_policies
When listing policies, you can specify the sorting option using the ``sort``
@ -42,7 +42,7 @@ Create Policy
When creating a policy, you will provide a dictionary with keys and values
according to the policy type referenced.
.. literalinclude:: ../../examples/cluster/policy.py
.. literalinclude:: ../../examples/clustering/policy.py
:pyobject: create_policy
Optionally, you can specify a ``metadata`` keyword argument that contains some
@ -56,7 +56,7 @@ Find Policy
To find a policy based on its name or ID:
.. literalinclude:: ../../examples/cluster/policy.py
.. literalinclude:: ../../examples/clustering/policy.py
:pyobject: find_policy
Full example: `manage policy`_
@ -67,7 +67,7 @@ Get Policy
To get a policy based on its name or ID:
.. literalinclude:: ../../examples/cluster/policy.py
.. literalinclude:: ../../examples/clustering/policy.py
:pyobject: get_policy
Full example: `manage policy`_
@ -79,7 +79,7 @@ Update Policy
After a policy is created, most of its properties are immutable. Still, you
can update a policy's ``name`` and/or ``metadata``.
.. literalinclude:: ../../examples/cluster/policy.py
.. literalinclude:: ../../examples/clustering/policy.py
:pyobject: update_policy
The Cluster service doesn't allow updating the ``spec`` of a policy. The only
@ -95,8 +95,8 @@ A policy can be deleted after creation, provided that it is not referenced
by any active clusters or nodes. If you attempt to delete a policy that is
still in use, you will get an error message.
.. literalinclude:: ../../examples/cluster/policy.py
.. literalinclude:: ../../examples/clustering/policy.py
:pyobject: delete_policy
.. _manage policy: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/cluster/policy.py
.. _manage policy: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/clustering/policy.py

View File

@ -25,7 +25,7 @@ List Policy Types
To examine the known policy types:
.. literalinclude:: ../../examples/cluster/policy_type.py
.. literalinclude:: ../../examples/clustering/policy_type.py
:pyobject: list_policy_types
Full example: `manage policy type`_
@ -37,9 +37,9 @@ Get Policy Type
To retrieve the details about a policy type, you need to provide the name of
it.
.. literalinclude:: ../../examples/cluster/policy_type.py
.. literalinclude:: ../../examples/clustering/policy_type.py
:pyobject: get_policy_type
Full example: `manage policy type`_
.. _manage policy type: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/cluster/policy_type.py
.. _manage policy type: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/clustering/policy_type.py

View File

@ -26,7 +26,7 @@ List Profiles
To examine the list of profiles:
.. literalinclude:: ../../examples/cluster/profile.py
.. literalinclude:: ../../examples/clustering/profile.py
:pyobject: list_profiles
When listing profiles, you can specify the sorting option using the ``sort``
@ -42,7 +42,7 @@ Create Profile
When creating a profile, you will provide a dictionary with keys and values
specified according to the profile type referenced.
.. literalinclude:: ../../examples/cluster/profile.py
.. literalinclude:: ../../examples/clustering/profile.py
:pyobject: create_profile
Optionally, you can specify a ``metadata`` keyword argument that contains some
@ -56,7 +56,7 @@ Find Profile
To find a profile based on its name or ID:
.. literalinclude:: ../../examples/cluster/profile.py
.. literalinclude:: ../../examples/clustering/profile.py
:pyobject: find_profile
The Cluster service doesn't allow updating the ``spec`` of a profile. The only
@ -70,7 +70,7 @@ Get Profile
To get a profile based on its name or ID:
.. literalinclude:: ../../examples/cluster/profile.py
.. literalinclude:: ../../examples/clustering/profile.py
:pyobject: get_profile
Full example: `manage profile`_
@ -82,7 +82,7 @@ Update Profile
After a profile is created, most of its properties are immutable. Still, you
can update a profile's ``name`` and/or ``metadata``.
.. literalinclude:: ../../examples/cluster/profile.py
.. literalinclude:: ../../examples/clustering/profile.py
:pyobject: update_profile
The Cluster service doesn't allow updating the ``spec`` of a profile. The only
@ -98,8 +98,8 @@ A profile can be deleted after creation, provided that it is not referenced
by any active clusters or nodes. If you attempt to delete a profile that is
still in use, you will get an error message.
.. literalinclude:: ../../examples/cluster/profile.py
.. literalinclude:: ../../examples/clustering/profile.py
:pyobject: delete_profile
.. _manage profile: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/cluster/profile.py
.. _manage profile: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/clustering/profile.py

View File

@ -25,7 +25,7 @@ List Profile Types
To examine the known profile types:
.. literalinclude:: ../../examples/cluster/profile_type.py
.. literalinclude:: ../../examples/clustering/profile_type.py
:pyobject: list_profile_types
Full example: `manage profile type`_
@ -36,9 +36,9 @@ Get Profile Type
To get the details about a profile type, you need to provide the name of it.
.. literalinclude:: ../../examples/cluster/profile_type.py
.. literalinclude:: ../../examples/clustering/profile_type.py
:pyobject: get_profile_type
Full example: `manage profile type`_
.. _manage profile type: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/cluster/profile_type.py
.. _manage profile type: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/clustering/profile_type.py

View File

@ -4,29 +4,20 @@ 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.
created in 3 ways, using the class itself, :ref:`config-clouds-yaml`, or
:ref:`config-environment-variables`. It is recommended to always use
:ref:`config-clouds-yaml` as the same config can be used across tools and
languages.
Create Connection
-----------------
To create a connection you need a :class:`~openstack.profile.Profile` and a
:class:`~openstack.connection.Connection`.
To create a :class:`~openstack.connection.Connection` instance, use the
:func:`~openstack.connect` factory function.
.. 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.
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
(e.g. ``my-web-app/1.3.4``).
Full example at `connect.py <http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/connect.py>`_
.. note:: To enable logging, see the :doc:`logging` user guide.
@ -37,5 +28,9 @@ Now that you can create a connection, continue with the :ref:`user_guides`
to work with an 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.
using :ref:config-clouds-yaml, you can connect using
`config-environment-variables`.
.. TODO(shade) Update the text here and consolidate with the old
os-client-config docs so that we have a single and consistent explanation
of the envvars cloud, etc.

View File

@ -1,10 +1,10 @@
Using OpenStack Telemetry
Using OpenStack Meter
=========================
.. caution::
BETA: This API is a work in progress and is subject to change.
Before working with the Telemetry service, you'll need to create a connection
Before working with the Meter service, you'll need to create a connection
to your OpenStack cloud by following the :doc:`connect` user guide. This will
provide you with the ``conn`` variable used in the examples below.

View File

@ -28,19 +28,19 @@ approach, this is where you'll want to begin.
Connect to an OpenStack Cloud <guides/connect>
Connect to an OpenStack Cloud Using a Config File <guides/connect_from_config>
Logging <guides/logging>
Bare Metal <guides/bare_metal>
Block Store <guides/block_store>
Cluster <guides/cluster>
Baremetal <guides/baremetal>
Block Storage <guides/block_storage>
Clustering <guides/clustering>
Compute <guides/compute>
Database <guides/database>
Identity <guides/identity>
Image <guides/image>
Key Manager <guides/key_manager>
Message <guides/message>
Meter <guides/meter>
Network <guides/network>
Object Store <guides/object_store>
Orchestration <guides/orchestration>
Telemetry <guides/telemetry>
API Documentation
-----------------
@ -54,26 +54,26 @@ interface is the layer upon which the *Connection* is built, with
Connection Interface
********************
A *Connection* instance maintains your session, authentication, transport,
and profile, providing you with a set of higher-level interfaces to work
with OpenStack services.
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.
.. toctree::
:maxdepth: 1
connection
profile
Once you have a *Connection* instance, the following services may be exposed
to you. Your user profile determine the full set of exposed services,
but listed below are the ones provided by this SDK by default.
to you. The combination of your ``CloudConfig`` and the catalog of the cloud
in question control which services are exposed, but listed below are the ones
provided by the SDK.
.. toctree::
:maxdepth: 1
Bare Metal <proxies/bare_metal>
Block Store <proxies/block_store>
Cluster <proxies/cluster>
Baremetal <proxies/baremetal>
Block Storage <proxies/block_storage>
Clustering <proxies/clustering>
Compute <proxies/compute>
Database <proxies/database>
Identity v2 <proxies/identity_v2>
@ -85,10 +85,10 @@ but listed below are the ones provided by this SDK by default.
Message v1 <proxies/message_v1>
Message v2 <proxies/message_v2>
Network <proxies/network>
Meter <proxies/meter>
Metric <proxies/metric>
Object Store <proxies/object_store>
Orchestration <proxies/orchestration>
Telemetry <proxies/telemetry>
Workflow <proxies/workflow>
Resource Interface
@ -106,20 +106,20 @@ The following services have exposed *Resource* classes.
.. toctree::
:maxdepth: 1
Bare Metal <resources/bare_metal/index>
Block Store <resources/block_store/index>
Cluster <resources/cluster/index>
Baremetal <resources/baremetal/index>
Block Storage <resources/block_storage/index>
Clustering <resources/clustering/index>
Compute <resources/compute/index>
Database <resources/database/index>
Identity <resources/identity/index>
Image <resources/image/index>
Key Management <resources/key_manager/index>
Load Balancer <resources/load_balancer/index>
Meter <resources/meter/index>
Metric <resources/metric/index>
Network <resources/network/index>
Orchestration <resources/orchestration/index>
Object Store <resources/object_store/index>
Telemetry <resources/telemetry/index>
Workflow <resources/workflow/index>
Low-Level Classes
@ -133,7 +133,6 @@ can be customized.
.. toctree::
:maxdepth: 1
session
resource
resource2
service_filter

View File

@ -1,9 +0,0 @@
Profile
=======
.. automodule:: openstack.profile
Profile Object
--------------
.. autoclass:: openstack.profile.Profile
:members:

View File

@ -1,76 +0,0 @@
Bare Metal API
==============
For details on how to use bare_metal, see :doc:`/users/guides/bare_metal`
.. automodule:: openstack.bare_metal.v1._proxy
The BareMetal Class
--------------------
The bare_metal high-level interface is available through the ``bare_metal``
member of a :class:`~openstack.connection.Connection` object.
The ``bare_metal`` member will only be added if the service is detected.
Node Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.bare_metal.v1._proxy.Proxy
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.create_node
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.update_node
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.delete_node
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.get_node
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.find_node
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.nodes
Port Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.bare_metal.v1._proxy.Proxy
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.create_port
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.update_port
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.delete_port
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.get_port
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.find_port
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.ports
Port Group Operations
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.bare_metal.v1._proxy.Proxy
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.create_port_group
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.update_port_group
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.delete_port_group
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.get_port_group
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.find_port_group
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.port_groups
Driver Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.bare_metal.v1._proxy.Proxy
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.drivers
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.get_driver
Chassis Operations
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.bare_metal.v1._proxy.Proxy
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.create_chassis
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.update_chassis
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.delete_chassis
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.get_chassis
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.find_chassis
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.chassis
Deprecated Methods
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.bare_metal.v1._proxy.Proxy
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.create_portgroup
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.update_portgroup
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.delete_portgroup
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.get_portgroup
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.find_portgroup
.. automethod:: openstack.bare_metal.v1._proxy.Proxy.portgroups

View File

@ -0,0 +1,76 @@
Baremetal API
==============
For details on how to use baremetal, see :doc:`/users/guides/baremetal`
.. automodule:: openstack.baremetal.v1._proxy
The Baremetal Class
--------------------
The baremetal high-level interface is available through the ``baremetal``
member of a :class:`~openstack.connection.Connection` object.
The ``baremetal`` member will only be added if the service is detected.
Node Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.baremetal.v1._proxy.Proxy
.. automethod:: openstack.baremetal.v1._proxy.Proxy.create_node
.. automethod:: openstack.baremetal.v1._proxy.Proxy.update_node
.. automethod:: openstack.baremetal.v1._proxy.Proxy.delete_node
.. automethod:: openstack.baremetal.v1._proxy.Proxy.get_node
.. automethod:: openstack.baremetal.v1._proxy.Proxy.find_node
.. automethod:: openstack.baremetal.v1._proxy.Proxy.nodes
Port Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.baremetal.v1._proxy.Proxy
.. automethod:: openstack.baremetal.v1._proxy.Proxy.create_port
.. automethod:: openstack.baremetal.v1._proxy.Proxy.update_port
.. automethod:: openstack.baremetal.v1._proxy.Proxy.delete_port
.. automethod:: openstack.baremetal.v1._proxy.Proxy.get_port
.. automethod:: openstack.baremetal.v1._proxy.Proxy.find_port
.. automethod:: openstack.baremetal.v1._proxy.Proxy.ports
Port Group Operations
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.baremetal.v1._proxy.Proxy
.. automethod:: openstack.baremetal.v1._proxy.Proxy.create_port_group
.. automethod:: openstack.baremetal.v1._proxy.Proxy.update_port_group
.. automethod:: openstack.baremetal.v1._proxy.Proxy.delete_port_group
.. automethod:: openstack.baremetal.v1._proxy.Proxy.get_port_group
.. automethod:: openstack.baremetal.v1._proxy.Proxy.find_port_group
.. automethod:: openstack.baremetal.v1._proxy.Proxy.port_groups
Driver Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.baremetal.v1._proxy.Proxy
.. automethod:: openstack.baremetal.v1._proxy.Proxy.drivers
.. automethod:: openstack.baremetal.v1._proxy.Proxy.get_driver
Chassis Operations
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.baremetal.v1._proxy.Proxy
.. automethod:: openstack.baremetal.v1._proxy.Proxy.create_chassis
.. automethod:: openstack.baremetal.v1._proxy.Proxy.update_chassis
.. automethod:: openstack.baremetal.v1._proxy.Proxy.delete_chassis
.. automethod:: openstack.baremetal.v1._proxy.Proxy.get_chassis
.. automethod:: openstack.baremetal.v1._proxy.Proxy.find_chassis
.. automethod:: openstack.baremetal.v1._proxy.Proxy.chassis
Deprecated Methods
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.baremetal.v1._proxy.Proxy
.. automethod:: openstack.baremetal.v1._proxy.Proxy.create_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.update_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.delete_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.get_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.find_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.portgroups

View File

@ -0,0 +1,43 @@
Block Storage API
=================
For details on how to use block_storage, see :doc:`/users/guides/block_storage`
.. automodule:: openstack.block_storage.v2._proxy
The BlockStorage Class
----------------------
The block_storage high-level interface is available through the
``block_storage`` member of a :class:`~openstack.connection.Connection` object.
The ``block_storage`` member will only be added if the service is detected.
Volume Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.block_storage.v2._proxy.Proxy
.. automethod:: openstack.block_storage.v2._proxy.Proxy.create_volume
.. automethod:: openstack.block_storage.v2._proxy.Proxy.delete_volume
.. automethod:: openstack.block_storage.v2._proxy.Proxy.get_volume
.. automethod:: openstack.block_storage.v2._proxy.Proxy.volumes
Type Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.block_storage.v2._proxy.Proxy
.. automethod:: openstack.block_storage.v2._proxy.Proxy.create_type
.. automethod:: openstack.block_storage.v2._proxy.Proxy.delete_type
.. automethod:: openstack.block_storage.v2._proxy.Proxy.get_type
.. automethod:: openstack.block_storage.v2._proxy.Proxy.types
Snapshot Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.block_storage.v2._proxy.Proxy
.. automethod:: openstack.block_storage.v2._proxy.Proxy.create_snapshot
.. automethod:: openstack.block_storage.v2._proxy.Proxy.delete_snapshot
.. automethod:: openstack.block_storage.v2._proxy.Proxy.get_snapshot
.. automethod:: openstack.block_storage.v2._proxy.Proxy.snapshots

View File

@ -1,43 +0,0 @@
Block Store API
===============
For details on how to use block_store, see :doc:`/users/guides/block_store`
.. automodule:: openstack.block_store.v2._proxy
The BlockStore Class
--------------------
The block_store high-level interface is available through the ``block_store``
member of a :class:`~openstack.connection.Connection` object.
The ``block_store`` member will only be added if the service is detected.
Volume Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.block_store.v2._proxy.Proxy
.. automethod:: openstack.block_store.v2._proxy.Proxy.create_volume
.. automethod:: openstack.block_store.v2._proxy.Proxy.delete_volume
.. automethod:: openstack.block_store.v2._proxy.Proxy.get_volume
.. automethod:: openstack.block_store.v2._proxy.Proxy.volumes
Type Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.block_store.v2._proxy.Proxy
.. automethod:: openstack.block_store.v2._proxy.Proxy.create_type
.. automethod:: openstack.block_store.v2._proxy.Proxy.delete_type
.. automethod:: openstack.block_store.v2._proxy.Proxy.get_type
.. automethod:: openstack.block_store.v2._proxy.Proxy.types
Snapshot Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.block_store.v2._proxy.Proxy
.. automethod:: openstack.block_store.v2._proxy.Proxy.create_snapshot
.. automethod:: openstack.block_store.v2._proxy.Proxy.delete_snapshot
.. automethod:: openstack.block_store.v2._proxy.Proxy.get_snapshot
.. automethod:: openstack.block_store.v2._proxy.Proxy.snapshots

View File

@ -1,177 +0,0 @@
Cluster API
===========
.. automodule:: openstack.cluster.v1._proxy
The Cluster Class
-----------------
The cluster high-level interface is available through the ``cluster``
member of a :class:`~openstack.connection.Connection` object. The
``cluster`` member will only be added if the service is detected.
Build Info Operations
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_build_info
Profile Type Operations
^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.profile_types
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_profile_type
Profile Operations
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.create_profile
.. automethod:: openstack.cluster.v1._proxy.Proxy.update_profile
.. automethod:: openstack.cluster.v1._proxy.Proxy.delete_profile
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_profile
.. automethod:: openstack.cluster.v1._proxy.Proxy.find_profile
.. automethod:: openstack.cluster.v1._proxy.Proxy.profiles
.. automethod:: openstack.cluster.v1._proxy.Proxy.validate_profile
Policy Type Operations
^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.policy_types
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_policy_type
Policy Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.create_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.update_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.delete_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.find_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.policies
.. automethod:: openstack.cluster.v1._proxy.Proxy.validate_policy
Cluster Operations
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.create_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.update_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.delete_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.find_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.clusters
.. automethod:: openstack.cluster.v1._proxy.Proxy.check_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.recover_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.resize_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.scale_in_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.scale_out_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.collect_cluster_attrs
.. automethod:: openstack.cluster.v1._proxy.Proxy.perform_operation_on_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.add_nodes_to_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.remove_nodes_from_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.replace_nodes_in_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.attach_policy_to_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.update_cluster_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.detach_policy_from_cluster
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_cluster_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_policies
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_add_nodes
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_attach_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_del_nodes
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_detach_policy
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_operation
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_replace_nodes
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_resize
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_scale_in
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_scale_out
.. automethod:: openstack.cluster.v1._proxy.Proxy.cluster_update_policy
Node Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.create_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.update_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.delete_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.find_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.nodes
.. automethod:: openstack.cluster.v1._proxy.Proxy.check_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.recover_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.perform_operation_on_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.adopt_node
.. automethod:: openstack.cluster.v1._proxy.Proxy.node_operation
Receiver Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.create_receiver
.. automethod:: openstack.cluster.v1._proxy.Proxy.update_receiver
.. automethod:: openstack.cluster.v1._proxy.Proxy.delete_receiver
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_receiver
.. automethod:: openstack.cluster.v1._proxy.Proxy.find_receiver
.. automethod:: openstack.cluster.v1._proxy.Proxy.receivers
Action Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_action
.. automethod:: openstack.cluster.v1._proxy.Proxy.actions
Event Operations
^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.get_event
.. automethod:: openstack.cluster.v1._proxy.Proxy.events
Helper Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.wait_for_delete
.. automethod:: openstack.cluster.v1._proxy.Proxy.wait_for_status
Service Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.cluster.v1._proxy.Proxy
.. automethod:: openstack.cluster.v1._proxy.Proxy.services

View File

@ -0,0 +1,177 @@
Cluster API
===========
.. automodule:: openstack.clustering.v1._proxy
The Cluster Class
-----------------
The cluster high-level interface is available through the ``cluster``
member of a :class:`~openstack.connection.Connection` object. The
``cluster`` member will only be added if the service is detected.
Build Info Operations
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_build_info
Profile Type Operations
^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.profile_types
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_profile_type
Profile Operations
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.create_profile
.. automethod:: openstack.clustering.v1._proxy.Proxy.update_profile
.. automethod:: openstack.clustering.v1._proxy.Proxy.delete_profile
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_profile
.. automethod:: openstack.clustering.v1._proxy.Proxy.find_profile
.. automethod:: openstack.clustering.v1._proxy.Proxy.profiles
.. automethod:: openstack.clustering.v1._proxy.Proxy.validate_profile
Policy Type Operations
^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.policy_types
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_policy_type
Policy Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.create_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.update_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.delete_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.find_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.policies
.. automethod:: openstack.clustering.v1._proxy.Proxy.validate_policy
Cluster Operations
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.create_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.update_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.delete_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.find_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.clusters
.. automethod:: openstack.clustering.v1._proxy.Proxy.check_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.recover_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.resize_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.scale_in_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.scale_out_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.collect_cluster_attrs
.. automethod:: openstack.clustering.v1._proxy.Proxy.perform_operation_on_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.add_nodes_to_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.remove_nodes_from_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.replace_nodes_in_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.attach_policy_to_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.update_cluster_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.detach_policy_from_cluster
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_cluster_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_policies
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_add_nodes
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_attach_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_del_nodes
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_detach_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_operation
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_replace_nodes
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_resize
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_scale_in
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_scale_out
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_update_policy
Node Operations
^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.create_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.update_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.delete_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.find_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.nodes
.. automethod:: openstack.clustering.v1._proxy.Proxy.check_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.recover_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.perform_operation_on_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.adopt_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.node_operation
Receiver Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.create_receiver
.. automethod:: openstack.clustering.v1._proxy.Proxy.update_receiver
.. automethod:: openstack.clustering.v1._proxy.Proxy.delete_receiver
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_receiver
.. automethod:: openstack.clustering.v1._proxy.Proxy.find_receiver
.. automethod:: openstack.clustering.v1._proxy.Proxy.receivers
Action Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_action
.. automethod:: openstack.clustering.v1._proxy.Proxy.actions
Event Operations
^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_event
.. automethod:: openstack.clustering.v1._proxy.Proxy.events
Helper Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.wait_for_delete
.. automethod:: openstack.clustering.v1._proxy.Proxy.wait_for_status
Service Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.clustering.v1._proxy.Proxy
.. automethod:: openstack.clustering.v1._proxy.Proxy.services

View File

@ -0,0 +1,85 @@
Meter API
=============
.. caution::
BETA: This API is a work in progress and is subject to change.
For details on how to use meter, see :doc:`/users/guides/meter`
.. automodule:: openstack.meter.v2._proxy
The Meter Class
-------------------
The meter high-level interface is available through the ``meter``
member of a :class:`~openstack.connection.Connection` object. The
``meter`` member will only be added if the service is detected.
Sample Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.meter.v2._proxy.Proxy
.. automethod:: openstack.meter.v2._proxy.Proxy.find_sample
.. automethod:: openstack.meter.v2._proxy.Proxy.samples
Statistic Operations
^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.meter.v2._proxy.Proxy
.. automethod:: openstack.meter.v2._proxy.Proxy.find_statistics
.. automethod:: openstack.meter.v2._proxy.Proxy.statistics
Resource Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.meter.v2._proxy.Proxy
.. automethod:: openstack.meter.v2._proxy.Proxy.get_resource
.. automethod:: openstack.meter.v2._proxy.Proxy.find_resource
.. automethod:: openstack.meter.v2._proxy.Proxy.resources
Meter Operations
^^^^^^^^^^^^^^^^
.. autoclass:: openstack.meter.v2._proxy.Proxy
.. automethod:: openstack.meter.v2._proxy.Proxy.find_meter
.. automethod:: openstack.meter.v2._proxy.Proxy.meters
Capability Operations
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.meter.v2._proxy.Proxy
.. automethod:: openstack.meter.v2._proxy.Proxy.find_capability
.. automethod:: openstack.meter.v2._proxy.Proxy.capabilities
The Alarm Class
---------------
The alarm high-level interface is available through the ``meter.alarm``
member of a :class:`~openstack.connection.Connection` object. The
``meter.alarm`` member will only be added if the service is detected.
Alarm Operations
^^^^^^^^^^^^^^^^
.. autoclass:: openstack.meter.alarm.v2._proxy.Proxy
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.create_alarm
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.update_alarm
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.delete_alarm
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.get_alarm
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.find_alarm
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.alarms
Alarm Change Operations
^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.meter.alarm.v2._proxy.Proxy
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.find_alarm_change
.. automethod:: openstack.meter.alarm.v2._proxy.Proxy.alarm_changes

View File

@ -1,85 +0,0 @@
Telemetry API
=============
.. caution::
BETA: This API is a work in progress and is subject to change.
For details on how to use telemetry, see :doc:`/users/guides/telemetry`
.. automodule:: openstack.telemetry.v2._proxy
The Telemetry Class
-------------------
The telemetry high-level interface is available through the ``telemetry``
member of a :class:`~openstack.connection.Connection` object. The
``telemetry`` member will only be added if the service is detected.
Sample Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.telemetry.v2._proxy.Proxy
.. automethod:: openstack.telemetry.v2._proxy.Proxy.find_sample
.. automethod:: openstack.telemetry.v2._proxy.Proxy.samples
Statistic Operations
^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.telemetry.v2._proxy.Proxy
.. automethod:: openstack.telemetry.v2._proxy.Proxy.find_statistics
.. automethod:: openstack.telemetry.v2._proxy.Proxy.statistics
Resource Operations
^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.telemetry.v2._proxy.Proxy
.. automethod:: openstack.telemetry.v2._proxy.Proxy.get_resource
.. automethod:: openstack.telemetry.v2._proxy.Proxy.find_resource
.. automethod:: openstack.telemetry.v2._proxy.Proxy.resources
Meter Operations
^^^^^^^^^^^^^^^^
.. autoclass:: openstack.telemetry.v2._proxy.Proxy
.. automethod:: openstack.telemetry.v2._proxy.Proxy.find_meter
.. automethod:: openstack.telemetry.v2._proxy.Proxy.meters
Capability Operations
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.telemetry.v2._proxy.Proxy
.. automethod:: openstack.telemetry.v2._proxy.Proxy.find_capability
.. automethod:: openstack.telemetry.v2._proxy.Proxy.capabilities
The Alarm Class
---------------
The alarm high-level interface is available through the ``telemetry.alarm``
member of a :class:`~openstack.connection.Connection` object. The
``telemetry.alarm`` member will only be added if the service is detected.
Alarm Operations
^^^^^^^^^^^^^^^^
.. autoclass:: openstack.telemetry.alarm.v2._proxy.Proxy
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.create_alarm
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.update_alarm
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.delete_alarm
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.get_alarm
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.find_alarm
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.alarms
Alarm Change Operations
^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.telemetry.alarm.v2._proxy.Proxy
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.find_alarm_change
.. automethod:: openstack.telemetry.alarm.v2._proxy.Proxy.alarm_changes

View File

@ -1,4 +1,4 @@
Bare Metal Resources
Baremetal Resources
=====================
.. toctree::

View File

@ -1,12 +1,12 @@
openstack.bare_metal.v1.chassis
openstack.baremetal.v1.chassis
===============================
.. automodule:: openstack.bare_metal.v1.chassis
.. automodule:: openstack.baremetal.v1.chassis
The Chassis Class
-----------------
The ``Chassis`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.bare_metal.v1.chassis.Chassis
.. autoclass:: openstack.baremetal.v1.chassis.Chassis
:members:

View File

@ -1,12 +1,12 @@
openstack.bare_metal.v1.driver
openstack.baremetal.v1.driver
==============================
.. automodule:: openstack.bare_metal.v1.driver
.. automodule:: openstack.baremetal.v1.driver
The Driver Class
----------------
The ``Driver`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.bare_metal.v1.driver.Driver
.. autoclass:: openstack.baremetal.v1.driver.Driver
:members:

View File

@ -1,12 +1,12 @@
openstack.bare_metal.v1.Node
openstack.baremetal.v1.Node
============================
.. automodule:: openstack.bare_metal.v1.node
.. automodule:: openstack.baremetal.v1.node
The Node Class
--------------
The ``Node`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.bare_metal.v1.node.Node
.. autoclass:: openstack.baremetal.v1.node.Node
:members:

View File

@ -1,12 +1,12 @@
openstack.bare_metal.v1.port
openstack.baremetal.v1.port
============================
.. automodule:: openstack.bare_metal.v1.port
.. automodule:: openstack.baremetal.v1.port
The Port Class
--------------
The ``Port`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.bare_metal.v1.port.Port
.. autoclass:: openstack.baremetal.v1.port.Port
:members:

View File

@ -1,12 +1,12 @@
openstack.bare_metal.v1.port_group
openstack.baremetal.v1.port_group
==================================
.. automodule:: openstack.bare_metal.v1.port_group
.. automodule:: openstack.baremetal.v1.port_group
The PortGroup Class
-------------------
The ``PortGroup`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.bare_metal.v1.port_group.PortGroup
.. autoclass:: openstack.baremetal.v1.port_group.PortGroup
:members:

View File

@ -1,5 +1,5 @@
Block Store Resources
=====================
Block Storage Resources
=======================
.. toctree::
:maxdepth: 1

View File

@ -0,0 +1,21 @@
openstack.block_storage.v2.snapshot
===================================
.. automodule:: openstack.block_storage.v2.snapshot
The Snapshot Class
------------------
The ``Snapshot`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.block_storage.v2.snapshot.Snapshot
:members:
The SnapshotDetail Class
------------------------
The ``SnapshotDetail`` class inherits from
:class:`~openstack.block_storage.v2.snapshot.Snapshot`.
.. autoclass:: openstack.block_storage.v2.snapshot.SnapshotDetail
:members:

View File

@ -0,0 +1,13 @@
openstack.block_storage.v2.type
===============================
.. automodule:: openstack.block_storage.v2.type
The Type Class
--------------
The ``Type`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.block_storage.v2.type.Type
:members:

View File

@ -0,0 +1,21 @@
openstack.block_storage.v2.volume
=================================
.. automodule:: openstack.block_storage.v2.volume
The Volume Class
----------------
The ``Volume`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.block_storage.v2.volume.Volume
:members:
The VolumeDetail Class
----------------------
The ``VolumeDetail`` class inherits from
:class:`~openstack.block_storage.v2.volume.Volume`.
.. autoclass:: openstack.block_storage.v2.volume.VolumeDetail
:members:

View File

@ -1,21 +0,0 @@
openstack.block_store.v2.snapshot
=================================
.. automodule:: openstack.block_store.v2.snapshot
The Snapshot Class
------------------
The ``Snapshot`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.block_store.v2.snapshot.Snapshot
:members:
The SnapshotDetail Class
------------------------
The ``SnapshotDetail`` class inherits from
:class:`~openstack.block_store.v2.snapshot.Snapshot`.
.. autoclass:: openstack.block_store.v2.snapshot.SnapshotDetail
:members:

View File

@ -1,13 +0,0 @@
openstack.block_store.v2.type
=============================
.. automodule:: openstack.block_store.v2.type
The Type Class
--------------
The ``Type`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.block_store.v2.type.Type
:members:

View File

@ -1,21 +0,0 @@
openstack.block_store.v2.volume
===============================
.. automodule:: openstack.block_store.v2.volume
The Volume Class
----------------
The ``Volume`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.block_store.v2.volume.Volume
:members:
The VolumeDetail Class
----------------------
The ``VolumeDetail`` class inherits from
:class:`~openstack.block_store.v2.volume.Volume`.
.. autoclass:: openstack.block_store.v2.volume.VolumeDetail
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.action
===========================
.. automodule:: openstack.cluster.v1.action
The Action Class
----------------
The ``Action`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.action.Action
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.build_info
===============================
.. automodule:: openstack.cluster.v1.build_info
The BuildInfo Class
-------------------
The ``BuildInfo`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.build_info.BuildInfo
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.Cluster
============================
.. automodule:: openstack.cluster.v1.cluster
The Cluster Class
-----------------
The ``Cluster`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.cluster.Cluster
:members:

View File

@ -1,13 +0,0 @@
openstack.cluster.v1.cluster_policy
===================================
.. automodule:: openstack.cluster.v1.cluster_policy
The ClusterPolicy Class
-----------------------
The ``ClusterPolicy`` class inherits from
:class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.cluster_policy.ClusterPolicy
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.event
==========================
.. automodule:: openstack.cluster.v1.event
The Event Class
---------------
The ``Event`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.event.Event
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.Node
=========================
.. automodule:: openstack.cluster.v1.node
The Node Class
--------------
The ``Node`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.node.Node
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.policy
===========================
.. automodule:: openstack.cluster.v1.policy
The Policy Class
----------------
The ``Policy`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.policy.Policy
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.policy_type
================================
.. automodule:: openstack.cluster.v1.policy_type
The PolicyType Class
--------------------
The ``PolicyType`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.policy_type.PolicyType
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.profile
============================
.. automodule:: openstack.cluster.v1.profile
The Profile Class
-----------------
The ``Profile`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.profile.Profile
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.profile_type
=================================
.. automodule:: openstack.cluster.v1.profile_type
The ProfileType Class
---------------------
The ``ProfileType`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.profile_type.ProfileType
:members:

View File

@ -1,12 +0,0 @@
openstack.cluster.v1.receiver
=============================
.. automodule:: openstack.cluster.v1.receiver
The Receiver Class
------------------
The ``Receiver`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.cluster.v1.receiver.Receiver
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.action
==============================
.. automodule:: openstack.clustering.v1.action
The Action Class
----------------
The ``Action`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.action.Action
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.build_info
==================================
.. automodule:: openstack.clustering.v1.build_info
The BuildInfo Class
-------------------
The ``BuildInfo`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.build_info.BuildInfo
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.Cluster
=====================================
.. automodule:: openstack.clustering.v1.cluster
The Cluster Class
-----------------
The ``Cluster`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.cluster.Cluster
:members:

View File

@ -0,0 +1,13 @@
openstack.clustering.v1.cluster_policy
======================================
.. automodule:: openstack.clustering.v1.cluster_policy
The ClusterPolicy Class
-----------------------
The ``ClusterPolicy`` class inherits from
:class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.cluster_policy.ClusterPolicy
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.event
=============================
.. automodule:: openstack.clustering.v1.event
The Event Class
---------------
The ``Event`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.event.Event
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.Node
============================
.. automodule:: openstack.clustering.v1.node
The Node Class
--------------
The ``Node`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.node.Node
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.policy
==============================
.. automodule:: openstack.clustering.v1.policy
The Policy Class
----------------
The ``Policy`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.policy.Policy
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.policy_type
===================================
.. automodule:: openstack.clustering.v1.policy_type
The PolicyType Class
--------------------
The ``PolicyType`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.policy_type.PolicyType
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.profile
===============================
.. automodule:: openstack.clustering.v1.profile
The Profile Class
-----------------
The ``Profile`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.profile.Profile
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.profile_type
====================================
.. automodule:: openstack.clustering.v1.profile_type
The ProfileType Class
---------------------
The ``ProfileType`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.profile_type.ProfileType
:members:

View File

@ -0,0 +1,12 @@
openstack.clustering.v1.receiver
================================
.. automodule:: openstack.clustering.v1.receiver
The Receiver Class
------------------
The ``Receiver`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.clustering.v1.receiver.Receiver
:members:

View File

@ -1,4 +1,4 @@
Telemetry Resources
Meter Resources
===================
.. toctree::

View File

@ -1,12 +1,12 @@
openstack.telemetry.v2.capability
openstack.meter.v2.capability
=================================
.. automodule:: openstack.telemetry.v2.capability
.. automodule:: openstack.meter.v2.capability
The Capability Class
--------------------
The ``Capability`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.telemetry.v2.capability.Capability
.. autoclass:: openstack.meter.v2.capability.Capability
:members:

View File

@ -1,12 +1,12 @@
openstack.telemetry.v2.meter
openstack.meter.v2.meter
============================
.. automodule:: openstack.telemetry.v2.meter
.. automodule:: openstack.meter.v2.meter
The Meter Class
----------------
The ``Meter`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.telemetry.v2.meter.Meter
.. autoclass:: openstack.meter.v2.meter.Meter
:members:

View File

@ -1,12 +1,12 @@
openstack.telemetry.v2.resource
openstack.meter.v2.resource
===============================
.. automodule:: openstack.telemetry.v2.resource
.. automodule:: openstack.meter.v2.resource
The Resource Class
------------------
The ``Resource`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.telemetry.v2.resource.Resource
.. autoclass:: openstack.meter.v2.resource.Resource
:members:

View File

@ -1,12 +1,12 @@
openstack.telemetry.v2.sample
openstack.meter.v2.sample
=============================
.. automodule:: openstack.telemetry.v2.sample
.. automodule:: openstack.meter.v2.sample
The Sample Class
----------------
The ``Sample`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.telemetry.v2.sample.Sample
.. autoclass:: openstack.meter.v2.sample.Sample
:members:

View File

@ -1,12 +1,12 @@
openstack.telemetry.v2.statistics
openstack.meter.v2.statistics
=================================
.. automodule:: openstack.telemetry.v2.statistics
.. automodule:: openstack.meter.v2.statistics
The Statistics Class
--------------------
The ``Statistics`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.telemetry.v2.statistics.Statistics
.. autoclass:: openstack.meter.v2.statistics.Statistics
:members:

View File

@ -1,10 +0,0 @@
Session
=======
.. automodule:: openstack.session
Session Object
--------------
.. autoclass:: openstack.session.Session
:members:

View File

@ -14,7 +14,7 @@
Managing profile types in the Cluster service.
For a full guide see
https://developer.openstack.org/sdks/python/openstacksdk/users/guides/cluster.html
https://developer.openstack.org/sdks/python/openstacksdk/users/guides/clustering.html
"""

View File

@ -19,9 +19,8 @@ For a full guide see TODO(etoews):link to docs on developer.openstack.org
import argparse
import os
import openstack
from openstack import config as occ
from openstack import connection
from openstack import profile
from openstack import utils
import sys
@ -49,7 +48,7 @@ def _get_resource_value(resource_key, default):
return default
config = occ.OpenStackConfig()
cloud = config.get_one_cloud(TEST_CLOUD)
cloud = openstack.connect(cloud=TEST_CLOUD)
SERVER_NAME = 'openstacksdk-example'
IMAGE_NAME = _get_resource_value('image_name', 'cirros-0.3.5-x86_64-disk')
@ -66,10 +65,7 @@ EXAMPLE_IMAGE_NAME = 'openstacksdk-example-public-image'
def create_connection_from_config():
opts = Opts(cloud_name=TEST_CLOUD)
config = occ.OpenStackConfig()
cloud = config.get_one_cloud(opts.cloud)
return connection.from_config(cloud_config=cloud, options=opts)
return openstack.connect(cloud=TEST_CLOUD)
def create_connection_from_args():
@ -77,18 +73,17 @@ def create_connection_from_args():
config = occ.OpenStackConfig()
config.register_argparse_arguments(parser, sys.argv[1:])
args = parser.parse_args()
return connection.from_config(options=args)
return openstack.connect(config=config.get_one_cloud(argparse=args))
def create_connection(auth_url, region, project_name, username, password):
prof = profile.Profile()
prof.set_region(profile.Profile.ALL, region)
return connection.Connection(
profile=prof,
user_agent='examples',
return openstack.connect(
auth_url=auth_url,
project_name=project_name,
username=username,
password=password
password=password,
region_name=region,
app_name='examples',
app_version='1.0',
)

View File

@ -23,6 +23,7 @@ from openstack import _log
from openstack.cloud.exc import * # noqa
from openstack.cloud.openstackcloud import OpenStackCloud
from openstack.cloud.operatorcloud import OperatorCloud
import openstack.connection
__version__ = pbr.version.VersionInfo('openstacksdk').version_string()
@ -130,3 +131,8 @@ def operator_cloud(
raise OpenStackCloudException(
"Invalid cloud configuration: {exc}".format(exc=str(e)))
return OperatorCloud(cloud_config=cloud_config, strict=strict)
def connect(self, *args, **kwargs):
"""Create a `openstack.connection.Connection`."""
return openstack.connection.Connection(*args, **kwargs)

View File

@ -13,12 +13,12 @@
from openstack import service_filter
class BareMetalService(service_filter.ServiceFilter):
class BaremetalService(service_filter.ServiceFilter):
"""The bare metal service."""
valid_versions = [service_filter.ValidVersion('v1')]
def __init__(self, version=None):
"""Create a bare metal service."""
super(BareMetalService, self).__init__(service_type='baremetal',
super(BaremetalService, self).__init__(service_type='baremetal',
version=version)

View File

@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal.v1 import chassis as _chassis
from openstack.bare_metal.v1 import driver as _driver
from openstack.bare_metal.v1 import node as _node
from openstack.bare_metal.v1 import port as _port
from openstack.bare_metal.v1 import port_group as _portgroup
from openstack.baremetal.v1 import chassis as _chassis
from openstack.baremetal.v1 import driver as _driver
from openstack.baremetal.v1 import node as _node
from openstack.baremetal.v1 import port as _port
from openstack.baremetal.v1 import port_group as _portgroup
from openstack import proxy2
from openstack import utils
@ -61,11 +61,11 @@ class Proxy(proxy2.BaseProxy):
"""Create a new chassis from attributes.
:param dict attrs: Keyword arguments that will be used to create a
:class:`~openstack.bare_metal.v1.chassis.Chassis`, it comprised
:class:`~openstack.baremetal.v1.chassis.Chassis`, it comprised
of the properties on the ``Chassis`` class.
:returns: The results of chassis creation.
:rtype: :class:`~openstack.bare_metal.v1.chassis.Chassis`.
:rtype: :class:`~openstack.baremetal.v1.chassis.Chassis`.
"""
return self._create(_chassis.Chassis, **attrs)
@ -77,7 +77,7 @@ class Proxy(proxy2.BaseProxy):
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the chassis does not exist. When set to `True``, None will
be returned when attempting to find a nonexistent chassis.
:returns: One :class:`~openstack.bare_metal.v1.chassis.Chassis` object
:returns: One :class:`~openstack.baremetal.v1.chassis.Chassis` object
or None.
"""
return self._find(_chassis.Chassis, name_or_id,
@ -87,9 +87,9 @@ class Proxy(proxy2.BaseProxy):
"""Get a specific chassis.
:param chassis: The value can be the name or ID of a chassis or a
:class:`~openstack.bare_metal.v1.chassis.Chassis` instance.
:class:`~openstack.baremetal.v1.chassis.Chassis` instance.
:returns: One :class:`~openstack.bare_metal.v1.chassis.Chassis`
:returns: One :class:`~openstack.baremetal.v1.chassis.Chassis`
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
chassis matching the name or ID could be found.
"""
@ -99,12 +99,12 @@ class Proxy(proxy2.BaseProxy):
"""Update a chassis.
:param chassis: Either the name or the ID of a chassis, or an instance
of :class:`~openstack.bare_metal.v1.chassis.Chassis`.
of :class:`~openstack.baremetal.v1.chassis.Chassis`.
:param dict attrs: The attributes to update on the chassis represented
by the ``chassis`` parameter.
:returns: The updated chassis.
:rtype: :class:`~openstack.bare_metal.v1.chassis.Chassis`
:rtype: :class:`~openstack.baremetal.v1.chassis.Chassis`
"""
return self._update(_chassis.Chassis, chassis, **attrs)
@ -112,7 +112,7 @@ class Proxy(proxy2.BaseProxy):
"""Delete a chassis.
:param chassis: The value can be either the name or ID of a chassis or
a :class:`~openstack.bare_metal.v1.chassis.Chassis` instance.
a :class:`~openstack.baremetal.v1.chassis.Chassis` instance.
:param bool ignore_missing: When set to ``False``, an exception
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the chassis could not be found. When set to ``True``, no
@ -120,7 +120,7 @@ class Proxy(proxy2.BaseProxy):
chassis.
:returns: The instance of the chassis which was deleted.
:rtype: :class:`~openstack.bare_metal.v1.chassis.Chassis`.
:rtype: :class:`~openstack.baremetal.v1.chassis.Chassis`.
"""
return self._delete(_chassis.Chassis, chassis,
ignore_missing=ignore_missing)
@ -136,9 +136,9 @@ class Proxy(proxy2.BaseProxy):
"""Get a specific driver.
:param driver: The value can be the name of a driver or a
:class:`~openstack.bare_metal.v1.driver.Driver` instance.
:class:`~openstack.baremetal.v1.driver.Driver` instance.
:returns: One :class:`~openstack.bare_metal.v1.driver.Driver`
:returns: One :class:`~openstack.baremetal.v1.driver.Driver`
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
driver matching the name could be found.
"""
@ -193,11 +193,11 @@ class Proxy(proxy2.BaseProxy):
"""Create a new node from attributes.
:param dict attrs: Keyword arguments that will be used to create a
:class:`~openstack.bare_metal.v1.node.Node`, it comprised
:class:`~openstack.baremetal.v1.node.Node`, it comprised
of the properties on the ``Node`` class.
:returns: The results of node creation.
:rtype: :class:`~openstack.bare_metal.v1.node.Node`.
:rtype: :class:`~openstack.baremetal.v1.node.Node`.
"""
return self._create(_node.Node, **attrs)
@ -209,7 +209,7 @@ class Proxy(proxy2.BaseProxy):
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the node does not exist. When set to `True``, None will
be returned when attempting to find a nonexistent node.
:returns: One :class:`~openstack.bare_metal.v1.node.Node` object
:returns: One :class:`~openstack.baremetal.v1.node.Node` object
or None.
"""
return self._find(_node.Node, name_or_id,
@ -219,9 +219,9 @@ class Proxy(proxy2.BaseProxy):
"""Get a specific node.
:param node: The value can be the name or ID of a chassis or a
:class:`~openstack.bare_metal.v1.node.Node` instance.
:class:`~openstack.baremetal.v1.node.Node` instance.
:returns: One :class:`~openstack.bare_metal.v1.node.Node`
:returns: One :class:`~openstack.baremetal.v1.node.Node`
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
node matching the name or ID could be found.
"""
@ -231,12 +231,12 @@ class Proxy(proxy2.BaseProxy):
"""Update a node.
:param chassis: Either the name or the ID of a node or an instance
of :class:`~openstack.bare_metal.v1.node.Node`.
of :class:`~openstack.baremetal.v1.node.Node`.
:param dict attrs: The attributes to update on the node represented
by the ``node`` parameter.
:returns: The updated node.
:rtype: :class:`~openstack.bare_metal.v1.node.Node`
:rtype: :class:`~openstack.baremetal.v1.node.Node`
"""
return self._update(_node.Node, node, **attrs)
@ -244,7 +244,7 @@ class Proxy(proxy2.BaseProxy):
"""Delete a node.
:param node: The value can be either the name or ID of a node or
a :class:`~openstack.bare_metal.v1.node.Node` instance.
a :class:`~openstack.baremetal.v1.node.Node` instance.
:param bool ignore_missing: When set to ``False``, an exception
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the node could not be found. When set to ``True``, no
@ -252,7 +252,7 @@ class Proxy(proxy2.BaseProxy):
node.
:returns: The instance of the node which was deleted.
:rtype: :class:`~openstack.bare_metal.v1.node.Node`.
:rtype: :class:`~openstack.baremetal.v1.node.Node`.
"""
return self._delete(_node.Node, node, ignore_missing=ignore_missing)
@ -306,11 +306,11 @@ class Proxy(proxy2.BaseProxy):
"""Create a new port from attributes.
:param dict attrs: Keyword arguments that will be used to create a
:class:`~openstack.bare_metal.v1.port.Port`, it comprises of the
:class:`~openstack.baremetal.v1.port.Port`, it comprises of the
properties on the ``Port`` class.
:returns: The results of port creation.
:rtype: :class:`~openstack.bare_metal.v1.port.Port`.
:rtype: :class:`~openstack.baremetal.v1.port.Port`.
"""
return self._create(_port.Port, **attrs)
@ -322,7 +322,7 @@ class Proxy(proxy2.BaseProxy):
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the port does not exist. When set to `True``, None will
be returned when attempting to find a nonexistent port.
:returns: One :class:`~openstack.bare_metal.v1.port.Port` object
:returns: One :class:`~openstack.baremetal.v1.port.Port` object
or None.
"""
return self._find(_port.Port, name_or_id,
@ -332,7 +332,7 @@ class Proxy(proxy2.BaseProxy):
"""Get a specific port.
:param port: The value can be the name or ID of a chassis or a
:class:`~openstack.bare_metal.v1.port.Port` instance.
:class:`~openstack.baremetal.v1.port.Port` instance.
:param dict query: Optional query parameters to be sent to restrict
the port properties returned. Available parameters include:
@ -340,7 +340,7 @@ class Proxy(proxy2.BaseProxy):
in the response. This may lead to some performance gain
because other fields of the resource are not refreshed.
:returns: One :class:`~openstack.bare_metal.v1.port.Port`
:returns: One :class:`~openstack.baremetal.v1.port.Port`
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
port matching the name or ID could be found.
"""
@ -350,12 +350,12 @@ class Proxy(proxy2.BaseProxy):
"""Update a port.
:param chassis: Either the name or the ID of a port or an instance
of :class:`~openstack.bare_metal.v1.port.Port`.
of :class:`~openstack.baremetal.v1.port.Port`.
:param dict attrs: The attributes to update on the port represented
by the ``port`` parameter.
:returns: The updated port.
:rtype: :class:`~openstack.bare_metal.v1.port.Port`
:rtype: :class:`~openstack.baremetal.v1.port.Port`
"""
return self._update(_port.Port, port, **attrs)
@ -363,7 +363,7 @@ class Proxy(proxy2.BaseProxy):
"""Delete a port.
:param port: The value can be either the name or ID of a port or
a :class:`~openstack.bare_metal.v1.port.Port` instance.
a :class:`~openstack.baremetal.v1.port.Port` instance.
:param bool ignore_missing: When set to ``False``, an exception
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the port could not be found. When set to ``True``, no
@ -371,7 +371,7 @@ class Proxy(proxy2.BaseProxy):
port.
:returns: The instance of the port which was deleted.
:rtype: :class:`~openstack.bare_metal.v1.port.Port`.
:rtype: :class:`~openstack.baremetal.v1.port.Port`.
"""
return self._delete(_port.Port, port, ignore_missing=ignore_missing)
@ -462,11 +462,11 @@ class Proxy(proxy2.BaseProxy):
"""Create a new port group from attributes.
:param dict attrs: Keyword arguments that will be used to create a
:class:`~openstack.bare_metal.v1.port_group.PortGroup`, it
:class:`~openstack.baremetal.v1.port_group.PortGroup`, it
comprises of the properties on the ``PortGroup`` class.
:returns: The results of portgroup creation.
:rtype: :class:`~openstack.bare_metal.v1.port_group.PortGroup`.
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`.
"""
return self.create_port_group(**attrs)
@ -474,11 +474,11 @@ class Proxy(proxy2.BaseProxy):
"""Create a new portgroup from attributes.
:param dict attrs: Keyword arguments that will be used to create a
:class:`~openstack.bare_metal.v1.port_group.PortGroup`, it
:class:`~openstack.baremetal.v1.port_group.PortGroup`, it
comprises of the properties on the ``PortGroup`` class.
:returns: The results of portgroup creation.
:rtype: :class:`~openstack.bare_metal.v1.port_group.PortGroup`.
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`.
"""
return self._create(_portgroup.PortGroup, **attrs)
@ -492,7 +492,7 @@ class Proxy(proxy2.BaseProxy):
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the port group does not exist. When set to `True``, None will
be returned when attempting to find a nonexistent port group.
:returns: One :class:`~openstack.bare_metal.v1.port_group.PortGroup`
:returns: One :class:`~openstack.baremetal.v1.port_group.PortGroup`
object or None.
"""
return self.find_port_group(name_or_id, ignore_missing=ignore_missing)
@ -505,7 +505,7 @@ class Proxy(proxy2.BaseProxy):
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the port group does not exist. When set to `True``, None will
be returned when attempting to find a nonexistent port group.
:returns: One :class:`~openstack.bare_metal.v1.port_group.PortGroup`
:returns: One :class:`~openstack.baremetal.v1.port_group.PortGroup`
object or None.
"""
return self._find(_portgroup.PortGroup, name_or_id,
@ -517,7 +517,7 @@ class Proxy(proxy2.BaseProxy):
"""Get a specific port group.
:param portgroup: The value can be the name or ID of a chassis or a
:class:`~openstack.bare_metal.v1.port_group.PortGroup` instance.
:class:`~openstack.baremetal.v1.port_group.PortGroup` instance.
:param dict query: Optional query parameters to be sent to restrict
the portgroup properties returned. Available parameters include:
@ -525,7 +525,7 @@ class Proxy(proxy2.BaseProxy):
in the response. This may lead to some performance gain
because other fields of the resource are not refreshed.
:returns: One :class:`~openstack.bare_metal.v1.port_group.PortGroup`
:returns: One :class:`~openstack.baremetal.v1.port_group.PortGroup`
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
port group matching the name or ID could be found.
"""
@ -535,7 +535,7 @@ class Proxy(proxy2.BaseProxy):
"""Get a specific port group.
:param port_group: The value can be the name or ID of a chassis or a
:class:`~openstack.bare_metal.v1.port_group.PortGroup` instance.
:class:`~openstack.baremetal.v1.port_group.PortGroup` instance.
:param dict query: Optional query parameters to be sent to restrict
the port group properties returned. Available parameters include:
@ -543,7 +543,7 @@ class Proxy(proxy2.BaseProxy):
in the response. This may lead to some performance gain
because other fields of the resource are not refreshed.
:returns: One :class:`~openstack.bare_metal.v1.port_group.PortGroup`
:returns: One :class:`~openstack.baremetal.v1.port_group.PortGroup`
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
port group matching the name or ID could be found.
"""
@ -556,12 +556,12 @@ class Proxy(proxy2.BaseProxy):
:param chassis: Either the name or the ID of a port group or
an instance of
:class:`~openstack.bare_metal.v1.port_group.PortGroup`.
:class:`~openstack.baremetal.v1.port_group.PortGroup`.
:param dict attrs: The attributes to update on the port group
represented by the ``portgroup`` parameter.
:returns: The updated port group.
:rtype: :class:`~openstack.bare_metal.v1.port_group.PortGroup`
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`
"""
return self.update_port_group(portgroup, **attrs)
@ -570,12 +570,12 @@ class Proxy(proxy2.BaseProxy):
:param chassis: Either the name or the ID of a port group or
an instance of
:class:`~openstack.bare_metal.v1.port_group.PortGroup`.
:class:`~openstack.baremetal.v1.port_group.PortGroup`.
:param dict attrs: The attributes to update on the port group
represented by the ``port_group`` parameter.
:returns: The updated port group.
:rtype: :class:`~openstack.bare_metal.v1.port_group.PortGroup`
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`
"""
return self._update(_portgroup.PortGroup, port_group, **attrs)
@ -586,7 +586,7 @@ class Proxy(proxy2.BaseProxy):
:param portgroup: The value can be either the name or ID of a port
group or a
:class:`~openstack.bare_metal.v1.port_group.PortGroup`
:class:`~openstack.baremetal.v1.port_group.PortGroup`
instance.
:param bool ignore_missing: When set to ``False``, an exception
:class:`~openstack.exceptions.ResourceNotFound` will be raised
@ -595,7 +595,7 @@ class Proxy(proxy2.BaseProxy):
port group.
:returns: The instance of the port group which was deleted.
:rtype: :class:`~openstack.bare_metal.v1.port_group.PortGroup`.
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`.
"""
return self.delete_port_group(portgroup, ignore_missing=ignore_missing)
@ -604,7 +604,7 @@ class Proxy(proxy2.BaseProxy):
:param port_group: The value can be either the name or ID of
a port group or a
:class:`~openstack.bare_metal.v1.port_group.PortGroup`
:class:`~openstack.baremetal.v1.port_group.PortGroup`
instance.
:param bool ignore_missing: When set to ``False``, an exception
:class:`~openstack.exceptions.ResourceNotFound` will be raised
@ -613,7 +613,7 @@ class Proxy(proxy2.BaseProxy):
port group.
:returns: The instance of the port group which was deleted.
:rtype: :class:`~openstack.bare_metal.v1.port_group.PortGroup`.
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`.
"""
return self._delete(_portgroup.PortGroup, port_group,
ignore_missing=ignore_missing)

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal import bare_metal_service
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
@ -18,7 +18,7 @@ class Chassis(resource.Resource):
resources_key = 'chassis'
base_path = '/chassis'
service = bare_metal_service.BareMetalService()
service = baremetal_service.BaremetalService()
# capabilities
allow_create = True

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal import bare_metal_service
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
@ -18,7 +18,7 @@ class Driver(resource.Resource):
resources_key = 'drivers'
base_path = '/drivers'
service = bare_metal_service.BareMetalService()
service = baremetal_service.BaremetalService()
# capabilities
allow_create = False

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal import bare_metal_service
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
@ -18,7 +18,7 @@ class Node(resource.Resource):
resources_key = 'nodes'
base_path = '/nodes'
service = bare_metal_service.BareMetalService()
service = baremetal_service.BaremetalService()
# capabilities
allow_create = True
@ -45,7 +45,7 @@ class Node(resource.Resource):
driver = resource.Body("driver")
#: All the metadata required by the driver to manage this node. List of
#: fields varies between drivers, and can be retrieved from the
#: :class:`openstack.bare_metal.v1.driver.Driver` resource.
#: :class:`openstack.baremetal.v1.driver.Driver` resource.
driver_info = resource.Body("driver_info", type=dict)
#: Internal metadata set and stored by node's driver. This is read-only.
driver_internal_info = resource.Body("driver_internal_info", type=dict)

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal import bare_metal_service
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
@ -18,7 +18,7 @@ class Port(resource.Resource):
resources_key = 'ports'
base_path = '/ports'
service = bare_metal_service.BareMetalService()
service = baremetal_service.BaremetalService()
# capabilities
allow_create = True

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal import bare_metal_service
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
@ -18,7 +18,7 @@ class PortGroup(resource.Resource):
resources_key = 'portgroups'
base_path = '/portgroups'
service = bare_metal_service.BareMetalService()
service = baremetal_service.BaremetalService()
# capabilities
allow_create = True

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal import bare_metal_service
from openstack.baremetal import baremetal_service
from openstack import resource2
@ -18,8 +18,8 @@ class Version(resource2.Resource):
resource_key = 'version'
resources_key = 'versions'
base_path = '/'
service = bare_metal_service.BareMetalService(
version=bare_metal_service.BareMetalService.UNVERSIONED
service = baremetal_service.BaremetalService(
version=baremetal_service.BaremetalService.UNVERSIONED
)
# Capabilities

View File

@ -13,13 +13,12 @@
from openstack import service_filter
class BlockStoreService(service_filter.ServiceFilter):
"""The block store service."""
class BlockStorageService(service_filter.ServiceFilter):
"""The block storage service."""
valid_versions = [service_filter.ValidVersion('v2')]
def __init__(self, version=None):
"""Create a block store service."""
super(BlockStoreService, self).__init__(service_type='volume',
version=version,
requires_project_id=True)
"""Create a block storage service."""
super(BlockStorageService, self).__init__(
service_type='volume', version=version, requires_project_id=True)

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.block_store.v2 import snapshot as _snapshot
from openstack.block_store.v2 import type as _type
from openstack.block_store.v2 import volume as _volume
from openstack.block_storage.v2 import snapshot as _snapshot
from openstack.block_storage.v2 import type as _type
from openstack.block_storage.v2 import volume as _volume
from openstack import proxy2
@ -35,9 +35,9 @@ class Proxy(proxy2.BaseProxy):
"""Retrieve a generator of snapshots
:param bool details: When set to ``False``
:class:`~openstack.block_store.v2.snapshot.Snapshot`
:class:`~openstack.block_storage.v2.snapshot.Snapshot`
objects will be returned. The default, ``True``, will cause
:class:`~openstack.block_store.v2.snapshot.SnapshotDetail`
:class:`~openstack.block_storage.v2.snapshot.SnapshotDetail`
objects to be returned.
:param kwargs \*\*query: Optional query parameters to be sent to limit
the snapshots being returned. Available parameters include:
@ -144,9 +144,9 @@ class Proxy(proxy2.BaseProxy):
"""Retrieve a generator of volumes
:param bool details: When set to ``False``
:class:`~openstack.block_store.v2.volume.Volume` objects
:class:`~openstack.block_storage.v2.volume.Volume` objects
will be returned. The default, ``True``, will cause
:class:`~openstack.block_store.v2.volume.VolumeDetail`
:class:`~openstack.block_storage.v2.volume.VolumeDetail`
objects to be returned.
:param kwargs \*\*query: Optional query parameters to be sent to limit
the volumes being returned. Available parameters include:

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.block_store import block_store_service
from openstack.block_storage import block_storage_service
from openstack import format
from openstack import resource2
@ -19,7 +19,7 @@ class Snapshot(resource2.Resource):
resource_key = "snapshot"
resources_key = "snapshots"
base_path = "/snapshots"
service = block_store_service.BlockStoreService()
service = block_storage_service.BlockStorageService()
_query_mapping = resource2.QueryParameters('all_tenants', 'name', 'status',
'volume_id')

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.block_store import block_store_service
from openstack.block_storage import block_storage_service
from openstack import resource2
@ -18,7 +18,7 @@ class Type(resource2.Resource):
resource_key = "volume_type"
resources_key = "volume_types"
base_path = "/types"
service = block_store_service.BlockStoreService()
service = block_storage_service.BlockStorageService()
# capabilities
allow_get = True

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.block_store import block_store_service
from openstack.block_storage import block_storage_service
from openstack import format
from openstack import resource2
@ -19,7 +19,7 @@ class Volume(resource2.Resource):
resource_key = "volume"
resources_key = "volumes"
base_path = "/volumes"
service = block_store_service.BlockStoreService()
service = block_storage_service.BlockStorageService()
_query_mapping = resource2.QueryParameters('all_tenants', 'name',
'status', 'project_id')

View File

@ -12,18 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
''' Wrapper around keystoneauth Session to wrap calls in TaskManager '''
''' Wrapper around keystoneauth Adapter to wrap calls in TaskManager '''
import functools
from keystoneauth1 import adapter
from six.moves import urllib
from openstack import _log
from openstack.cloud import exc
from openstack.cloud import task_manager
from keystoneauth1 import adapter
from openstack.cloud import task_manager as _task_manager
from openstack import exceptions
def extract_name(url):
def _extract_name(url):
'''Produce a key name to use in logging/metrics from the URL path.
We want to be able to logic/metric sane general things, so we pull
@ -81,86 +81,67 @@ def extract_name(url):
return [part for part in name_parts if part]
# TODO(shade) This adapter should go away in favor of the work merging
# adapter with openstack.proxy.
class ShadeAdapter(adapter.Adapter):
class OpenStackSDKAdapter(adapter.Adapter):
"""Wrapper around keystoneauth1.adapter.Adapter.
def __init__(self, shade_logger, manager, *args, **kwargs):
super(ShadeAdapter, self).__init__(*args, **kwargs)
self.shade_logger = shade_logger
self.manager = manager
self.request_log = _log.setup_logging('openstack.cloud.request_ids')
Uses task_manager to run tasks rather than executing them directly.
This allows using the nodepool MultiThreaded Rate Limiting TaskManager.
"""
def _log_request_id(self, response, obj=None):
# Log the request id and object id in a specific logger. This way
# someone can turn it on if they're interested in this kind of tracing.
request_id = response.headers.get('x-openstack-request-id')
if not request_id:
return response
tmpl = "{meth} call to {service} for {url} used request id {req}"
kwargs = dict(
meth=response.request.method,
service=self.service_type,
url=response.request.url,
req=request_id)
def __init__(self, session=None, task_manager=None, *args, **kwargs):
super(OpenStackSDKAdapter, self).__init__(
session=session, *args, **kwargs)
if not task_manager:
task_manager = _task_manager.TaskManager(name=self.service_type)
if isinstance(obj, dict):
obj_id = obj.get('id', obj.get('uuid'))
if obj_id:
kwargs['obj_id'] = obj_id
tmpl += " returning object {obj_id}"
self.request_log.debug(tmpl.format(**kwargs))
return response
def _munch_response(self, response, result_key=None, error_message=None):
exc.raise_from_response(response, error_message=error_message)
if not response.content:
# This doens't have any content
return self._log_request_id(response)
# Some REST calls do not return json content. Don't decode it.
if 'application/json' not in response.headers.get('Content-Type'):
return self._log_request_id(response)
try:
result_json = response.json()
self._log_request_id(response, result_json)
except Exception:
return self._log_request_id(response)
return result_json
self.task_manager = task_manager
def request(
self, url, method, run_async=False, error_message=None,
*args, **kwargs):
name_parts = extract_name(url)
raise_exc=False, connect_retries=1, *args, **kwargs):
name_parts = _extract_name(url)
name = '.'.join([self.service_type, method] + name_parts)
class_name = "".join([
part.lower().capitalize() for part in name.split('.')])
request_method = functools.partial(
super(ShadeAdapter, self).request, url, method)
super(OpenStackSDKAdapter, self).request, url, method)
class RequestTask(task_manager.BaseTask):
def __init__(self, **kw):
super(RequestTask, self).__init__(**kw)
self.name = name
self.__class__.__name__ = str(class_name)
self.run_async = run_async
def main(self, client):
self.args.setdefault('raise_exc', False)
return request_method(**self.args)
response = self.manager.submit_task(RequestTask(**kwargs))
if run_async:
return response
else:
return self._munch_response(response, error_message=error_message)
return self.task_manager.submit_function(
request_method, run_async=run_async, name=name,
connect_retries=connect_retries, raise_exc=raise_exc,
**kwargs)
def _version_matches(self, version):
api_version = self.get_api_major_version()
if api_version:
return api_version[0] == version
return False
class ShadeAdapter(OpenStackSDKAdapter):
"""Wrapper for shade methods that expect json unpacking."""
def request(self, url, method,
run_async=False, error_message=None, **kwargs):
response = super(ShadeAdapter, self).request(
url, method, run_async=run_async, **kwargs)
if run_async:
return response
else:
return self._munch_response(response, error_message=error_message)
def _munch_response(self, response, result_key=None, error_message=None):
exceptions.raise_from_response(response, error_message=error_message)
if not response.content:
# This doens't have any content
return response
# Some REST calls do not return json content. Don't decode it.
if 'application/json' not in response.headers.get('Content-Type'):
return response
try:
result_json = response.json()
except Exception:
return response
return result_json

View File

@ -12,46 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from openstack import exceptions
import munch
from requests import exceptions as _rex
from openstack import _log
class OpenStackCloudException(Exception):
log_inner_exceptions = False
def __init__(self, message, extra_data=None, **kwargs):
args = [message]
if extra_data:
if isinstance(extra_data, munch.Munch):
extra_data = extra_data.toDict()
args.append("Extra: {0}".format(str(extra_data)))
super(OpenStackCloudException, self).__init__(*args, **kwargs)
self.extra_data = extra_data
self.inner_exception = sys.exc_info()
self.orig_message = message
def log_error(self, logger=None):
if not logger:
logger = _log.setup_logging('openstack.cloud.exc')
if self.inner_exception and self.inner_exception[1]:
logger.error(self.orig_message, exc_info=self.inner_exception)
def __str__(self):
message = Exception.__str__(self)
if (self.inner_exception and self.inner_exception[1]
and not self.orig_message.endswith(
str(self.inner_exception[1]))):
message = "%s (Inner Exception: %s)" % (
message,
str(self.inner_exception[1]))
if self.log_inner_exceptions:
self.log_error()
return message
OpenStackCloudException = exceptions.SDKException
class OpenStackCloudCreateException(OpenStackCloudException):
@ -76,98 +39,8 @@ class OpenStackCloudUnavailableFeature(OpenStackCloudException):
pass
class OpenStackCloudHTTPError(OpenStackCloudException, _rex.HTTPError):
def __init__(self, *args, **kwargs):
OpenStackCloudException.__init__(self, *args, **kwargs)
_rex.HTTPError.__init__(self, *args, **kwargs)
class OpenStackCloudBadRequest(OpenStackCloudHTTPError):
"""There is something wrong with the request payload.
Possible reasons can include malformed json or invalid values to parameters
such as flavorRef to a server create.
"""
class OpenStackCloudURINotFound(OpenStackCloudHTTPError):
pass
# Backwards compat
OpenStackCloudHTTPError = exceptions.HttpException
OpenStackCloudBadRequest = exceptions.BadRequestException
OpenStackCloudURINotFound = exceptions.NotFoundException
OpenStackCloudResourceNotFound = OpenStackCloudURINotFound
def _log_response_extras(response):
# Sometimes we get weird HTML errors. This is usually from load balancers
# or other things. Log them to a special logger so that they can be
# toggled indepdently - and at debug level so that a person logging
# openstack.cloud.* only gets them at debug.
if response.headers.get('content-type') != 'text/html':
return
try:
if int(response.headers.get('content-length', 0)) == 0:
return
except Exception:
return
logger = _log.setup_logging('openstack.cloud.http')
if response.reason:
logger.debug(
"Non-standard error '{reason}' returned from {url}:".format(
reason=response.reason,
url=response.url))
else:
logger.debug(
"Non-standard error returned from {url}:".format(
url=response.url))
for response_line in response.text.split('\n'):
logger.debug(response_line)
# Logic shamelessly stolen from requests
def raise_from_response(response, error_message=None):
msg = ''
if 400 <= response.status_code < 500:
source = "Client"
elif 500 <= response.status_code < 600:
source = "Server"
else:
return
remote_error = "Error for url: {url}".format(url=response.url)
try:
details = response.json()
# Nova returns documents that look like
# {statusname: 'message': message, 'code': code}
detail_keys = list(details.keys())
if len(detail_keys) == 1:
detail_key = detail_keys[0]
detail_message = details[detail_key].get('message')
if detail_message:
remote_error += " {message}".format(message=detail_message)
except ValueError:
if response.reason:
remote_error += " {reason}".format(reason=response.reason)
_log_response_extras(response)
if error_message:
msg = '{error_message}. ({code}) {source} {remote_error}'.format(
error_message=error_message,
source=source,
code=response.status_code,
remote_error=remote_error)
else:
msg = '({code}) {source} {remote_error}'.format(
code=response.status_code,
source=source,
remote_error=remote_error)
# Special case 404 since we raised a specific one for neutron exceptions
# before
if response.status_code == 404:
raise OpenStackCloudURINotFound(msg, response=response)
elif response.status_code == 400:
raise OpenStackCloudBadRequest(msg, response=response)
if msg:
raise OpenStackCloudHTTPError(msg, response=response)

View File

@ -175,7 +175,7 @@ class OpenStackCloud(_normalize.Normalizer):
self.manager = manager
else:
self.manager = task_manager.TaskManager(
name=':'.join([self.name, self.region_name]), client=self)
name=':'.join([self.name, self.region_name]))
self._external_ipv4_names = cloud_config.get_external_ipv4_networks()
self._internal_ipv4_names = cloud_config.get_internal_ipv4_networks()
@ -402,29 +402,27 @@ class OpenStackCloud(_normalize.Normalizer):
version=config_major)
adapter = _adapter.ShadeAdapter(
session=self.keystone_session,
manager=self.manager,
task_manager=self.manager,
service_type=self.cloud_config.get_service_type(service_type),
service_name=self.cloud_config.get_service_name(service_type),
interface=self.cloud_config.get_interface(service_type),
endpoint_override=self.cloud_config.get_endpoint(service_type),
region_name=self.cloud_config.region,
min_version=request_min_version,
max_version=request_max_version,
shade_logger=self.log)
max_version=request_max_version)
if adapter.get_endpoint():
return adapter
adapter = _adapter.ShadeAdapter(
session=self.keystone_session,
manager=self.manager,
task_manager=self.manager,
service_type=self.cloud_config.get_service_type(service_type),
service_name=self.cloud_config.get_service_name(service_type),
interface=self.cloud_config.get_interface(service_type),
endpoint_override=self.cloud_config.get_endpoint(service_type),
region_name=self.cloud_config.region,
min_version=min_version,
max_version=max_version,
shade_logger=self.log)
max_version=max_version)
# data.api_version can be None if no version was detected, such
# as with neutron
@ -456,14 +454,13 @@ class OpenStackCloud(_normalize.Normalizer):
self, service_type, api_version=None, endpoint_override=None):
return _adapter.ShadeAdapter(
session=self.keystone_session,
manager=self.manager,
task_manager=self.manager,
service_type=self.cloud_config.get_service_type(service_type),
service_name=self.cloud_config.get_service_name(service_type),
interface=self.cloud_config.get_interface(service_type),
endpoint_override=self.cloud_config.get_endpoint(
service_type) or endpoint_override,
region_name=self.cloud_config.region,
shade_logger=self.log)
region_name=self.cloud_config.region)
def _is_client_version(self, client, version):
client_name = '_{client}_client'.format(client=client)

Some files were not shown because too many files have changed in this diff Show More