Add getting info about the Limit in a DNS SDK.
I added this because showing the info lists for a limit as specified in the DNS API documentation is not implemented in the SDK. Change-Id: I4d7b9a3c0f652f9a07fbf70df35e3c780462514c
This commit is contained in:
@@ -69,6 +69,13 @@ Zone Share Operations
|
|||||||
:members: create_zone_share, delete_zone_share, get_zone_share,
|
:members: create_zone_share, delete_zone_share, get_zone_share,
|
||||||
find_zone_share, zone_shares
|
find_zone_share, zone_shares
|
||||||
|
|
||||||
|
Limit Operations
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. autoclass:: openstack.dns.v2._proxy.Proxy
|
||||||
|
:noindex:
|
||||||
|
:members: limits
|
||||||
|
|
||||||
Service Status Operations
|
Service Status Operations
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@@ -11,4 +11,5 @@ DNS Resources
|
|||||||
v2/zone_share
|
v2/zone_share
|
||||||
v2/floating_ip
|
v2/floating_ip
|
||||||
v2/recordset
|
v2/recordset
|
||||||
|
v2/limit
|
||||||
v2/service_status
|
v2/service_status
|
||||||
|
12
doc/source/user/resources/dns/v2/limit.rst
Normal file
12
doc/source/user/resources/dns/v2/limit.rst
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
openstack.dns.v2.limit
|
||||||
|
======================
|
||||||
|
|
||||||
|
.. automodule:: openstack.dns.v2.limit
|
||||||
|
|
||||||
|
The Limit Class
|
||||||
|
---------------
|
||||||
|
|
||||||
|
The ``Limit`` class inherits from :class:`~openstack.resource.Resource`.
|
||||||
|
|
||||||
|
.. autoclass:: openstack.dns.v2.limit.Limit
|
||||||
|
:members:
|
@@ -11,6 +11,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from openstack.dns.v2 import floating_ip as _fip
|
from openstack.dns.v2 import floating_ip as _fip
|
||||||
|
from openstack.dns.v2 import limit as _limit
|
||||||
from openstack.dns.v2 import recordset as _rs
|
from openstack.dns.v2 import recordset as _rs
|
||||||
from openstack.dns.v2 import service_status as _svc_status
|
from openstack.dns.v2 import service_status as _svc_status
|
||||||
from openstack.dns.v2 import zone as _zone
|
from openstack.dns.v2 import zone as _zone
|
||||||
@@ -24,6 +25,7 @@ from openstack import proxy
|
|||||||
class Proxy(proxy.Proxy):
|
class Proxy(proxy.Proxy):
|
||||||
_resource_registry = {
|
_resource_registry = {
|
||||||
"floating_ip": _fip.FloatingIP,
|
"floating_ip": _fip.FloatingIP,
|
||||||
|
"limits": _limit.Limit,
|
||||||
"recordset": _rs.Recordset,
|
"recordset": _rs.Recordset,
|
||||||
"service_status": _svc_status.ServiceStatus,
|
"service_status": _svc_status.ServiceStatus,
|
||||||
"zone": _zone.Zone,
|
"zone": _zone.Zone,
|
||||||
@@ -658,6 +660,15 @@ class Proxy(proxy.Proxy):
|
|||||||
zone_id=zone_obj.id,
|
zone_id=zone_obj.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ======== Limits ========
|
||||||
|
def limits(self, **query):
|
||||||
|
"""Retrieve a generator of limits
|
||||||
|
|
||||||
|
:returns: A generator of limits
|
||||||
|
(:class:`~openstack.dns.v2.limit.Limit`) instances
|
||||||
|
"""
|
||||||
|
return self._list(_limit.Limit, **query)
|
||||||
|
|
||||||
# ======== Service Statuses ========
|
# ======== Service Statuses ========
|
||||||
def service_statuses(self):
|
def service_statuses(self):
|
||||||
"""Retrieve a generator of service statuses
|
"""Retrieve a generator of service statuses
|
||||||
|
44
openstack/dns/v2/limit.py
Normal file
44
openstack/dns/v2/limit.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from openstack.dns.v2 import _base
|
||||||
|
from openstack import resource
|
||||||
|
|
||||||
|
|
||||||
|
class Limit(_base.Resource):
|
||||||
|
"""DNS Limit Resource"""
|
||||||
|
|
||||||
|
resource_key = 'limit'
|
||||||
|
base_path = '/limits'
|
||||||
|
|
||||||
|
# capabilities
|
||||||
|
allow_list = True
|
||||||
|
|
||||||
|
#: Properties
|
||||||
|
#: The max amount of items allowed per page
|
||||||
|
max_page_limit = resource.Body('max_page_limit', type=int)
|
||||||
|
#: The max length of a recordset name
|
||||||
|
max_recordset_name_length = resource.Body(
|
||||||
|
'max_recordset_name_length', type=int
|
||||||
|
)
|
||||||
|
#: The max amount of records contained in a recordset
|
||||||
|
max_recordset_records = resource.Body('max_recordset_records', type=int)
|
||||||
|
#: The max length of a zone name
|
||||||
|
max_zone_name_length = resource.Body('max_zone_name_length', type=int)
|
||||||
|
#: The max amount of records in a zone
|
||||||
|
max_zone_records = resource.Body('max_zone_records', type=int)
|
||||||
|
#: The max amount of recordsets per zone
|
||||||
|
max_zone_recordsets = resource.Body('max_zone_recordsets', type=int)
|
||||||
|
#: The max amount of zones for this project
|
||||||
|
max_zones = resource.Body('max_zones', type=int)
|
||||||
|
#: The lowest ttl allowed on this system
|
||||||
|
min_ttl = resource.Body('min_ttl', type=int)
|
35
openstack/tests/unit/dns/v2/test_limit.py
Normal file
35
openstack/tests/unit/dns/v2/test_limit.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from openstack.dns.v2 import limit as _limit
|
||||||
|
from openstack.tests.unit import base
|
||||||
|
|
||||||
|
IDENTIFIER = 'limit'
|
||||||
|
EXAMPLE = {
|
||||||
|
"max_page_limit": 1000,
|
||||||
|
"max_recordset_name_length": 255,
|
||||||
|
"max_recordset_records": 20,
|
||||||
|
"max_zone_name_length": 255,
|
||||||
|
"max_zone_records": 500,
|
||||||
|
"max_zone_recordsets": 500,
|
||||||
|
"max_zones": 10,
|
||||||
|
"min_ttl": 100,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestLimit(base.TestCase):
|
||||||
|
def test_basic(self):
|
||||||
|
sot = _limit.Limit()
|
||||||
|
self.assertEqual('limit', sot.resource_key)
|
||||||
|
self.assertEqual(None, sot.resources_key)
|
||||||
|
self.assertEqual('/limits', sot.base_path)
|
||||||
|
self.assertTrue(sot.allow_list)
|
Reference in New Issue
Block a user