Skip to content

Commit

Permalink
Rename resource2 and proxy2 to resource and proxy
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emonty committed Jan 24, 2018
1 parent aebf019 commit 15e78f5
Show file tree
Hide file tree
Showing 181 changed files with 974 additions and 974 deletions.
2 changes: 1 addition & 1 deletion SHADE-MERGE-TODO.rst
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/contributor/create/examples/resource/fake.py
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user/index.rst
Expand Up @@ -137,7 +137,7 @@ can be customized.
.. toctree::
:maxdepth: 1

resource2
resource
service_filter
utils

Expand Down
10 changes: 5 additions & 5 deletions doc/source/user/resource2.rst → doc/source/user/resource.rst
Expand Up @@ -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
4 changes: 2 additions & 2 deletions openstack/baremetal/v1/_proxy.py
Expand Up @@ -15,11 +15,11 @@
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.
Expand Down
2 changes: 1 addition & 1 deletion openstack/baremetal/v1/chassis.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion openstack/baremetal/v1/driver.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion openstack/baremetal/v1/node.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion openstack/baremetal/v1/port.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion openstack/baremetal/v1/port_group.py
Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions openstack/baremetal/version.py
Expand Up @@ -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 = '/'
Expand All @@ -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')
4 changes: 2 additions & 2 deletions openstack/block_storage/v2/_proxy.py
Expand Up @@ -14,10 +14,10 @@
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
Expand Down
30 changes: 15 additions & 15 deletions openstack/block_storage/v2/snapshot.py
Expand Up @@ -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
Expand All @@ -33,33 +33,33 @@ 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):

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")
9 changes: 4 additions & 5 deletions openstack/block_storage/v2/stats.py
Expand Up @@ -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"
Expand All @@ -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)
10 changes: 5 additions & 5 deletions openstack/block_storage/v2/type.py
Expand Up @@ -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"
Expand All @@ -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)
58 changes: 29 additions & 29 deletions openstack/block_storage/v2/volume.py
Expand Up @@ -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
Expand All @@ -33,73 +33,73 @@ 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):

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)

0 comments on commit 15e78f5

Please sign in to comment.