Rename Resource get and update to not clash with dict

The next change is going to make Resource a subclass of dict so that we
can return Resource objects in the shade layer. Unfortunately, the
Resource base class has two methods, get and update, that conflict with
standard dict method names. To keep things reviewable, just change the
method names.

Most consumers should not be using either of these methods directly.
They are mostly there for lower-level things to use. However, they COULD
be using them, so it's important to note that this is a breaking change.

Change-Id: I2fedeea6e405dcbd333482c1964173ade98ca04d
This commit is contained in:
Monty Taylor 2018-08-05 10:30:25 -05:00
parent 8c2eac3ccf
commit 2d472aea49
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
259 changed files with 767 additions and 740 deletions

View File

@ -11,8 +11,8 @@ class Fake(resource.Resource):
service = fake_service.FakeService()
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
allow_head = True

View File

@ -130,14 +130,14 @@ value by setting it to ``True``:
+----------------------------------------------+----------------+
| :class:`~openstack.resource.Resource.list` | allow_list |
+----------------------------------------------+----------------+
| :class:`~openstack.resource.Resource.get` | allow_get |
| :class:`~openstack.resource.Resource.fetch` | allow_fetch |
+----------------------------------------------+----------------+
| :class:`~openstack.resource.Resource.update` | allow_update |
| :class:`~openstack.resource.Resource.commit` | allow_commit |
+----------------------------------------------+----------------+
An additional attribute to set is ``put_update`` if your service uses ``PUT``
requests in order to update a resource. By default, ``PATCH`` requests are
used for ``Resource.update``.
An additional attribute to set is ``commit_method``. It defaults to ``PUT``,
but some services use ``POST`` or ``PATCH`` to commit changes back to the
remote resource.
Properties
----------

View File

@ -30,7 +30,7 @@ the server-side expects, as this ``prop`` becomes a mapping between the two.::
There are six additional attributes which the ``Resource`` class checks
before making requests to the REST API. ``allow_create``, ``allow_retreive``,
``allow_update``, ``allow_delete``, ``allow_head``, and ``allow_list`` are set
``allow_commit``, ``allow_delete``, ``allow_head``, and ``allow_list`` are set
to ``True`` or ``False``, and are checked before making the corresponding
method call.

View File

