Rename resource2 and proxy2 to resource and proxy

This caps off a bunch of work to get to the new and improved
Resouce2/Proxy2 interfaces. All of the services have been migrated and
the old classes have been removed. Rename openstack.resource2 to
openstack.resource and openstack.proxy2 to openstack.proxy.

Change-Id: I0b7e1c679358e1f60b5316a255aad3a59fbbc8a9
This commit is contained in:
Monty Taylor 2018-01-12 17:45:52 -06:00
parent aebf019660
commit 15e78f5d56
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
181 changed files with 974 additions and 974 deletions

View File

@ -23,11 +23,11 @@ already. For reference, those are:
* Removed the Session object in favor of using keystoneauth.
* Plumbed Proxy use of Adapter through the Adapter subclass from shade that
uses the TaskManager to run REST calls.
* Finish migrating to Resource2 and Proxy2, rename them to Resource and Proxy.
Next steps
==========
* Finish migrating to Resource2 and Proxy2, rename them to Resource and Proxy.
* Maybe rename self.session and session parameter in all usage in proxy and
resource to self.adapter. They are Adapters not Sessions, but that may not
mean anything to people.

View File

@ -1,7 +1,7 @@
# Apache 2 header omitted for brevity
from openstack.fake import fake_service
from openstack import resource2 as resource
from openstack import resource
class Fake(resource.Resource):

View File

@ -137,7 +137,7 @@ can be customized.
.. toctree::
:maxdepth: 1
resource2
resource
service_filter
utils

View File

@ -4,23 +4,23 @@ this module will be drop the 2 suffix and be the only resource module.**
Resource
========
.. automodule:: openstack.resource2
.. automodule:: openstack.resource
Components
----------
.. autoclass:: openstack.resource2.Body
.. autoclass:: openstack.resource.Body
:members:
.. autoclass:: openstack.resource2.Header
.. autoclass:: openstack.resource.Header
:members:
.. autoclass:: openstack.resource2.URI
.. autoclass:: openstack.resource.URI
:members:
The Resource class
------------------
.. autoclass:: openstack.resource2.Resource
.. autoclass:: openstack.resource.Resource
:members:
:member-order: bysource

View File

@ -15,11 +15,11 @@ 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 proxy
from openstack import utils
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def chassis(self, details=False, **query):
"""Retrieve a generator of chassis.

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
from openstack import resource
class Chassis(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
from openstack import resource
class Driver(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
from openstack import resource
class Node(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
from openstack import resource
class Port(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.baremetal import baremetal_service
from openstack import resource2 as resource
from openstack import resource
class PortGroup(resource.Resource):

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.baremetal import baremetal_service
from openstack import resource2
from openstack import resource
class Version(resource2.Resource):
class Version(resource.Resource):
resource_key = 'version'
resources_key = 'versions'
base_path = '/'
@ -26,6 +26,6 @@ class Version(resource2.Resource):
allow_list = True
# Attributes
links = resource2.Body('links')
status = resource2.Body('status')
updated = resource2.Body('updated')
links = resource.Body('links')
status = resource.Body('status')
updated = resource.Body('updated')

View File

@ -14,10 +14,10 @@ from openstack.block_storage.v2 import snapshot as _snapshot
from openstack.block_storage.v2 import stats as _stats
from openstack.block_storage.v2 import type as _type
from openstack.block_storage.v2 import volume as _volume
from openstack import proxy2
from openstack import proxy
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def get_snapshot(self, snapshot):
"""Get a single snapshot

View File

@ -12,17 +12,17 @@
from openstack.block_storage import block_storage_service
from openstack import format
from openstack import resource2
from openstack import resource
class Snapshot(resource2.Resource):
class Snapshot(resource.Resource):
resource_key = "snapshot"
resources_key = "snapshots"
base_path = "/snapshots"
service = block_storage_service.BlockStorageService()
_query_mapping = resource2.QueryParameters('all_tenants', 'name', 'status',
'volume_id')
_query_mapping = resource.QueryParameters(
'all_tenants', 'name', 'status', 'volume_id')
# capabilities
allow_get = True
@ -33,26 +33,26 @@ class Snapshot(resource2.Resource):
# Properties
#: A ID representing this snapshot.
id = resource2.Body("id")
id = resource.Body("id")
#: Name of the snapshot. Default is None.
name = resource2.Body("name")
name = resource.Body("name")
#: The current status of this snapshot. Potential values are creating,
#: available, deleting, error, and error_deleting.
status = resource2.Body("status")
status = resource.Body("status")
#: Description of snapshot. Default is None.
description = resource2.Body("description")
description = resource.Body("description")
#: The timestamp of this snapshot creation.
created_at = resource2.Body("created_at")
created_at = resource.Body("created_at")
#: Metadata associated with this snapshot.
metadata = resource2.Body("metadata", type=dict)
metadata = resource.Body("metadata", type=dict)
#: The ID of the volume this snapshot was taken of.
volume_id = resource2.Body("volume_id")
volume_id = resource.Body("volume_id")
#: The size of the volume, in GBs.
size = resource2.Body("size", type=int)
size = resource.Body("size", type=int)
#: Indicate whether to create snapshot, even if the volume is attached.
#: Default is ``False``. *Type: bool*
is_forced = resource2.Body("force", type=format.BoolStr)
is_forced = resource.Body("force", type=format.BoolStr)
class SnapshotDetail(Snapshot):
@ -60,6 +60,6 @@ class SnapshotDetail(Snapshot):
base_path = "/snapshots/detail"
#: The percentage of completeness the snapshot is currently at.
progress = resource2.Body("os-extended-snapshot-attributes:progress")
progress = resource.Body("os-extended-snapshot-attributes:progress")
#: The project ID this snapshot is associated with.
project_id = resource2.Body("os-extended-snapshot-attributes:project_id")
project_id = resource.Body("os-extended-snapshot-attributes:project_id")

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.block_storage import block_storage_service
from openstack import resource2
from openstack import resource
class Pools(resource2.Resource):
class Pools(resource.Resource):
resource_key = "pool"
resources_key = "pools"
base_path = "/scheduler-stats/get_pools?detail=True"
@ -28,7 +28,6 @@ class Pools(resource2.Resource):
# Properties
#: The Cinder name for the pool
name = resource2.Body("name")
name = resource.Body("name")
#: returns a dict with information about the pool
capabilities = resource2.Body("capabilities",
type=dict)
capabilities = resource.Body("capabilities", type=dict)

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.block_storage import block_storage_service
from openstack import resource2
from openstack import resource
class Type(resource2.Resource):
class Type(resource.Resource):
resource_key = "volume_type"
resources_key = "volume_types"
base_path = "/types"
@ -28,8 +28,8 @@ class Type(resource2.Resource):
# Properties
#: A ID representing this type.
id = resource2.Body("id")
id = resource.Body("id")
#: Name of the type.
name = resource2.Body("name")
name = resource.Body("name")
#: A dict of extra specifications. "capabilities" is a usual key.
extra_specs = resource2.Body("extra_specs", type=dict)
extra_specs = resource.Body("extra_specs", type=dict)

View File