@ -57,7 +57,7 @@ _DELETE_TEMPLATE = """Delete a {resource_name}
:returns: ``None``
"""
_GET_TEMPLATE = """Get a single {resource_name}
_FETCH_TEMPLATE = """Fetch a single {resource_name}
:param {name}:
The value can be the ID of a {name} or a
@ -78,13 +78,13 @@ _CREATE_TEMPLATE = """Create a new {resource_name} from attributes
:rtype: :class:`~{resource_class}`
"""
_UPDATE_TEMPLATE = """Update a {resource_name}
_COMMIT_TEMPLATE = """Commit the state of a {resource_name}
:param {name}:
Either the ID of a {resource_name} or a :class:`~{resource_class}`
instance.
:attrs kwargs:
The attributes to update on the {resource_name} represented by
The attributes to commit on the {resource_name} represented by
``{name}``.
:returns: The updated server
@ -96,8 +96,8 @@ _DOC_TEMPLATES = {
'delete': _DELETE_TEMPLATE,
'find': _FIND_TEMPLATE,
'list': _LIST_TEMPLATE,
'get': _GET_TEMPLATE,
'update': _UPDATE_TEMPLATE,
'fetch': _FETCH_TEMPLATE,
'commit': _COMMIT_TEMPLATE,
}
_FIND_SOURCE = """
@ -116,8 +116,8 @@ def delete(self, {name}, ignore_missing=True):
self._delete(self.{resource_name}, {name}, ignore_missing=ignore_missing)
"""
_GET_SOURCE = """
def get(self, {name}):
_FETCH_SOURCE = """
def fetch(self, {name}):
return self._get(self.{resource_name}, {name})
"""
@ -127,8 +127,8 @@ def list(self, details=True, **query):
return self._list(res_cls, paginated=True, **query)
"""
_UPDATE_SOURCE = """
def update(self, {name}, **attrs):
_COMMIT_SOURCE = """
def commit(self, {name}, **attrs):
return self._update(self.{resource_name}, {name}, **attrs)
"""
@ -137,8 +137,8 @@ _SOURCE_TEMPLATES = {
'delete': _DELETE_SOURCE,
'find': _FIND_SOURCE,
'list': _LIST_SOURCE,
'get': _GET_SOURCE,
'update': _UPDATE_SOURCE,
'fetch': _FETCH_SOURCE,
'commit': _COMMIT_SOURCE,
}

View File

@ -111,10 +111,15 @@ class ProxyMeta(type):
# We pass in a copy of the dct dict so that the exec step can
# be done in the context of the class the methods will be attached
# to. This allows name resolution to work properly.
for action in ('create', 'get', 'update', 'delete'):
for action in ('create', 'fetch', 'commit', 'delete'):
if getattr(res, 'allow_{action}'.format(action=action)):
func = compile_function(dct.copy(), action, **args)
add_function(dct, func, action, args)
kwargs = {}
if action == 'fetch':
kwargs['name_template'] = 'get_{name}'
elif action == 'commit':
kwargs['name_template'] = 'update_{name}'
add_function(dct, func, action, args, **kwargs)
if res.allow_list:
func = compile_function(dct.copy(), 'find', **args)
add_function(dct, func, 'find', args)

View File

@ -22,11 +22,11 @@ class Chassis(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'fields'
@ -54,8 +54,8 @@ class ChassisDetail(Chassis):
# capabilities
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -22,8 +22,8 @@ class Driver(resource.Resource):
# capabilities
allow_create = False
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -29,11 +29,11 @@ class Node(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'associated', 'driver', 'fields', 'provision_state', 'resource_class',
@ -267,7 +267,7 @@ class Node(resource.Resource):
expected_state,
timeout=timeout)
else:
return self.get(session)
return self.fetch(session)
def wait_for_provision_state(self, session, expected_state, timeout=None,
abort_on_failed_state=True):
@ -291,7 +291,7 @@ class Node(resource.Resource):
"Timeout waiting for node %(node)s to reach "
"target state '%(state)s'" % {'node': self.id,
'state': expected_state}):
self.get(session)
self.fetch(session)
if self._check_state_reached(session, expected_state,
abort_on_failed_state):
return self
@ -348,8 +348,8 @@ class NodeDetail(Node):
# capabilities
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -22,11 +22,11 @@ class Port(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'fields'
@ -71,8 +71,8 @@ class PortDetail(Port):
# capabilities
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -22,11 +22,11 @@ class PortGroup(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'node', 'address', 'fields',
@ -68,8 +68,8 @@ class PortGroupDetail(PortGroup):
base_path = '/portgroups/detail'
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -25,10 +25,10 @@ class Snapshot(resource.Resource):
'all_tenants', 'name', 'status', 'volume_id')
# capabilities
allow_get = True
allow_fetch = True
allow_create = True
allow_delete = True
allow_update = True
allow_commit = True
allow_list = True
# Properties

View File

@ -21,7 +21,7 @@ class Pools(resource.Resource):
service = block_storage_service.BlockStorageService()
# capabilities
allow_get = False
allow_fetch = False
allow_create = False
allow_delete = False
allow_list = True

View File

@ -21,7 +21,7 @@ class Type(resource.Resource):
service = block_storage_service.BlockStorageService()
# capabilities
allow_get = True
allow_fetch = True
allow_create = True
allow_delete = True
allow_list = True

View File

@ -25,10 +25,10 @@ class Volume(resource.Resource):
'all_tenants', 'name', 'status', 'project_id')
# capabilities
allow_get = True
allow_fetch = True
allow_create = True
allow_delete = True
allow_update = True
allow_commit = True
allow_list = True
# Properties

View File

@ -23,7 +23,7 @@ class Action(resource.Resource):
# Capabilities
allow_list = True
allow_get = True
allow_fetch = True
_query_mapping = resource.QueryParameters(
'name', 'action', 'status', 'sort', 'global_project',

View File

@ -20,7 +20,7 @@ class BuildInfo(resource.Resource):
service = clustering_service.ClusteringService()
# Capabilities
allow_get = True
allow_fetch = True
# Properties
#: String representation of the API build version

View File

@ -23,11 +23,11 @@ class Cluster(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'name', 'status', 'sort', 'global_project')

View File

@ -22,7 +22,7 @@ class ClusterPolicy(resource.Resource):
# Capabilities
allow_list = True
allow_get = True
allow_fetch = True
_query_mapping = resource.QueryParameters(
'sort', 'policy_name', 'policy_type', is_enabled='enabled')

View File

@ -23,7 +23,7 @@ class Event(resource.Resource):
# Capabilities
allow_list = True
allow_get = True
allow_fetch = True
_query_mapping = resource.QueryParameters(
'cluster_id', 'action', 'level', 'sort', 'global_project',

View File

@ -23,12 +23,12 @@ class Node(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'show_details', 'name', 'sort', 'global_project', 'cluster_id',
@ -169,8 +169,8 @@ class NodeDetail(Node):
base_path = '/nodes/%(node_id)s?show_details=True'
allow_create = False
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = False
allow_list = False

View File

@ -22,12 +22,12 @@ class Policy(resource.Resource):
# Capabilities
allow_list = True
allow_get = True
allow_fetch = True
allow_create = True
allow_delete = True
allow_update = True
allow_commit = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'name', 'type', 'sort', 'global_project')
@ -58,9 +58,9 @@ class PolicyValidate(Policy):
# Capabilities
allow_list = False
allow_get = False
allow_fetch = False
allow_create = True
allow_delete = False
allow_update = False
allow_commit = False
update_method = 'PUT'
commit_method = 'PUT'

View File

@ -22,7 +22,7 @@ class PolicyType(resource.Resource):
# Capabilities
allow_list = True
allow_get = True
allow_fetch = True
# Properties
#: Name of policy type.

View File

@ -22,12 +22,12 @@ class Profile(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'sort', 'global_project', 'type', 'name')
@ -56,9 +56,9 @@ class Profile(resource.Resource):
class ProfileValidate(Profile):
base_path = '/profiles/validate'
allow_create = True
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = False
update_method = 'PUT'
commit_method = 'PUT'

View File

@ -23,7 +23,7 @@ class ProfileType(resource.Resource):
# Capabilities
allow_list = True
allow_get = True
allow_fetch = True
# Properties
#: Name of the profile type.

View File

@ -22,12 +22,12 @@ class Receiver(resource.Resource):
# Capabilities
allow_list = True
allow_get = True
allow_fetch = True
allow_create = True
allow_update = True
allow_commit = True
allow_delete = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'name', 'type', 'cluster_id', 'action', 'sort', 'global_project',

View File

@ -22,7 +22,7 @@ class Extension(resource.Resource):
id_attribute = "alias"
# capabilities
allow_get = True
allow_fetch = True
allow_list = True
# Properties

View File

@ -22,7 +22,7 @@ class Flavor(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_fetch = True
allow_delete = True
allow_list = True
@ -62,8 +62,8 @@ class FlavorDetail(Flavor):
base_path = '/flavors/detail'
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -23,7 +23,7 @@ class Hypervisor(resource.Resource):
service = compute_service.ComputeService()
# capabilities
allow_get = True
allow_fetch = True
allow_list = True
# Properties
@ -71,5 +71,5 @@ class HypervisorDetail(Hypervisor):
base_path = '/os-hypervisors/detail'
# capabilities
allow_get = False
allow_fetch = False
allow_list = True

View File

@ -22,7 +22,7 @@ class Image(resource.Resource, metadata.MetadataMixin):
service = compute_service.ComputeService()
# capabilities
allow_get = True
allow_fetch = True
allow_delete = True
allow_list = True
@ -60,6 +60,6 @@ class Image(resource.Resource, metadata.MetadataMixin):
class ImageDetail(Image):
base_path = '/images/detail'
allow_get = False
allow_fetch = False
allow_delete = False
allow_list = True

View File

@ -22,7 +22,7 @@ class Keypair(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_fetch = True
allow_delete = True
allow_list = True

View File

@ -73,12 +73,12 @@ class Limits(resource.Resource):
resource_key = "limits"
service = compute_service.ComputeService()
allow_get = True
allow_fetch = True
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):
def fetch(self, session, requires_id=False, error_message=None):
"""Get the Limits resource.
:param session: The session to use for making this request.
@ -89,5 +89,5 @@ class Limits(resource.Resource):
"""
# TODO(mordred) We shouldn't have to subclass just to declare
# requires_id = False.
return super(Limits, self).get(
return super(Limits, self).fetch(
session=session, requires_id=False, error_message=error_message)

View File

@ -24,8 +24,8 @@ class Server(resource.Resource, metadata.MetadataMixin):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
@ -445,8 +445,8 @@ class ServerDetail(Server):
# capabilities
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -24,7 +24,7 @@ class ServerGroup(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_fetch = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class ServerInterface(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = True
allow_list = True

View File

@ -24,7 +24,7 @@ class Service(resource.Resource):
# capabilities
allow_list = True
allow_update = True
allow_commit = True
# Properties
#: Status of service

View File

@ -22,8 +22,8 @@ class VolumeAttachment(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = True
allow_list = True

View File

@ -22,7 +22,7 @@ class Flavor(resource.Resource):
# capabilities
allow_list = True
allow_get = True
allow_fetch = True
# Properties
#: Links associated with the flavor

View File

@ -23,8 +23,8 @@ class Instance(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,7 +22,7 @@ class Extension(resource.Resource):
# capabilities
allow_list = True
allow_get = True
allow_fetch = True
# Properties
#: A unique identifier, which will be used for accessing the extension

View File

@ -23,8 +23,8 @@ class Role(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class Tenant(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class User(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,11 +22,11 @@ class Credential(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'type', 'user_id',

View File

@ -23,11 +23,11 @@ class Domain(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'name',

View File

@ -22,11 +22,11 @@ class Endpoint(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'interface', 'service_id',

View File

@ -22,11 +22,11 @@ class Group(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'domain_id', 'name',

View File

@ -22,11 +22,11 @@ class Policy(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
# Properties
#: The policy rule set itself, as a serialized blob. *Type: string*

View File

@ -23,11 +23,11 @@ class Project(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'domain_id',
@ -123,7 +123,7 @@ class UserProject(Project):
# capabilities
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -22,11 +22,11 @@ class Region(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'parent_region_id',

View File

@ -22,8 +22,8 @@ class Role(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,11 +22,11 @@ class Service(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'type',

View File

@ -23,7 +23,7 @@ class Trust(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_fetch = True
allow_delete = True
allow_list = True

View File

@ -22,11 +22,11 @@ class User(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
'domain_id',

View File

@ -22,8 +22,8 @@ class Image(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -157,8 +157,8 @@ class Proxy(proxy.Proxy):
:returns: The updated image
:rtype: :class:`~openstack.image.v2.image.Image`
"""
img = self._get_resource(_image.Image, image)
return img.update(self, **attrs)
res = self._get_resource(_image.Image, image)
return res.commit(self, **attrs)
def deactivate_image(self, image):
"""Deactivate an image

View File

@ -31,11 +31,11 @@ class Image(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
update_method = 'PATCH'
commit_method = 'PATCH'
_query_mapping = resource.QueryParameters(
"name", "visibility",
@ -272,7 +272,7 @@ class Image(resource.Resource):
# If we don't receive the Content-MD5 header with the download,
# make an additional call to get the image details and look at
# the checksum attribute.
details = self.get(session)
details = self.fetch(session)
checksum = details.checksum
# if we are returning the repsonse object, ensure that it
@ -294,7 +294,7 @@ class Image(resource.Resource):
return resp.content
def update(self, session, **attrs):
def commit(self, session, **attrs):
url = utils.urljoin(self.base_path, self.id)
headers = {
'Content-Type': 'application/openstack-images-v2.1-json-patch',

View File

@ -21,8 +21,8 @@ class Member(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -29,9 +29,9 @@ class Host(resource.Resource):
# 4] PUT /v1/segments/<segment_uuid>/hosts
# 5] DELETE /v1/segments/<segment_uuid>/hosts
allow_list = True
allow_get = True
allow_fetch = True
allow_create = True
allow_update = True
allow_commit = True
allow_delete = True
# Properties

View File

@ -27,9 +27,9 @@ class Notification(resource.Resource):
# 2] GET /v1/notifications/<notification_uuid>
# 3] POST /v1/notifications
allow_list = True
allow_get = True
allow_fetch = True
allow_create = True
allow_update = False
allow_commit = False
allow_delete = False
# Properties

View File

@ -29,9 +29,9 @@ class Segment(resource.Resource):
# 4] PUT /v1/segments/<segment_uuid>
# 5] DELETE /v1/segments/<segment_uuid>
allow_list = True
allow_get = True
allow_fetch = True
allow_create = True
allow_update = True
allow_commit = True
allow_delete = True
# Properties

View File

@ -22,8 +22,8 @@ class Container(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class Order(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -23,8 +23,8 @@ class Secret(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
@ -79,7 +79,7 @@ class Secret(resource.Resource):
#: (required if payload is encoded)
payload_content_encoding = resource.Body('payload_content_encoding')
def get(self, session, requires_id=True, error_message=None):
def fetch(self, session, requires_id=True, error_message=None):
request = self._prepare_request(requires_id=requires_id)
response = session.get(request.url).json()

View File

@ -23,9 +23,9 @@ class HealthMonitor(resource.Resource):
# capabilities
allow_create = True
allow_list = True
allow_get = True
allow_fetch = True
allow_delete = True
allow_update = True
allow_commit = True
_query_mapping = resource.QueryParameters(
'name', 'created_at', 'updated_at', 'delay', 'expected_codes',

View File

@ -23,8 +23,8 @@ class L7Policy(resource.Resource):
# capabilities
allow_create = True
allow_list = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
_query_mapping = resource.QueryParameters(

View File

@ -23,8 +23,8 @@ class L7Rule(resource.Resource):
# capabilities
allow_create = True
allow_list = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
_query_mapping = resource.QueryParameters(

View File

@ -22,8 +22,8 @@ class Listener(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class LoadBalancer(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class Member(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -23,9 +23,9 @@ class Pool(resource.Resource):
# capabilities
allow_create = True
allow_list = True
allow_get = True
allow_fetch = True
allow_delete = True
allow_update = True
allow_commit = True
_query_mapping = resource.QueryParameters(
'health_monitor_id', 'lb_algorithm', 'listener_id', 'loadbalancer_id',

View File

@ -28,10 +28,10 @@ class Claim(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
update_method = 'PATCH'
commit_method = 'PATCH'
# Properties
#: The value in seconds indicating how long the claim has existed.
@ -82,7 +82,7 @@ class Claim(resource.Resource):
return self
def get(self, session, requires_id=True, error_message=None):
def fetch(self, session, requires_id=True, error_message=None):
request = self._prepare_request(requires_id=requires_id)
headers = {
"Client-ID": self.client_id or str(uuid.uuid4()),
@ -96,7 +96,7 @@ class Claim(resource.Resource):
return self
def update(self, session, prepend_key=False, has_body=False):
def commit(self, session, prepend_key=False, has_body=False):
request = self._prepare_request(prepend_key=prepend_key)
headers = {
"Client-ID": self.client_id or str(uuid.uuid4()),

View File

@ -29,7 +29,7 @@ class Message(resource.Resource):
# capabilities
allow_create = True
allow_list = True
allow_get = True
allow_fetch = True
allow_delete = True
_query_mapping = resource.QueryParameters("echo", "include_claimed")
@ -109,7 +109,7 @@ class Message(resource.Resource):
query_params["limit"] = yielded
query_params["marker"] = new_marker
def get(self, session, requires_id=True, error_message=None):
def fetch(self, session, requires_id=True, error_message=None):
request = self._prepare_request(requires_id=requires_id)
headers = {
"Client-ID": self.client_id or str(uuid.uuid4()),

View File

@ -29,7 +29,7 @@ class Queue(resource.Resource):
# capabilities
allow_create = True
allow_list = True
allow_get = True
allow_fetch = True
allow_delete = True
# Properties
@ -107,7 +107,7 @@ class Queue(resource.Resource):
query_params["limit"] = yielded
query_params["marker"] = new_marker
def get(self, session, requires_id=True, error_message=None):
def fetch(self, session, requires_id=True, error_message=None):
request = self._prepare_request(requires_id=requires_id)
headers = {
"Client-ID": self.client_id or str(uuid.uuid4()),

View File

@ -29,7 +29,7 @@ class Subscription(resource.Resource):
# capabilities
allow_create = True
allow_list = True
allow_get = True
allow_fetch = True
allow_delete = True
# Properties
@ -115,7 +115,7 @@ class Subscription(resource.Resource):
query_params["limit"] = yielded
query_params["marker"] = new_marker
def get(self, session, requires_id=True, error_message=None):
def fetch(self, session, requires_id=True, error_message=None):
request = self._prepare_request(requires_id=requires_id)
headers = {
"Client-ID": self.client_id or str(uuid.uuid4()),

View File

@ -1538,11 +1538,11 @@ class Proxy(proxy.Proxy):
def add_ip_to_port(self, port, ip):
ip.port_id = port.id
return ip.update(self)
return ip.commit(self)
def remove_ip_from_port(self, ip):
ip.port_id = None
return ip.update(self)
return ip.commit(self)
def get_subnet_ports(self, subnet_id):
result = []

View File

@ -23,8 +23,8 @@ class AddressScope(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -24,8 +24,8 @@ class Agent(resource.Resource):
# capabilities
allow_create = False
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
@ -100,8 +100,8 @@ class NetworkHostingDHCPAgent(Agent):
# capabilities
allow_create = False
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = False
allow_list = True
@ -118,7 +118,7 @@ class RouterL3Agent(Agent):
# capabilities
allow_create = False
allow_retrieve = True
allow_update = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -22,8 +22,8 @@ class AutoAllocatedTopology(resource.Resource):
# Capabilities
allow_create = False
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = True
allow_list = False

View File

@ -22,8 +22,8 @@ class AvailabilityZone(_resource.Resource):
# capabilities
allow_create = False
allow_get = False
allow_update = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -21,7 +21,7 @@ class Extension(resource.Resource):
service = network_service.NetworkService()
# capabilities
allow_get = True
allow_fetch = True
allow_list = True
# NOTE: No query parameters supported

View File

@ -23,8 +23,8 @@ class Flavor(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -25,8 +25,8 @@ class FloatingIP(resource.Resource, tag.TagMixin):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class HealthMonitor(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class Listener(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class LoadBalancer(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class MeteringLabel(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class MeteringLabelRule(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -23,8 +23,8 @@ class Network(resource.Resource, tag.TagMixin):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
@ -125,8 +125,8 @@ class DHCPAgentHostingNetwork(Network):
# capabilities
allow_create = False
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -23,8 +23,8 @@ class NetworkIPAvailability(resource.Resource):
# capabilities
allow_create = False
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -22,8 +22,8 @@ class Pool(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class PoolMember(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -23,8 +23,8 @@ class Port(resource.Resource, tag.TagMixin):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class QoSBandwidthLimitRule(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class QoSDSCPMarkingRule(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class QoSMinimumBandwidthRule(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -24,8 +24,8 @@ class QoSPolicy(resource.Resource, tag.TagMixin):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -22,8 +22,8 @@ class QoSRuleType(resource.Resource):
# capabilities
allow_create = False
allow_get = True
allow_update = False
allow_fetch = True
allow_commit = False
allow_delete = False
allow_list = True

View File

@ -21,8 +21,8 @@ class Quota(resource.Resource):
service = network_service.NetworkService()
# capabilities
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
@ -75,7 +75,7 @@ class QuotaDefault(Quota):
# capabilities
allow_retrieve = True
allow_update = False
allow_commit = False
allow_delete = False
allow_list = False
@ -89,7 +89,7 @@ class QuotaDetails(Quota):
# capabilities
allow_retrieve = True
allow_update = False
allow_commit = False
allow_delete = False
allow_list = False

View File

@ -22,8 +22,8 @@ class RBACPolicy(resource.Resource):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True

View File

@ -24,8 +24,8 @@ class Router(resource.Resource, tag.TagMixin):
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
@ -142,7 +142,7 @@ class L3AgentRouter(Router):
# capabilities
allow_create = False
allow_retrieve = True
allow_update = False
allow_commit = False
allow_delete = False
allow_list = True

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