@ -12,17 +12,17 @@
from openstack.block_storage import block_storage_service
from openstack import format
from openstack import resource2
from openstack import resource
class Volume(resource2.Resource):
class Volume(resource.Resource):
resource_key = "volume"
resources_key = "volumes"
base_path = "/volumes"
service = block_storage_service.BlockStorageService()
_query_mapping = resource2.QueryParameters('all_tenants', 'name',
'status', 'project_id')
_query_mapping = resource.QueryParameters(
'all_tenants', 'name', 'status', 'project_id')
# capabilities
allow_get = True
@ -33,48 +33,48 @@ class Volume(resource2.Resource):
# Properties
#: A ID representing this volume.
id = resource2.Body("id")
id = resource.Body("id")
#: The name of this volume.
name = resource2.Body("name")
name = resource.Body("name")
#: A list of links associated with this volume. *Type: list*
links = resource2.Body("links", type=list)
links = resource.Body("links", type=list)
#: The availability zone.
availability_zone = resource2.Body("availability_zone")
availability_zone = resource.Body("availability_zone")
#: To create a volume from an existing volume, specify the ID of
#: the existing volume. If specified, the volume is created with
#: same size of the source volume.
source_volume_id = resource2.Body("source_volid")
source_volume_id = resource.Body("source_volid")
#: The volume description.
description = resource2.Body("description")
description = resource.Body("description")
#: To create a volume from an existing snapshot, specify the ID of
#: the existing volume snapshot. If specified, the volume is created
#: in same availability zone and with same size of the snapshot.
snapshot_id = resource2.Body("snapshot_id")
snapshot_id = resource.Body("snapshot_id")
#: The size of the volume, in GBs. *Type: int*
size = resource2.Body("size", type=int)
size = resource.Body("size", type=int)
#: The ID of the image from which you want to create the volume.
#: Required to create a bootable volume.
image_id = resource2.Body("imageRef")
image_id = resource.Body("imageRef")
#: The name of the associated volume type.
volume_type = resource2.Body("volume_type")
volume_type = resource.Body("volume_type")
#: Enables or disables the bootable attribute. You can boot an
#: instance from a bootable volume. *Type: bool*
is_bootable = resource2.Body("bootable", type=format.BoolStr)
is_bootable = resource.Body("bootable", type=format.BoolStr)
#: One or more metadata key and value pairs to associate with the volume.
metadata = resource2.Body("metadata")
metadata = resource.Body("metadata")
#: One or more metadata key and value pairs about image
volume_image_metadata = resource2.Body("volume_image_metadata")
volume_image_metadata = resource.Body("volume_image_metadata")
#: One of the following values: creating, available, attaching, in-use
#: deleting, error, error_deleting, backing-up, restoring-backup,
#: error_restoring. For details on these statuses, see the
#: Block Storage API documentation.
status = resource2.Body("status")
status = resource.Body("status")
#: TODO(briancurtin): This is currently undocumented in the API.
attachments = resource2.Body("attachments")
attachments = resource.Body("attachments")
#: The timestamp of this volume creation.
created_at = resource2.Body("created_at")
created_at = resource.Body("created_at")
class VolumeDetail(Volume):
@ -82,24 +82,24 @@ class VolumeDetail(Volume):
base_path = "/volumes/detail"
#: The volume's current back-end.
host = resource2.Body("os-vol-host-attr:host")
host = resource.Body("os-vol-host-attr:host")
#: The project ID associated with current back-end.
project_id = resource2.Body("os-vol-tenant-attr:tenant_id")
project_id = resource.Body("os-vol-tenant-attr:tenant_id")
#: The status of this volume's migration (None means that a migration
#: is not currently in progress).
migration_status = resource2.Body("os-vol-mig-status-attr:migstat")
migration_status = resource.Body("os-vol-mig-status-attr:migstat")
#: The volume ID that this volume's name on the back-end is based on.
migration_id = resource2.Body("os-vol-mig-status-attr:name_id")
migration_id = resource.Body("os-vol-mig-status-attr:name_id")
#: Status of replication on this volume.
replication_status = resource2.Body("replication_status")
replication_status = resource.Body("replication_status")
#: Extended replication status on this volume.
extended_replication_status = resource2.Body(
extended_replication_status = resource.Body(
"os-volume-replication:extended_status")
#: ID of the consistency group.
consistency_group_id = resource2.Body("consistencygroup_id")
consistency_group_id = resource.Body("consistencygroup_id")
#: Data set by the replication driver
replication_driver_data = resource2.Body(
replication_driver_data = resource.Body(
"os-volume-replication:driver_data")
#: ``True`` if this volume is encrypted, ``False`` if not.
#: *Type: bool*
is_encrypted = resource2.Body("encrypted", type=format.BoolStr)
is_encrypted = resource.Body("encrypted", type=format.BoolStr)

View File

@ -23,12 +23,12 @@ from openstack.clustering.v1 import profile as _profile
from openstack.clustering.v1 import profile_type as _profile_type
from openstack.clustering.v1 import receiver as _receiver
from openstack.clustering.v1 import service as _service
from openstack import proxy2
from openstack import resource2
from openstack import proxy
from openstack import resource
from openstack import utils
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def get_build_info(self):
"""Get build info for service engine and API
@ -913,7 +913,7 @@ class Proxy(proxy2.BaseProxy):
enabled on the cluster.
:returns: A generator of cluster-policy binding instances.
"""
cluster_id = resource2.Resource._get_id(cluster)
cluster_id = resource.Resource._get_id(cluster)
return self._list(_cluster_policy.ClusterPolicy, paginated=False,
cluster_id=cluster_id, **query)
@ -1102,13 +1102,13 @@ class Proxy(proxy2.BaseProxy):
"""
return self._list(_event.Event, paginated=True, **query)
def wait_for_status(self, resource, status, failures=None, interval=2,
def wait_for_status(self, res, status, failures=None, interval=2,
wait=120):
"""Wait for a resource to be in a particular status.
:param resource: The resource to wait on to reach the specified status.
The resource must have a ``status`` attribute.
:type resource: A :class:`~openstack.resource2.Resource` object.
:param res: The resource to wait on to reach the specified status.
The resource must have a ``status`` attribute.
:type resource: A :class:`~openstack.resource.Resource` object.
:param status: Desired status.
:param failures: Statuses that would be interpreted as failures.
:type failures: :py:class:`list`
@ -1125,14 +1125,14 @@ class Proxy(proxy2.BaseProxy):
``status`` attribute.
"""
failures = [] if failures is None else failures
return resource2.wait_for_status(self, resource, status,
failures, interval, wait)
return resource.wait_for_status(
self, res, status, failures, interval, wait)
def wait_for_delete(self, resource, interval=2, wait=120):
def wait_for_delete(self, res, interval=2, wait=120):
"""Wait for a resource to be deleted.
:param resource: The resource to wait on to be deleted.
:type resource: A :class:`~openstack.resource2.Resource` object.
:param res: The resource to wait on to be deleted.
:type resource: A :class:`~openstack.resource.Resource` object.
:param interval: Number of seconds to wait before to consecutive
checks. Default to 2.
:param wait: Maximum number of seconds to wait before the change.
@ -1141,8 +1141,7 @@ class Proxy(proxy2.BaseProxy):
:raises: :class:`~openstack.exceptions.ResourceTimeout` if transition
to delete failed to occur in the specified seconds.
"""
return resource2.wait_for_delete(self, resource, interval,
wait)
return resource.wait_for_delete(self, res, interval, wait)
def services(self, **query):
"""Get a generator of services.

View File

@ -12,7 +12,7 @@
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class Action(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class BuildInfo(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
from openstack import utils

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class ClusterAttr(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class ClusterPolicy(resource.Resource):

View File

@ -12,7 +12,7 @@
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class Event(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
from openstack import utils

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class Policy(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class PolicyType(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class Profile(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class ProfileType(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class Receiver(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class Service(resource.Resource):

View File

@ -12,7 +12,7 @@
from openstack.clustering import clustering_service
from openstack import resource2 as resource
from openstack import resource
class Version(resource.Resource):

View File

@ -23,11 +23,11 @@ from openstack.compute.v2 import server_interface as _server_interface
from openstack.compute.v2 import server_ip
from openstack.compute.v2 import service as _service
from openstack.compute.v2 import volume_attachment as _volume_attachment
from openstack import proxy2
from openstack import resource2
from openstack import proxy
from openstack import resource
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def find_extension(self, name_or_id, ignore_missing=True):
"""Find a single extension
@ -501,7 +501,7 @@ class Proxy(proxy2.BaseProxy):
:returns: None
"""
server = self._get_resource(_server.Server, server)
flavor_id = resource2.Resource._get_id(flavor)
flavor_id = resource.Resource._get_id(flavor)
server.resize(self, flavor_id)
def confirm_server_resize(self, server):
@ -551,7 +551,7 @@ class Proxy(proxy2.BaseProxy):
:returns: None
"""
server = self._get_resource(_server.Server, server)
security_group_id = resource2.Resource._get_id(security_group)
security_group_id = resource.Resource._get_id(security_group)
server.add_security_group(self, security_group_id)
def remove_security_group_from_server(self, server, security_group):
@ -566,7 +566,7 @@ class Proxy(proxy2.BaseProxy):
:returns: None
"""
server = self._get_resource(_server.Server, server)
security_group_id = resource2.Resource._get_id(security_group)
security_group_id = resource.Resource._get_id(security_group)
server.remove_security_group(self, security_group_id)
def add_fixed_ip_to_server(self, server, network_id):
@ -806,8 +806,8 @@ class Proxy(proxy2.BaseProxy):
def wait_for_server(self, server, status='ACTIVE', failures=['ERROR'],
interval=2, wait=120):
return resource2.wait_for_status(self, server, status,
failures, interval, wait)
return resource.wait_for_status(
self, server, status, failures, interval, wait)
def create_server_interface(self, server, **attrs):
"""Create a new server interface from attributes
@ -822,7 +822,7 @@ class Proxy(proxy2.BaseProxy):
:returns: The results of server interface creation
:rtype: :class:`~openstack.compute.v2.server_interface.ServerInterface`
"""
server_id = resource2.Resource._get_id(server)
server_id = resource.Resource._get_id(server)
return self._create(_server_interface.ServerInterface,
server_id=server_id, **attrs)
@ -848,7 +848,7 @@ class Proxy(proxy2.BaseProxy):
"""
server_id = self._get_uri_attribute(server_interface, server,
"server_id")
server_interface = resource2.Resource._get_id(server_interface)
server_interface = resource.Resource._get_id(server_interface)
self._delete(_server_interface.ServerInterface,
port_id=server_interface,
@ -874,7 +874,7 @@ class Proxy(proxy2.BaseProxy):
"""
server_id = self._get_uri_attribute(server_interface, server,
"server_id")
server_interface = resource2.Resource._get_id(server_interface)
server_interface = resource.Resource._get_id(server_interface)
return self._get(_server_interface.ServerInterface,
server_id=server_id, port_id=server_interface)
@ -888,7 +888,7 @@ class Proxy(proxy2.BaseProxy):
:returns: A generator of ServerInterface objects
:rtype: :class:`~openstack.compute.v2.server_interface.ServerInterface`
"""
server_id = resource2.Resource._get_id(server)
server_id = resource.Resource._get_id(server)
return self._list(_server_interface.ServerInterface, paginated=False,
server_id=server_id)
@ -903,7 +903,7 @@ class Proxy(proxy2.BaseProxy):
:returns: A generator of ServerIP objects
:rtype: :class:`~openstack.compute.v2.server_ip.ServerIP`
"""
server_id = resource2.Resource._get_id(server)
server_id = resource.Resource._get_id(server)
return self._list(server_ip.ServerIP, paginated=False,
server_id=server_id, network_label=network_label)
@ -1150,7 +1150,7 @@ class Proxy(proxy2.BaseProxy):
:rtype:
:class:`~openstack.compute.v2.volume_attachment.VolumeAttachment`
"""
server_id = resource2.Resource._get_id(server)
server_id = resource.Resource._get_id(server)
return self._create(_volume_attachment.VolumeAttachment,
server_id=server_id, **attrs)
@ -1177,7 +1177,7 @@ class Proxy(proxy2.BaseProxy):
"""
server_id = self._get_uri_attribute(volume_attachment, server,
"server_id")
volume_attachment = resource2.Resource._get_id(volume_attachment)
volume_attachment = resource.Resource._get_id(volume_attachment)
return self._update(_volume_attachment.VolumeAttachment,
attachment_id=volume_attachment,
@ -1206,7 +1206,7 @@ class Proxy(proxy2.BaseProxy):
"""
server_id = self._get_uri_attribute(volume_attachment, server,
"server_id")
volume_attachment = resource2.Resource._get_id(volume_attachment)
volume_attachment = resource.Resource._get_id(volume_attachment)
self._delete(_volume_attachment.VolumeAttachment,
attachment_id=volume_attachment,
@ -1239,7 +1239,7 @@ class Proxy(proxy2.BaseProxy):
"""
server_id = self._get_uri_attribute(volume_attachment, server,
"server_id")
volume_attachment = resource2.Resource._get_id(volume_attachment)
volume_attachment = resource.Resource._get_id(volume_attachment)
return self._get(_volume_attachment.VolumeAttachment,
server_id=server_id,
@ -1256,7 +1256,7 @@ class Proxy(proxy2.BaseProxy):
:rtype:
:class:`~openstack.compute.v2.volume_attachment.VolumeAttachment`
"""
server_id = resource2.Resource._get_id(server)
server_id = resource.Resource._get_id(server)
return self._list(_volume_attachment.VolumeAttachment, paginated=False,
server_id=server_id)

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class AvailabilityZone(resource2.Resource):
class AvailabilityZone(resource.Resource):
resources_key = 'availabilityZoneInfo'
base_path = '/os-availability-zone'
@ -25,11 +25,11 @@ class AvailabilityZone(resource2.Resource):
# Properties
#: name of availability zone
name = resource2.Body('zoneName')
name = resource.Body('zoneName')
#: state of availability zone
state = resource2.Body('zoneState')
state = resource.Body('zoneState')
#: hosts of availability zone
hosts = resource2.Body('hosts')
hosts = resource.Body('hosts')
class AvailabilityZoneDetail(AvailabilityZone):

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class Extension(resource2.Resource):
class Extension(resource.Resource):
resource_key = 'extension'
resources_key = 'extensions'
base_path = '/extensions'
@ -27,15 +27,15 @@ class Extension(resource2.Resource):
# Properties
#: A short name by which this extension is also known.
alias = resource2.Body('alias', alternate_id=True)
alias = resource.Body('alias', alternate_id=True)
#: Text describing this extension's purpose.
description = resource2.Body('description')
description = resource.Body('description')
#: Links pertaining to this extension. This is a list of dictionaries,
#: each including keys ``href`` and ``rel``.
links = resource2.Body('links')
links = resource.Body('links')
#: The name of the extension.
name = resource2.Body('name')
name = resource.Body('name')
#: A URL pointing to the namespace for this extension.
namespace = resource2.Body('namespace')
namespace = resource.Body('namespace')
#: Timestamp when this extension was last updated.
updated_at = resource2.Body('updated')
updated_at = resource.Body('updated')

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class Flavor(resource2.Resource):
class Flavor(resource.Resource):
resource_key = 'flavor'
resources_key = 'flavors'
base_path = '/flavors'
@ -26,33 +26,34 @@ class Flavor(resource2.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters("sort_key", "sort_dir",
min_disk="minDisk",
min_ram="minRam")
_query_mapping = resource.QueryParameters(
"sort_key", "sort_dir",
min_disk="minDisk",
min_ram="minRam")
# Properties
#: Links pertaining to this flavor. This is a list of dictionaries,
#: each including keys ``href`` and ``rel``.
links = resource2.Body('links')
links = resource.Body('links')
#: The name of this flavor.
name = resource2.Body('name')
name = resource.Body('name')
#: Size of the disk this flavor offers. *Type: int*
disk = resource2.Body('disk', type=int)
disk = resource.Body('disk', type=int)
#: ``True`` if this is a publicly visible flavor. ``False`` if this is
#: a private image. *Type: bool*
is_public = resource2.Body('os-flavor-access:is_public', type=bool)
is_public = resource.Body('os-flavor-access:is_public', type=bool)
#: The amount of RAM (in MB) this flavor offers. *Type: int*
ram = resource2.Body('ram', type=int)
ram = resource.Body('ram', type=int)
#: The number of virtual CPUs this flavor offers. *Type: int*
vcpus = resource2.Body('vcpus', type=int)
vcpus = resource.Body('vcpus', type=int)
#: Size of the swap partitions.
swap = resource2.Body('swap')
swap = resource.Body('swap')
#: Size of the ephemeral data disk attached to this server. *Type: int*
ephemeral = resource2.Body('OS-FLV-EXT-DATA:ephemeral', type=int)
ephemeral = resource.Body('OS-FLV-EXT-DATA:ephemeral', type=int)
#: ``True`` if this flavor is disabled, ``False`` if not. *Type: bool*
is_disabled = resource2.Body('OS-FLV-DISABLED:disabled', type=bool)
is_disabled = resource.Body('OS-FLV-DISABLED:disabled', type=bool)
#: The bandwidth scaling factor this flavor receives on the network.
rxtx_factor = resource2.Body('rxtx_factor', type=float)
rxtx_factor = resource.Body('rxtx_factor', type=float)
class FlavorDetail(Flavor):

View File

@ -12,10 +12,10 @@
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class Hypervisor(resource2.Resource):
class Hypervisor(resource.Resource):
resource_key = 'hypervisor'
resources_key = 'hypervisors'
base_path = '/os-hypervisors'
@ -28,40 +28,40 @@ class Hypervisor(resource2.Resource):
# Properties
#: Status of hypervisor
status = resource2.Body('status')
status = resource.Body('status')
#: State of hypervisor
state = resource2.Body('state')
state = resource.Body('state')
#: Name of hypervisor
name = resource2.Body('hypervisor_hostname')
name = resource.Body('hypervisor_hostname')
#: Service details
service_details = resource2.Body('service')
service_details = resource.Body('service')
#: Count of the VCPUs in use
vcpus_used = resource2.Body('vcpus_used')
vcpus_used = resource.Body('vcpus_used')
#: Count of all VCPUs
vcpus = resource2.Body('vcpus')
vcpus = resource.Body('vcpus')
#: Count of the running virtual machines
running_vms = resource2.Body('running_vms')
running_vms = resource.Body('running_vms')
#: The type of hypervisor
hypervisor_type = resource2.Body('hypervisor_type')
hypervisor_type = resource.Body('hypervisor_type')
#: Version of the hypervisor
hypervisor_version = resource2.Body('hypervisor_version')
hypervisor_version = resource.Body('hypervisor_version')
#: The amount, in gigabytes, of local storage used
local_disk_used = resource2.Body('local_gb_used')
local_disk_used = resource.Body('local_gb_used')
#: The amount, in gigabytes, of the local storage device
local_disk_size = resource2.Body('local_gb')
local_disk_size = resource.Body('local_gb')
#: The amount, in gigabytes, of free space on the local storage device
local_disk_free = resource2.Body('free_disk_gb')
local_disk_free = resource.Body('free_disk_gb')
#: The amount, in megabytes, of memory
memory_used = resource2.Body('memory_mb_used')
memory_used = resource.Body('memory_mb_used')
#: The amount, in megabytes, of total memory
memory_size = resource2.Body('memory_mb')
memory_size = resource.Body('memory_mb')
#: The amount, in megabytes, of available memory
memory_free = resource2.Body('free_ram_mb')
memory_free = resource.Body('free_ram_mb')
#: Measurement of the hypervisor's current workload
current_workload = resource2.Body('current_workload')
current_workload = resource.Body('current_workload')
#: Information about the hypervisor's CPU
cpu_info = resource2.Body('cpu_info')
cpu_info = resource.Body('cpu_info')
#: IP address of the host
host_ip = resource2.Body('host_ip')
host_ip = resource.Body('host_ip')
#: Disk space available to the scheduler
disk_available = resource2.Body("disk_available_least")
disk_available = resource.Body("disk_available_least")

View File

@ -12,10 +12,10 @@
from openstack.compute import compute_service
from openstack.compute.v2 import metadata
from openstack import resource2
from openstack import resource
class Image(resource2.Resource, metadata.MetadataMixin):
class Image(resource.Resource, metadata.MetadataMixin):
resource_key = 'image'
resources_key = 'images'
base_path = '/images'
@ -26,35 +26,35 @@ class Image(resource2.Resource, metadata.MetadataMixin):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters("server", "name",
"status", "type",
min_disk="minDisk",
min_ram="minRam",
changes_since="changes-since")
_query_mapping = resource.QueryParameters(
"server", "name", "status", "type",
min_disk="minDisk",
min_ram="minRam",
changes_since="changes-since")
# Properties
#: Links pertaining to this image. This is a list of dictionaries,
#: each including keys ``href`` and ``rel``, and optionally ``type``.
links = resource2.Body('links')
links = resource.Body('links')
#: The name of this image.
name = resource2.Body('name')
name = resource.Body('name')
#: Timestamp when the image was created.
created_at = resource2.Body('created')
created_at = resource.Body('created')
#: Metadata pertaining to this image. *Type: dict*
metadata = resource2.Body('metadata', type=dict)
metadata = resource.Body('metadata', type=dict)
#: The mimimum disk size. *Type: int*
min_disk = resource2.Body('minDisk', type=int)
min_disk = resource.Body('minDisk', type=int)
#: The minimum RAM size. *Type: int*
min_ram = resource2.Body('minRam', type=int)
min_ram = resource.Body('minRam', type=int)
#: If this image is still building, its progress is represented here.
#: Once an image is created, progres will be 100. *Type: int*
progress = resource2.Body('progress', type=int)
progress = resource.Body('progress', type=int)
#: The status of this image.
status = resource2.Body('status')
status = resource.Body('status')
#: Timestamp when the image was updated.
updated_at = resource2.Body('updated')
updated_at = resource.Body('updated')
#: Size of the image in bytes. *Type: int*
size = resource2.Body('OS-EXT-IMG-SIZE:size', type=int)
size = resource.Body('OS-EXT-IMG-SIZE:size', type=int)
class ImageDetail(Image):

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class Keypair(resource2.Resource):
class Keypair(resource.Resource):
resource_key = 'keypair'
resources_key = 'keypairs'
base_path = '/os-keypairs'
@ -29,7 +29,7 @@ class Keypair(resource2.Resource):
# Properties
#: The short fingerprint associated with the ``public_key`` for
#: this keypair.
fingerprint = resource2.Body('fingerprint')
fingerprint = resource.Body('fingerprint')
# NOTE: There is in fact an 'id' field. However, it's not useful
# because all operations use the 'name' as an identifier.
# Additionally, the 'id' field only appears *after* creation,
@ -37,13 +37,13 @@ class Keypair(resource2.Resource):
# and it just gets in the way. We need to cover this up by listing
# name as alternate_id and listing id as coming from name.
#: The id identifying the keypair
id = resource2.Body('name')
id = resource.Body('name')
#: A name identifying the keypair
name = resource2.Body('name', alternate_id=True)
name = resource.Body('name', alternate_id=True)
#: The private key for the keypair
private_key = resource2.Body('private_key')
private_key = resource.Body('private_key')
#: The SSH public key that is paired with the server.
public_key = resource2.Body('public_key')
public_key = resource.Body('public_key')
def _consume_attrs(self, mapping, attrs):
# TODO(mordred) This should not be required. However, without doing

View File

@ -11,72 +11,72 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class AbsoluteLimits(resource2.Resource):
class AbsoluteLimits(resource.Resource):
#: The number of key-value pairs that can be set as image metadata.
image_meta = resource2.Body("maxImageMeta")
image_meta = resource.Body("maxImageMeta")
#: The maximum number of personality contents that can be supplied.
personality = resource2.Body("maxPersonality")
personality = resource.Body("maxPersonality")
#: The maximum size, in bytes, of a personality.
personality_size = resource2.Body("maxPersonalitySize")
personality_size = resource.Body("maxPersonalitySize")
#: The maximum amount of security group rules allowed.
security_group_rules = resource2.Body("maxSecurityGroupRules")
security_group_rules = resource.Body("maxSecurityGroupRules")
#: The maximum amount of security groups allowed.
security_groups = resource2.Body("maxSecurityGroups")
security_groups = resource.Body("maxSecurityGroups")
#: The amount of security groups currently in use.
security_groups_used = resource2.Body("totalSecurityGroupsUsed")
security_groups_used = resource.Body("totalSecurityGroupsUsed")
#: The number of key-value pairs that can be set as sever metadata.
server_meta = resource2.Body("maxServerMeta")
server_meta = resource.Body("maxServerMeta")
#: The maximum amount of cores.
total_cores = resource2.Body("maxTotalCores")
total_cores = resource.Body("maxTotalCores")
#: The amount of cores currently in use.
total_cores_used = resource2.Body("totalCoresUsed")
total_cores_used = resource.Body("totalCoresUsed")
#: The maximum amount of floating IPs.
floating_ips = resource2.Body("maxTotalFloatingIps")
floating_ips = resource.Body("maxTotalFloatingIps")
#: The amount of floating IPs currently in use.
floating_ips_used = resource2.Body("totalFloatingIpsUsed")
floating_ips_used = resource.Body("totalFloatingIpsUsed")
#: The maximum amount of instances.
instances = resource2.Body("maxTotalInstances")
instances = resource.Body("maxTotalInstances")
#: The amount of instances currently in use.
instances_used = resource2.Body("totalInstancesUsed")
instances_used = resource.Body("totalInstancesUsed")
#: The maximum amount of keypairs.
keypairs = resource2.Body("maxTotalKeypairs")
keypairs = resource.Body("maxTotalKeypairs")
#: The maximum RAM size in megabytes.
total_ram = resource2.Body("maxTotalRAMSize")
total_ram = resource.Body("maxTotalRAMSize")
#: The RAM size in megabytes currently in use.
total_ram_used = resource2.Body("totalRAMUsed")
total_ram_used = resource.Body("totalRAMUsed")
#: The maximum amount of server groups.
server_groups = resource2.Body("maxServerGroups")
server_groups = resource.Body("maxServerGroups")
#: The amount of server groups currently in use.
server_groups_used = resource2.Body("totalServerGroupsUsed")
server_groups_used = resource.Body("totalServerGroupsUsed")
#: The maximum number of members in a server group.
server_group_members = resource2.Body("maxServerGroupMembers")
server_group_members = resource.Body("maxServerGroupMembers")
class RateLimit(resource2.Resource):
class RateLimit(resource.Resource):
# TODO(mordred) Make a resource type for the contents of limit and add
# it to list_type here.
#: A list of the specific limits that apply to the ``regex`` and ``uri``.
limits = resource2.Body("limit", type=list)
limits = resource.Body("limit", type=list)
#: A regex representing which routes this rate limit applies to.
regex = resource2.Body("regex")
regex = resource.Body("regex")
#: A URI representing which routes this rate limit applies to.
uri = resource2.Body("uri")
uri = resource.Body("uri")
class Limits(resource2.Resource):
class Limits(resource.Resource):
base_path = "/limits"
resource_key = "limits"
service = compute_service.ComputeService()
allow_get = True
absolute = resource2.Body("absolute", type=AbsoluteLimits)
rate = resource2.Body("rate", type=list, list_type=RateLimit)
absolute = resource.Body("absolute", type=AbsoluteLimits)
rate = resource.Body("rate", type=list, list_type=RateLimit)
def get(self, session, requires_id=False, error_message=None):
"""Get the Limits resource.

View File

@ -12,11 +12,11 @@
from openstack.compute import compute_service
from openstack.compute.v2 import metadata
from openstack import resource2
from openstack import resource
from openstack import utils
class Server(resource2.Resource, metadata.MetadataMixin):
class Server(resource.Resource, metadata.MetadataMixin):
resource_key = 'server'
resources_key = 'servers'
base_path = '/servers'
@ -29,115 +29,116 @@ class Server(resource2.Resource, metadata.MetadataMixin):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters("image", "flavor", "name",
"status", "host", "all_tenants",
"sort_key", "sort_dir",
"reservation_id", "tags",
"project_id",
tags_any="tags-any",
not_tags="not-tags",
not_tags_any="not-tags-any",
is_deleted="deleted",
ipv4_address="ip",
ipv6_address="ip6",
changes_since="changes-since")
_query_mapping = resource.QueryParameters(
"image", "flavor", "name",
"status", "host", "all_tenants",
"sort_key", "sort_dir",
"reservation_id", "tags",
"project_id",
tags_any="tags-any",
not_tags="not-tags",
not_tags_any="not-tags-any",
is_deleted="deleted",
ipv4_address="ip",
ipv6_address="ip6",
changes_since="changes-since")
#: A list of dictionaries holding links relevant to this server.
links = resource2.Body('links')
links = resource.Body('links')
access_ipv4 = resource2.Body('accessIPv4')
access_ipv6 = resource2.Body('accessIPv6')
access_ipv4 = resource.Body('accessIPv4')
access_ipv6 = resource.Body('accessIPv6')
#: A dictionary of addresses this server can be accessed through.
#: The dictionary contains keys such as ``private`` and ``public``,
#: each containing a list of dictionaries for addresses of that type.
#: The addresses are contained in a dictionary with keys ``addr``
#: and ``version``, which is either 4 or 6 depending on the protocol
#: of the IP address. *Type: dict*
addresses = resource2.Body('addresses', type=dict)
addresses = resource.Body('addresses', type=dict)
#: Timestamp of when the server was created.
created_at = resource2.Body('created')
created_at = resource.Body('created')
#: The flavor reference, as a ID or full URL, for the flavor to use for
#: this server.
flavor_id = resource2.Body('flavorRef')
flavor_id = resource.Body('flavorRef')
#: The flavor property as returned from server.
flavor = resource2.Body('flavor', type=dict)
flavor = resource.Body('flavor', type=dict)
#: An ID representing the host of this server.
host_id = resource2.Body('hostId')
host_id = resource.Body('hostId')
#: The image reference, as a ID or full URL, for the image to use for
#: this server.
image_id = resource2.Body('imageRef')
image_id = resource.Body('imageRef')
#: The image property as returned from server.
image = resource2.Body('image', type=dict)
image = resource.Body('image', type=dict)
#: Metadata stored for this server. *Type: dict*
metadata = resource2.Body('metadata', type=dict)
metadata = resource.Body('metadata', type=dict)
#: While the server is building, this value represents the percentage
#: of completion. Once it is completed, it will be 100. *Type: int*
progress = resource2.Body('progress', type=int)
progress = resource.Body('progress', type=int)
#: The ID of the project this server is associated with.
project_id = resource2.Body('tenant_id')
project_id = resource.Body('tenant_id')
#: The state this server is in. Valid values include ``ACTIVE``,
#: ``BUILDING``, ``DELETED``, ``ERROR``, ``HARD_REBOOT``, ``PASSWORD``,
#: ``PAUSED``, ``REBOOT``, ``REBUILD``, ``RESCUED``, ``RESIZED``,
#: ``REVERT_RESIZE``, ``SHUTOFF``, ``SOFT_DELETED``, ``STOPPED``,
#: ``SUSPENDED``, ``UNKNOWN``, or ``VERIFY_RESIZE``.
status = resource2.Body('status')
status = resource.Body('status')
#: Timestamp of when this server was last updated.
updated_at = resource2.Body('updated')
updated_at = resource.Body('updated')
#: The ID of the owners of this server.
user_id = resource2.Body('user_id')
user_id = resource.Body('user_id')
#: The name of an associated keypair
key_name = resource2.Body('key_name')
key_name = resource.Body('key_name')
#: The disk configuration. Either AUTO or MANUAL.
disk_config = resource2.Body('OS-DCF:diskConfig')
disk_config = resource.Body('OS-DCF:diskConfig')
#: Indicates whether a configuration drive enables metadata injection.
#: Not all cloud providers enable this feature.
has_config_drive = resource2.Body('config_drive')
has_config_drive = resource.Body('config_drive')
#: The name of the availability zone this server is a part of.
availability_zone = resource2.Body('OS-EXT-AZ:availability_zone')
availability_zone = resource.Body('OS-EXT-AZ:availability_zone')
#: The power state of this server.
power_state = resource2.Body('OS-EXT-STS:power_state')
power_state = resource.Body('OS-EXT-STS:power_state')
#: The task state of this server.
task_state = resource2.Body('OS-EXT-STS:task_state')
task_state = resource.Body('OS-EXT-STS:task_state')
#: The VM state of this server.
vm_state = resource2.Body('OS-EXT-STS:vm_state')
vm_state = resource.Body('OS-EXT-STS:vm_state')
#: A list of an attached volumes. Each item in the list contains at least
#: an "id" key to identify the specific volumes.
attached_volumes = resource2.Body(
attached_volumes = resource.Body(
'os-extended-volumes:volumes_attached')
#: The timestamp when the server was launched.
launched_at = resource2.Body('OS-SRV-USG:launched_at')
launched_at = resource.Body('OS-SRV-USG:launched_at')
#: The timestamp when the server was terminated (if it has been).
terminated_at = resource2.Body('OS-SRV-USG:terminated_at')
terminated_at = resource.Body('OS-SRV-USG:terminated_at')
#: A list of applicable security groups. Each group contains keys for
#: description, name, id, and rules.
security_groups = resource2.Body('security_groups')
security_groups = resource.Body('security_groups')
#: When a server is first created, it provides the administrator password.
admin_password = resource2.Body('adminPass')
admin_password = resource.Body('adminPass')
#: The file path and contents, text only, to inject into the server at
#: launch. The maximum size of the file path data is 255 bytes.
#: The maximum limit is The number of allowed bytes in the decoded,
#: rather than encoded, data.
personality = resource2.Body('personality')
personality = resource.Body('personality')
#: Configuration information or scripts to use upon launch.
#: Must be Base64 encoded.
user_data = resource2.Body('OS-EXT-SRV-ATTR:user_data')
user_data = resource.Body('OS-EXT-SRV-ATTR:user_data')
#: Enables fine grained control of the block device mapping for an
#: instance. This is typically used for booting servers from volumes.
block_device_mapping = resource2.Body('block_device_mapping_v2')
block_device_mapping = resource.Body('block_device_mapping_v2')
#: The dictionary of data to send to the scheduler.
scheduler_hints = resource2.Body('OS-SCH-HNT:scheduler_hints', type=dict)
scheduler_hints = resource.Body('OS-SCH-HNT:scheduler_hints', type=dict)
#: A networks object. Required parameter when there are multiple
#: networks defined for the tenant. When you do not specify the
#: networks parameter, the server attaches to the only network
#: created for the current tenant.
networks = resource2.Body('networks')
networks = resource.Body('networks')
#: The hypervisor host name. Appears in the response for administrative
#: users only.
hypervisor_hostname = resource2.Body('OS-EXT-SRV-ATTR:hypervisor_hostname')
hypervisor_hostname = resource.Body('OS-EXT-SRV-ATTR:hypervisor_hostname')
#: The instance name. The Compute API generates the instance name from the
#: instance name template. Appears in the response for administrative users
#: only.
instance_name = resource2.Body('OS-EXT-SRV-ATTR:instance_name')
instance_name = resource.Body('OS-EXT-SRV-ATTR:instance_name')
def _prepare_request(self, requires_id=True, prepend_key=True):
request = super(Server, self)._prepare_request(requires_id=requires_id,
@ -206,7 +207,7 @@ class Server(resource2.Resource, metadata.MetadataMixin):
'preserve_ephemeral': preserve_ephemeral
}
if image is not None:
action['imageRef'] = resource2.Resource._get_id(image)
action['imageRef'] = resource.Resource._get_id(image)
if access_ipv4 is not None:
action['accessIPv4'] = access_ipv4
if access_ipv6 is not None:

View File

@ -11,16 +11,16 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class ServerGroup(resource2.Resource):
class ServerGroup(resource.Resource):
resource_key = 'server_group'
resources_key = 'server_groups'
base_path = '/os-server-groups'
service = compute_service.ComputeService()
_query_mapping = resource2.QueryParameters("all_projects")
_query_mapping = resource.QueryParameters("all_projects")
# capabilities
allow_create = True
@ -30,10 +30,10 @@ class ServerGroup(resource2.Resource):
# Properties
#: A name identifying the server group
name = resource2.Body('name')
name = resource.Body('name')
#: The list of policies supported by the server group
policies = resource2.Body('policies')
policies = resource.Body('policies')
#: The list of members in the server group
member_ids = resource2.Body('members')
member_ids = resource.Body('members')
#: The metadata associated with the server group
metadata = resource2.Body('metadata')
metadata = resource.Body('metadata')

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class ServerInterface(resource2.Resource):
class ServerInterface(resource.Resource):
resource_key = 'interfaceAttachment'
resources_key = 'interfaceAttachments'
base_path = '/servers/%(server_id)s/os-interface'
@ -28,14 +28,14 @@ class ServerInterface(resource2.Resource):
allow_list = True
#: Fixed IP addresses with subnet IDs.
fixed_ips = resource2.Body('fixed_ips')
fixed_ips = resource.Body('fixed_ips')
#: The MAC address.
mac_addr = resource2.Body('mac_addr')
mac_addr = resource.Body('mac_addr')
#: The network ID.
net_id = resource2.Body('net_id')
net_id = resource.Body('net_id')
#: The ID of the port for which you want to create an interface.
port_id = resource2.Body('port_id', alternate_id=True)
port_id = resource.Body('port_id', alternate_id=True)
#: The port state.
port_state = resource2.Body('port_state')
port_state = resource.Body('port_state')
#: The ID for the server.
server_id = resource2.URI('server_id')
server_id = resource.URI('server_id')

View File

@ -11,11 +11,11 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
from openstack import utils
class ServerIP(resource2.Resource):
class ServerIP(resource.Resource):
resources_key = 'addresses'
base_path = '/servers/%(server_id)s/ips'
service = compute_service.ComputeService()
@ -25,13 +25,13 @@ class ServerIP(resource2.Resource):
# Properties
#: The IP address. The format of the address depends on :attr:`version`
address = resource2.Body('addr')
address = resource.Body('addr')
#: The network label, such as public or private.
network_label = resource2.URI('network_label')
network_label = resource.URI('network_label')
#: The ID for the server.
server_id = resource2.URI('server_id')
server_id = resource.URI('server_id')
# Version of the IP protocol. Currently either 4 or 6.
version = resource2.Body('version')
version = resource.Body('version')
@classmethod
def list(cls, session, paginated=False, server_id=None,

View File

@ -11,11 +11,11 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
from openstack import utils
class Service(resource2.Resource):
class Service(resource.Resource):
resource_key = 'service'
resources_key = 'services'
base_path = '/os-services'
@ -28,19 +28,19 @@ class Service(resource2.Resource):
# Properties
#: Status of service
status = resource2.Body('status')
status = resource.Body('status')
#: State of service
state = resource2.Body('state')
state = resource.Body('state')
#: Name of service
binary = resource2.Body('binary')
binary = resource.Body('binary')
#: Id of service
id = resource2.Body('id')
id = resource.Body('id')
#: Disabled reason of service
disables_reason = resource2.Body('disabled_reason')
disables_reason = resource.Body('disabled_reason')
#: Host where service runs
host = resource2.Body('host')
host = resource.Body('host')
#: The availability zone of service
zone = resource2.Body("zone")
zone = resource.Body("zone")
def _action(self, session, action, body):
url = utils.urljoin(Service.base_path, action)

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2
from openstack import resource
class VolumeAttachment(resource2.Resource):
class VolumeAttachment(resource.Resource):
resource_key = 'volumeAttachment'
resources_key = 'volumeAttachments'
base_path = '/servers/%(server_id)s/os-volume_attachments'
@ -27,15 +27,15 @@ class VolumeAttachment(resource2.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters("limit", "offset")
_query_mapping = resource.QueryParameters("limit", "offset")
#: Name of the device such as, /dev/vdb.
device = resource2.Body('device')
device = resource.Body('device')
#: The ID of the attachment.
id = resource2.Body('id')
id = resource.Body('id')
#: The ID for the server.
server_id = resource2.URI('server_id')
server_id = resource.URI('server_id')
#: The ID of the attached volume.
volume_id = resource2.Body('volumeId')
volume_id = resource.Body('volumeId')
#: The ID of the attachment you want to delete or update.
attachment_id = resource2.Body('attachment_id', alternate_id=True)
attachment_id = resource.Body('attachment_id', alternate_id=True)

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.compute import compute_service
from openstack import resource2 as resource
from openstack import resource
class Version(resource.Resource):

View File

@ -250,10 +250,10 @@ class Connection(object):
def add_service(self, service):
"""Add a service to the Connection.
Attaches an instance of the :class:`~openstack.proxy2.BaseProxy`
Attaches an instance of the :class:`~openstack.proxy.BaseProxy`
class contained in
:class:`~openstack.service_description.ServiceDescription`.
The :class:`~openstack.proxy2.BaseProxy` will be attached to the
The :class:`~openstack.proxy.BaseProxy` will be attached to the
`Connection` by its ``service_type`` and by any ``aliases`` that
may be specified.

View File

@ -14,10 +14,10 @@ from openstack.database.v1 import database as _database
from openstack.database.v1 import flavor as _flavor
from openstack.database.v1 import instance as _instance
from openstack.database.v1 import user as _user
from openstack import proxy2
from openstack import proxy
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def create_database(self, instance, **attrs):
"""Create a new database from attributes

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.database import database_service
from openstack import resource2 as resource
from openstack import resource
class Database(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.database import database_service
from openstack import resource2 as resource
from openstack import resource
class Flavor(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.database import database_service
from openstack import resource2 as resource
from openstack import resource
from openstack import utils

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.database import database_service
from openstack import resource2 as resource
from openstack import resource
from openstack import utils

View File

@ -14,7 +14,7 @@ from openstack.identity.v2 import extension as _extension
from openstack.identity.v2 import role as _role
from openstack.identity.v2 import tenant as _tenant
from openstack.identity.v2 import user as _user
from openstack import proxy2 as proxy
from openstack import proxy
class Proxy(proxy.BaseProxy):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Extension(resource.Resource):

View File

@ -12,7 +12,7 @@
from openstack import format
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Role(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Tenant(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class User(resource.Resource):

View File

@ -31,7 +31,7 @@ from openstack.identity.v3 import role_project_user_assignment \
from openstack.identity.v3 import service as _service
from openstack.identity.v3 import trust as _trust
from openstack.identity.v3 import user as _user
from openstack import proxy2 as proxy
from openstack import proxy
class Proxy(proxy.BaseProxy):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Credential(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
from openstack import utils

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Endpoint(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Group(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Policy(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
from openstack import utils

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Region(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Role(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class RoleAssignment(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class RoleDomainGroupAssignment(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class RoleDomainUserAssignment(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class RoleProjectGroupAssignment(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class RoleProjectUserAssignment(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Service(resource.Resource):

View File

@ -12,7 +12,7 @@
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Trust(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class User(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.identity import identity_service
from openstack import resource2 as resource
from openstack import resource
class Version(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.image.v1 import image as _image
from openstack import proxy2 as proxy
from openstack import proxy
class Proxy(proxy.BaseProxy):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.image import image_service
from openstack import resource2 as resource
from openstack import resource
class Image(resource.Resource):

View File

@ -13,11 +13,11 @@
from openstack import exceptions
from openstack.image.v2 import image as _image
from openstack.image.v2 import member as _member
from openstack import proxy2
from openstack import resource2
from openstack import proxy
from openstack import resource
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def upload_image(self, container_format=None, disk_format=None,
data=None, **attrs):
@ -221,7 +221,7 @@ class Proxy(proxy2.BaseProxy):
:returns: The results of member creation
:rtype: :class:`~openstack.image.v2.member.Member`
"""
image_id = resource2.Resource._get_id(image)
image_id = resource.Resource._get_id(image)
return self._create(_member.Member, image_id=image_id, **attrs)
def remove_member(self, member, image, ignore_missing=True):
@ -237,8 +237,8 @@ class Proxy(proxy2.BaseProxy):
:returns: ``None``
"""
image_id = resource2.Resource._get_id(image)
member_id = resource2.Resource._get_id(member)
image_id = resource.Resource._get_id(image)
member_id = resource.Resource._get_id(member)
self._delete(_member.Member, member_id=member_id, image_id=image_id,
ignore_missing=ignore_missing)
@ -256,7 +256,7 @@ class Proxy(proxy2.BaseProxy):
attempting to find a nonexistent resource.
:returns: One :class:`~openstack.image.v2.member.Member` or None
"""
image_id = resource2.Resource._get_id(image)
image_id = resource.Resource._get_id(image)
return self._find(_member.Member, name_or_id, image_id=image_id,
ignore_missing=ignore_missing)
@ -272,8 +272,8 @@ class Proxy(proxy2.BaseProxy):
:raises: :class:`~openstack.exceptions.ResourceNotFound`
when no resource can be found.
"""
member_id = resource2.Resource._get_id(member)
image_id = resource2.Resource._get_id(image)
member_id = resource.Resource._get_id(member)
image_id = resource.Resource._get_id(image)
return self._get(_member.Member, member_id=member_id,
image_id=image_id)
@ -287,7 +287,7 @@ class Proxy(proxy2.BaseProxy):
:returns: A generator of member objects
:rtype: :class:`~openstack.image.v2.member.Member`
"""
image_id = resource2.Resource._get_id(image)
image_id = resource.Resource._get_id(image)
return self._list(_member.Member, paginated=False,
image_id=image_id)
@ -305,7 +305,7 @@ class Proxy(proxy2.BaseProxy):
:returns: The updated member
:rtype: :class:`~openstack.image.v2.member.Member`
"""
member_id = resource2.Resource._get_id(member)
image_id = resource2.Resource._get_id(image)
member_id = resource.Resource._get_id(member)
image_id = resource.Resource._get_id(image)
return self._update(_member.Member, member_id=member_id,
image_id=image_id, **attrs)

View File

@ -17,13 +17,13 @@ import jsonpatch
from openstack import _log
from openstack import exceptions
from openstack.image import image_service
from openstack import resource2
from openstack import resource
from openstack import utils
_logger = _log.setup_logging('openstack')
class Image(resource2.Resource):
class Image(resource.Resource):
resources_key = 'images'
base_path = '/images'
service = image_service.ImageService()
@ -36,12 +36,13 @@ class Image(resource2.Resource):
allow_list = True
update_method = 'PATCH'
_query_mapping = resource2.QueryParameters("name", "visibility",
"member_status", "owner",
"status", "size_min",
"size_max", "sort_key",
"sort_dir", "sort", "tag",
"created_at", "updated_at")
_query_mapping = resource.QueryParameters(
"name", "visibility",
"member_status", "owner",
"status", "size_min",
"size_max", "sort_key",
"sort_dir", "sort", "tag",
"created_at", "updated_at")
# NOTE: Do not add "self" support here. If you've used Python before,
# you know that self, while not being a reserved word, has special
@ -57,159 +58,159 @@ class Image(resource2.Resource):
# Properties
#: Hash of the image data used. The Image service uses this value
#: for verification.
checksum = resource2.Body('checksum')
checksum = resource.Body('checksum')
#: The container format refers to whether the VM image is in a file
#: format that also contains metadata about the actual VM.
#: Container formats include OVF and Amazon AMI. In addition,
#: a VM image might not have a container format - instead,
#: the image is just a blob of unstructured data.
container_format = resource2.Body('container_format')
container_format = resource.Body('container_format')
#: The date and time when the image was created.
created_at = resource2.Body('created_at')
created_at = resource.Body('created_at')
#: Valid values are: aki, ari, ami, raw, iso, vhd, vdi, qcow2, or vmdk.
#: The disk format of a VM image is the format of the underlying
#: disk image. Virtual appliance vendors have different formats
#: for laying out the information contained in a VM disk image.
disk_format = resource2.Body('disk_format')
disk_format = resource.Body('disk_format')
#: Defines whether the image can be deleted.
#: *Type: bool*
is_protected = resource2.Body('protected', type=bool)
is_protected = resource.Body('protected', type=bool)
#: The minimum disk size in GB that is required to boot the image.
min_disk = resource2.Body('min_disk')
min_disk = resource.Body('min_disk')
#: The minimum amount of RAM in MB that is required to boot the image.
min_ram = resource2.Body('min_ram')
min_ram = resource.Body('min_ram')
#: The name of the image.
name = resource2.Body('name')
name = resource.Body('name')
#: The ID of the owner, or project, of the image.
owner_id = resource2.Body('owner')
owner_id = resource.Body('owner')
#: Properties, if any, that are associated with the image.
properties = resource2.Body('properties', type=dict)
properties = resource.Body('properties', type=dict)
#: The size of the image data, in bytes.
size = resource2.Body('size', type=int)
size = resource.Body('size', type=int)
#: When present, Glance will attempt to store the disk image data in the
#: backing store indicated by the value of the header. When not present,
#: Glance will store the disk image data in the backing store that is
#: marked default. Valid values are: file, s3, rbd, swift, cinder,
#: gridfs, sheepdog, or vsphere.
store = resource2.Body('store')
store = resource.Body('store')
#: The image status.
status = resource2.Body('status')
status = resource.Body('status')
#: Tags, if any, that are associated with the image.
tags = resource2.Body('tags')
tags = resource.Body('tags')
#: The date and time when the image was updated.
updated_at = resource2.Body('updated_at')
updated_at = resource.Body('updated_at')
#: The virtual size of the image.
virtual_size = resource2.Body('virtual_size')
virtual_size = resource.Body('virtual_size')
#: The image visibility.
visibility = resource2.Body('visibility')
visibility = resource.Body('visibility')
#: The URL for the virtual machine image file.
file = resource2.Body('file')
file = resource.Body('file')
#: A list of URLs to access the image file in external store.
#: This list appears if the show_multiple_locations option is set
#: to true in the Image service's configuration file.
locations = resource2.Body('locations')
locations = resource.Body('locations')
#: The URL to access the image file kept in external store. It appears
#: when you set the show_image_direct_url option to true in the
#: Image service's configuration file.
direct_url = resource2.Body('direct_url')
direct_url = resource.Body('direct_url')
#: An image property.
path = resource2.Body('path')
path = resource.Body('path')
#: Value of image property used in add or replace operations expressed
#: in JSON notation. For example, you must enclose strings in quotation
#: marks, and you do not enclose numeric values in quotation marks.
value = resource2.Body('value')
value = resource.Body('value')
#: The URL to access the image file kept in external store.
url = resource2.Body('url')
url = resource.Body('url')
#: The location metadata.
metadata = resource2.Body('metadata', type=dict)
metadata = resource.Body('metadata', type=dict)
# Additional Image Properties
# https://docs.openstack.org/glance/latest/user/common-image-properties.html
# http://docs.openstack.org/cli-reference/glance-property-keys.html
#: The CPU architecture that must be supported by the hypervisor.
architecture = resource2.Body("architecture")
architecture = resource.Body("architecture")
#: The hypervisor type. Note that qemu is used for both QEMU and
#: KVM hypervisor types.
hypervisor_type = resource2.Body("hypervisor-type")
hypervisor_type = resource.Body("hypervisor-type")
#: Optional property allows created servers to have a different bandwidth
#: cap than that defined in the network they are attached to.
instance_type_rxtx_factor = resource2.Body("instance_type_rxtx_factor",
type=float)
instance_type_rxtx_factor = resource.Body(
"instance_type_rxtx_factor", type=float)
# For snapshot images, this is the UUID of the server used to
#: create this image.
instance_uuid = resource2.Body('instance_uuid')
instance_uuid = resource.Body('instance_uuid')
#: Specifies whether the image needs a config drive.
#: `mandatory` or `optional` (default if property is not used).
needs_config_drive = resource2.Body('img_config_drive')
needs_config_drive = resource.Body('img_config_drive')
#: The ID of an image stored in the Image service that should be used
#: as the kernel when booting an AMI-style image.
kernel_id = resource2.Body('kernel_id')
kernel_id = resource.Body('kernel_id')
#: The common name of the operating system distribution in lowercase
os_distro = resource2.Body('os_distro')
os_distro = resource.Body('os_distro')
#: The operating system version as specified by the distributor.
os_version = resource2.Body('os_version')
os_version = resource.Body('os_version')
#: Secure Boot is a security standard. When the instance starts,
#: Secure Boot first examines software such as firmware and OS by
#: their signature and only allows them to run if the signatures are valid.
needs_secure_boot = resource2.Body('os_secure_boot')
needs_secure_boot = resource.Body('os_secure_boot')
#: The ID of image stored in the Image service that should be used as
#: the ramdisk when booting an AMI-style image.
ramdisk_id = resource2.Body('ramdisk_id')
ramdisk_id = resource.Body('ramdisk_id')
#: The virtual machine mode. This represents the host/guest ABI
#: (application binary interface) used for the virtual machine.
vm_mode = resource2.Body('vm_mode')
vm_mode = resource.Body('vm_mode')
#: The preferred number of sockets to expose to the guest.
hw_cpu_sockets = resource2.Body('hw_cpu_sockets', type=int)
hw_cpu_sockets = resource.Body('hw_cpu_sockets', type=int)
#: The preferred number of cores to expose to the guest.
hw_cpu_cores = resource2.Body('hw_cpu_cores', type=int)
hw_cpu_cores = resource.Body('hw_cpu_cores', type=int)
#: The preferred number of threads to expose to the guest.
hw_cpu_threads = resource2.Body('hw_cpu_threads', type=int)
hw_cpu_threads = resource.Body('hw_cpu_threads', type=int)
#: Specifies the type of disk controller to attach disk devices to.
#: One of scsi, virtio, uml, xen, ide, or usb.
hw_disk_bus = resource2.Body('hw_disk_bus')
hw_disk_bus = resource.Body('hw_disk_bus')
#: Adds a random-number generator device to the image's instances.
hw_rng_model = resource2.Body('hw_rng_model')
hw_rng_model = resource.Body('hw_rng_model')
#: For libvirt: Enables booting an ARM system using the specified
#: machine type.
#: For Hyper-V: Specifies whether the Hyper-V instance will be a
#: generation 1 or generation 2 VM.
hw_machine_type = resource2.Body('hw_machine_type')
hw_machine_type = resource.Body('hw_machine_type')
#: Enables the use of VirtIO SCSI (virtio-scsi) to provide block device
#: access for compute instances; by default, instances use VirtIO Block
#: (virtio-blk).
hw_scsi_model = resource2.Body('hw_scsi_model')
hw_scsi_model = resource.Body('hw_scsi_model')
#: Specifies the count of serial ports that should be provided.
hw_serial_port_count = resource2.Body('hw_serial_port_count', type=int)
hw_serial_port_count = resource.Body('hw_serial_port_count', type=int)
#: The video image driver used.
hw_video_model = resource2.Body('hw_video_model')
hw_video_model = resource.Body('hw_video_model')
#: Maximum RAM for the video image.
hw_video_ram = resource2.Body('hw_video_ram', type=int)
hw_video_ram = resource.Body('hw_video_ram', type=int)
#: Enables a virtual hardware watchdog device that carries out the
#: specified action if the server hangs.
hw_watchdog_action = resource2.Body('hw_watchdog_action')
hw_watchdog_action = resource.Body('hw_watchdog_action')
#: The kernel command line to be used by the libvirt driver, instead
#: of the default.
os_command_line = resource2.Body('os_command_line')
os_command_line = resource.Body('os_command_line')
#: Specifies the model of virtual network interface device to use.
hw_vif_model = resource2.Body('hw_vif_model')
hw_vif_model = resource.Body('hw_vif_model')
#: If true, this enables the virtio-net multiqueue feature.
#: In this case, the driver sets the number of queues equal to the
#: number of guest vCPUs. This makes the network performance scale
#: across a number of vCPUs.
is_hw_vif_multiqueue_enabled = resource2.Body('hw_vif_multiqueue_enabled',
type=bool)
is_hw_vif_multiqueue_enabled = resource.Body(
'hw_vif_multiqueue_enabled', type=bool)
#: If true, enables the BIOS bootmenu.
is_hw_boot_menu_enabled = resource2.Body('hw_boot_menu', type=bool)
is_hw_boot_menu_enabled = resource.Body('hw_boot_menu', type=bool)
#: The virtual SCSI or IDE controller used by the hypervisor.
vmware_adaptertype = resource2.Body('vmware_adaptertype')
vmware_adaptertype = resource.Body('vmware_adaptertype')
#: A VMware GuestID which describes the operating system installed
#: in the image.
vmware_ostype = resource2.Body('vmware_ostype')
vmware_ostype = resource.Body('vmware_ostype')
#: If true, the root partition on the disk is automatically resized
#: before the instance boots.
has_auto_disk_config = resource2.Body('auto_disk_config', type=bool)
has_auto_disk_config = resource.Body('auto_disk_config', type=bool)
#: The operating system installed on the image.
os_type = resource2.Body('os_type')
os_type = resource.Body('os_type')
def _action(self, session, action):
"""Call an action on an image ID."""

View File

@ -11,10 +11,10 @@
# under the License.
from openstack.image import image_service
from openstack import resource2
from openstack import resource
class Member(resource2.Resource):
class Member(resource.Resource):
resources_key = 'members'
base_path = '/images/%(image_id)s/members'
service = image_service.ImageService()
@ -32,14 +32,14 @@ class Member(resource2.Resource):
#: The ID of the image member. An image member is a tenant
#: with whom the image is shared.
member_id = resource2.Body('member', alternate_id=True)
member_id = resource.Body('member', alternate_id=True)
#: The date and time when the member was created.
created_at = resource2.Body('created_at')
created_at = resource.Body('created_at')
#: Image ID stored through the image API. Typically a UUID.
image_id = resource2.URI('image_id')
image_id = resource.URI('image_id')
#: The status of the image.
status = resource2.Body('status')
status = resource.Body('status')
#: The URL for schema of the member.
schema = resource2.Body('schema')
schema = resource.Body('schema')
#: The date and time when the member was updated.
updated_at = resource2.Body('updated_at')
updated_at = resource.Body('updated_at')

View File

@ -13,10 +13,10 @@
from openstack.key_manager.v1 import container as _container
from openstack.key_manager.v1 import order as _order
from openstack.key_manager.v1 import secret as _secret
from openstack import proxy2
from openstack import proxy
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def create_container(self, **attrs):
"""Create a new container from attributes

View File

@ -12,10 +12,10 @@
from openstack.key_manager import key_manager_service
from openstack.key_manager.v1 import _format
from openstack import resource2
from openstack import resource
class Container(resource2.Resource):
class Container(resource.Resource):
resources_key = 'containers'
base_path = '/containers'
service = key_manager_service.KeyManagerService()
@ -29,21 +29,22 @@ class Container(resource2.Resource):
# Properties
#: A URI for this container
container_ref = resource2.Body('container_ref')
container_ref = resource.Body('container_ref')
#: The ID for this container
container_id = resource2.Body('container_ref', alternate_id=True,
type=_format.HREFToUUID)
container_id = resource.Body(
'container_ref', alternate_id=True,
type=_format.HREFToUUID)
#: The timestamp when this container was created.
created_at = resource2.Body('created')
created_at = resource.Body('created')
#: The name of this container
name = resource2.Body('name')
name = resource.Body('name')
#: A list of references to secrets in this container
secret_refs = resource2.Body('secret_refs', type=list)
secret_refs = resource.Body('secret_refs', type=list)
#: The status of this container
status = resource2.Body('status')
status = resource.Body('status')
#: The type of this container
type = resource2.Body('type')
type = resource.Body('type')
#: The timestamp when this container was updated.
updated_at = resource2.Body('updated')
updated_at = resource.Body('updated')
#: A party interested in this container.
consumers = resource2.Body('consumers', type=list)
consumers = resource.Body('consumers', type=list)

View File

@ -12,10 +12,10 @@
from openstack.key_manager import key_manager_service
from openstack.key_manager.v1 import _format
from openstack import resource2
from openstack import resource
class Order(resource2.Resource):
class Order(resource.Resource):
resources_key = 'orders'
base_path = '/orders'
service = key_manager_service.KeyManagerService()
@ -28,28 +28,28 @@ class Order(resource2.Resource):
allow_list = True
#: Timestamp in ISO8601 format of when the order was created
created_at = resource2.Body('created')
created_at = resource.Body('created')
#: Keystone Id of the user who created the order
creator_id = resource2.Body('creator_id')
creator_id = resource.Body('creator_id')
#: A dictionary containing key-value parameters which specify the
#: details of an order request
meta = resource2.Body('meta', type=dict)
meta = resource.Body('meta', type=dict)
#: A URI for this order
order_ref = resource2.Body('order_ref')
order_ref = resource.Body('order_ref')
#: The ID of this order
order_id = resource2.Body('order_ref', alternate_id=True,
type=_format.HREFToUUID)
order_id = resource.Body(
'order_ref', alternate_id=True, type=_format.HREFToUUID)
#: Secret href associated with the order
secret_ref = resource2.Body('secret_ref')
secret_ref = resource.Body('secret_ref')
#: Secret ID associated with the order
secret_id = resource2.Body('secret_ref', type=_format.HREFToUUID)
secret_id = resource.Body('secret_ref', type=_format.HREFToUUID)
# The status of this order
status = resource2.Body('status')
status = resource.Body('status')
#: Metadata associated with the order
sub_status = resource2.Body('sub_status')
sub_status = resource.Body('sub_status')
#: Metadata associated with the order
sub_status_message = resource2.Body('sub_status_message')
sub_status_message = resource.Body('sub_status_message')
# The type of order
type = resource2.Body('type')
type = resource.Body('type')
#: Timestamp in ISO8601 format of the last time the order was updated.
updated_at = resource2.Body('updated')
updated_at = resource.Body('updated')

View File

@ -12,11 +12,11 @@
from openstack.key_manager import key_manager_service
from openstack.key_manager.v1 import _format
from openstack import resource2
from openstack import resource
from openstack import utils
class Secret(resource2.Resource):
class Secret(resource.Resource):
resources_key = 'secrets'
base_path = '/secrets'
service = key_manager_service.KeyManagerService()
@ -28,55 +28,56 @@ class Secret(resource2.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters("name", "mode", "bits",
"secret_type", "acl_only",
"created", "updated",
"expiration", "sort",
algorithm="alg")
_query_mapping = resource.QueryParameters(
"name", "mode", "bits",
"secret_type", "acl_only",
"created", "updated",
"expiration", "sort",
algorithm="alg")
# Properties
#: Metadata provided by a user or system for informational purposes
algorithm = resource2.Body('algorithm')
algorithm = resource.Body('algorithm')
#: Metadata provided by a user or system for informational purposes.
#: Value must be greater than zero.
bit_length = resource2.Body('bit_length')
bit_length = resource.Body('bit_length')
#: A list of content types
content_types = resource2.Body('content_types', type=dict)
content_types = resource.Body('content_types', type=dict)
#: Once this timestamp has past, the secret will no longer be available.
expires_at = resource2.Body('expiration')
expires_at = resource.Body('expiration')
#: Timestamp of when the secret was created.
created_at = resource2.Body('created')
created_at = resource.Body('created')
#: Timestamp of when the secret was last updated.
updated_at = resource2.Body('updated')
updated_at = resource.Body('updated')
#: The type/mode of the algorithm associated with the secret information.
mode = resource2.Body('mode')
mode = resource.Body('mode')
#: The name of the secret set by the user
name = resource2.Body('name')
name = resource.Body('name')
#: A URI to the sercret
secret_ref = resource2.Body('secret_ref')
secret_ref = resource.Body('secret_ref')
#: The ID of the secret
# NOTE: This is not really how alternate IDs are supposed to work and
# ultimately means this has to work differently than all other services
# in all of OpenStack because of the departure from using actual IDs
# that even this service can't even use itself.
secret_id = resource2.Body('secret_ref', alternate_id=True,
type=_format.HREFToUUID)
secret_id = resource.Body(
'secret_ref', alternate_id=True, type=_format.HREFToUUID)
#: Used to indicate the type of secret being stored.
secret_type = resource2.Body('secret_type')
secret_type = resource.Body('secret_type')
#: The status of this secret
status = resource2.Body('status')
status = resource.Body('status')
#: A timestamp when this secret was updated.
updated_at = resource2.Body('updated')
updated_at = resource.Body('updated')
#: The secret's data to be stored. payload_content_type must also
#: be supplied if payload is included. (optional)
payload = resource2.Body('payload')
payload = resource.Body('payload')
#: The media type for the content of the payload.
#: (required if payload is included)
payload_content_type = resource2.Body('payload_content_type')
payload_content_type = resource.Body('payload_content_type')
#: The encoding used for the payload to be able to include it in
#: the JSON request. Currently only base64 is supported.
#: (required if payload is encoded)
payload_content_encoding = resource2.Body('payload_content_encoding')
payload_content_encoding = resource.Body('payload_content_encoding')
def get(self, session, requires_id=True):
request = self._prepare_request(requires_id=requires_id)

View File

@ -17,10 +17,10 @@ from openstack.load_balancer.v2 import listener as _listener
from openstack.load_balancer.v2 import load_balancer as _lb
from openstack.load_balancer.v2 import member as _member
from openstack.load_balancer.v2 import pool as _pool
from openstack import proxy2
from openstack import proxy
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def create_load_balancer(self, **attrs):
"""Create a new load balancer from attributes

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class HealthMonitor(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class L7Policy(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class L7Rule(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class Listener(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class LoadBalancer(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class Member(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class Pool(resource.Resource):

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.load_balancer import load_balancer_service as lb_service
from openstack import resource2 as resource
from openstack import resource
class Version(resource.Resource):

View File

@ -14,11 +14,11 @@ from openstack.message.v2 import claim as _claim
from openstack.message.v2 import message as _message
from openstack.message.v2 import queue as _queue
from openstack.message.v2 import subscription as _subscription
from openstack import proxy2
from openstack import resource2
from openstack import proxy
from openstack import resource
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def create_queue(self, **attrs):
"""Create a new queue from attributes
@ -148,7 +148,7 @@ class Proxy(proxy2.BaseProxy):
"""
message = self._get_resource(_message.Message, value,
queue_name=queue_name)
message.claim_id = resource2.Resource._get_id(claim)
message.claim_id = resource.Resource._get_id(claim)
return self._delete(_message.Message, message,
ignore_missing=ignore_missing)

View File

@ -13,14 +13,14 @@
import uuid
from openstack.message import message_service
from openstack import resource2
from openstack import resource
class Claim(resource2.Resource):
class Claim(resource.Resource):
# FIXME(anyone): The name string of `location` field of Zaqar API response
# is lower case. That is inconsistent with the guide from API-WG. This is
# a workaround for this issue.
location = resource2.Header("location")
location = resource.Header("location")
resources_key = 'claims'
base_path = '/queues/%(queue_name)s/claims'
@ -35,27 +35,27 @@ class Claim(resource2.Resource):
# Properties
#: The value in seconds indicating how long the claim has existed.
age = resource2.Body("age")
age = resource.Body("age")
#: In case worker stops responding for a long time, the server will
#: extend the lifetime of claimed messages to be at least as long as
#: the lifetime of the claim itself, plus the specified grace period.
#: Must between 60 and 43200 seconds(12 hours).
grace = resource2.Body("grace")
grace = resource.Body("grace")
#: The number of messages to claim. Default 10, up to 20.
limit = resource2.Body("limit")
limit = resource.Body("limit")
#: Messages have been successfully claimed.
messages = resource2.Body("messages")
messages = resource.Body("messages")
#: Number of seconds the server wait before releasing the claim. Must
#: between 60 and 43200 seconds(12 hours).
ttl = resource2.Body("ttl")
ttl = resource.Body("ttl")
#: The name of queue to claim message from.
queue_name = resource2.URI("queue_name")
queue_name = resource.URI("queue_name")
#: The ID to identify the client accessing Zaqar API. Must be specified
#: in header for each API request.
client_id = resource2.Header("Client-ID")
client_id = resource.Header("Client-ID")
#: The ID to identify the project. Must be provided when keystone
#: authentication is not enabled in Zaqar service.
project_id = resource2.Header("X-PROJECT-ID")
project_id = resource.Header("X-PROJECT-ID")
def _translate_response(self, response, has_body=True):
super(Claim, self)._translate_response(response, has_body=has_body)

View File

@ -13,14 +13,14 @@
import uuid
from openstack.message import message_service
from openstack import resource2
from openstack import resource
class Message(resource2.Resource):
class Message(resource.Resource):
# FIXME(anyone): The name string of `location` field of Zaqar API response
# is lower case. That is inconsistent with the guide from API-WG. This is
# a workaround for this issue.
location = resource2.Header("location")
location = resource.Header("location")
resources_key = 'messages'
base_path = '/queues/%(queue_name)s/messages'
@ -32,28 +32,28 @@ class Message(resource2.Resource):
allow_get = True
allow_delete = True
_query_mapping = resource2.QueryParameters("echo", "include_claimed")
_query_mapping = resource.QueryParameters("echo", "include_claimed")
# Properties
#: The value in second to specify how long the message has been
#: posted to the queue.
age = resource2.Body("age")
age = resource.Body("age")
#: A dictionary specifies an arbitrary document that constitutes the
#: body of the message being sent.
body = resource2.Body("body")
body = resource.Body("body")
#: An uri string describe the location of the message resource.
href = resource2.Body("href")
href = resource.Body("href")
#: The value in seconds to specify how long the server waits before
#: marking the message as expired and removing it from the queue.
ttl = resource2.Body("ttl")
ttl = resource.Body("ttl")
#: The name of target queue message is post to or got from.
queue_name = resource2.URI("queue_name")
queue_name = resource.URI("queue_name")
#: The ID to identify the client accessing Zaqar API. Must be specified
#: in header for each API request.
client_id = resource2.Header("Client-ID")
client_id = resource.Header("Client-ID")
#: The ID to identify the project accessing Zaqar API. Must be specified
#: in case keystone auth is not enabled in Zaqar service.
project_id = resource2.Header("X-PROJECT-ID")
project_id = resource.Header("X-PROJECT-ID")
def post(self, session, messages):
request = self._prepare_request(requires_id=False, prepend_key=True)
@ -72,7 +72,7 @@ class Message(resource2.Resource):
def list(cls, session, paginated=True, **params):
"""This method is a generator which yields message objects.
This is almost the copy of list method of resource2.Resource class.
This is almost the copy of list method of resource.Resource class.
The only difference is the request header now includes `Client-ID`
and `X-PROJECT-ID` fields which are required by Zaqar v2 API.
"""

View File

@ -13,14 +13,14 @@
import uuid
from openstack.message import message_service
from openstack import resource2
from openstack import resource
class Queue(resource2.Resource):
class Queue(resource.Resource):
# FIXME(anyone): The name string of `location` field of Zaqar API response
# is lower case. That is inconsistent with the guide from API-WG. This is
# a workaround for this issue.
location = resource2.Header("location")
location = resource.Header("location")
resources_key = "queues"
base_path = "/queues"
@ -35,22 +35,22 @@ class Queue(resource2.Resource):
# Properties
#: The default TTL of messages defined for a queue, which will effect for
#: any messages posted to the queue.
default_message_ttl = resource2.Body("_default_message_ttl")
default_message_ttl = resource.Body("_default_message_ttl")
#: Description of the queue.
description = resource2.Body("description")
description = resource.Body("description")
#: The max post size of messages defined for a queue, which will effect
#: for any messages posted to the queue.
max_messages_post_size = resource2.Body("_max_messages_post_size")
max_messages_post_size = resource.Body("_max_messages_post_size")
#: Name of the queue. The name is the unique identity of a queue. It
#: must not exceed 64 bytes in length, and it is limited to US-ASCII
#: letters, digits, underscores, and hyphens.
name = resource2.Body("name", alternate_id=True)
name = resource.Body("name", alternate_id=True)
#: The ID to identify the client accessing Zaqar API. Must be specified
#: in header for each API request.
client_id = resource2.Header("Client-ID")
client_id = resource.Header("Client-ID")
#: The ID to identify the project accessing Zaqar API. Must be specified
#: in case keystone auth is not enabled in Zaqar service.
project_id = resource2.Header("X-PROJECT-ID")
project_id = resource.Header("X-PROJECT-ID")
def create(self, session, prepend_key=True):
request = self._prepare_request(requires_id=True,
@ -70,7 +70,7 @@ class Queue(resource2.Resource):
def list(cls, session, paginated=False, **params):
"""This method is a generator which yields queue objects.
This is almost the copy of list method of resource2.Resource class.
This is almost the copy of list method of resource.Resource class.
The only difference is the request header now includes `Client-ID`
and `X-PROJECT-ID` fields which are required by Zaqar v2 API.
"""

View File

@ -13,14 +13,14 @@
import uuid
from openstack.message import message_service
from openstack import resource2
from openstack import resource
class Subscription(resource2.Resource):
class Subscription(resource.Resource):
# FIXME(anyone): The name string of `location` field of Zaqar API response
# is lower case. That is inconsistent with the guide from API-WG. This is
# a workaround for this issue.
location = resource2.Header("location")
location = resource.Header("location")
resources_key = 'subscriptions'
base_path = '/queues/%(queue_name)s/subscriptions'
@ -34,31 +34,31 @@ class Subscription(resource2.Resource):
# Properties
#: The value in seconds indicating how long the subscription has existed.
age = resource2.Body("age")
age = resource.Body("age")
#: Alternate id of the subscription. This key is used in response of
#: subscription create API to return id of subscription created.
subscription_id = resource2.Body("subscription_id", alternate_id=True)
subscription_id = resource.Body("subscription_id", alternate_id=True)
#: The extra metadata for the subscription. The value must be a dict.
#: If the subscriber is `mailto`. The options can contain `from` and
#: `subject` to indicate the email's author and title.
options = resource2.Body("options", type=dict)
options = resource.Body("options", type=dict)
#: The queue name which the subscription is registered on.
source = resource2.Body("source")
source = resource.Body("source")
#: The destination of the message. Two kinds of subscribers are supported:
#: http/https and email. The http/https subscriber should start with
#: `http/https`. The email subscriber should start with `mailto`.
subscriber = resource2.Body("subscriber")
subscriber = resource.Body("subscriber")
#: Number of seconds the subscription remains alive? The ttl value must
#: be great than 60 seconds. The default value is 3600 seconds.
ttl = resource2.Body("ttl")
ttl = resource.Body("ttl")
#: The queue name which the subscription is registered on.
queue_name = resource2.URI("queue_name")
queue_name = resource.URI("queue_name")
#: The ID to identify the client accessing Zaqar API. Must be specified
#: in header for each API request.
client_id = resource2.Header("Client-ID")
client_id = resource.Header("Client-ID")
#: The ID to identify the project. Must be provided when keystone
#: authentication is not enabled in Zaqar service.
project_id = resource2.Header("X-PROJECT-ID")
project_id = resource.Header("X-PROJECT-ID")
def create(self, session, prepend_key=True):
request = self._prepare_request(requires_id=False,
@ -78,7 +78,7 @@ class Subscription(resource2.Resource):
def list(cls, session, paginated=True, **params):
"""This method is a generator which yields subscription objects.
This is almost the copy of list method of resource2.Resource class.
This is almost the copy of list method of resource.Resource class.
The only difference is the request header now includes `Client-ID`
and `X-PROJECT-ID` fields which are required by Zaqar v2 API.
"""

View File

@ -11,7 +11,7 @@
# under the License.
from openstack.message import message_service
from openstack import resource2 as resource
from openstack import resource
class Version(resource.Resource):

View File

@ -48,11 +48,11 @@ from openstack.network.v2 import service_provider as _service_provider
from openstack.network.v2 import subnet as _subnet
from openstack.network.v2 import subnet_pool as _subnet_pool
from openstack.network.v2 import vpn_service as _vpn_service
from openstack import proxy2
from openstack import proxy
from openstack import utils
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def create_address_scope(self, **attrs):
"""Create a new address scope from attributes
@ -3036,12 +3036,12 @@ class Proxy(proxy2.BaseProxy):
"""Replace tags of a specified resource with specified tags
:param resource:
:class:`~openstack.resource2.Resource` instance.
:class:`~openstack.resource.Resource` instance.
:param tags: New tags to be set.
:type tags: "list"
:returns: The updated resource
:rtype: :class:`~openstack.resource2.Resource`
:rtype: :class:`~openstack.resource.Resource`
"""
self._check_tag_support(resource)
return resource.set_tags(self, tags)

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