Add an example for update in object_usage
This is a followup from [1]. which missed the example for update and get_object. [1]. https://review.openstack.org/336518 Change-Id: I0cc91e3070bd466bcccbdb2bcd4505a24924884f
This commit is contained in:
parent
71d96a8306
commit
a24d5afee8
@ -71,9 +71,14 @@ DNSNameServer:
|
||||
dnses = DNSNameServer.get_objects(context)
|
||||
# will return list of all dns name servers from DB
|
||||
|
||||
# to remove object:
|
||||
primary_keys = {'address': 'asd', 'subnet_id': 'xxx'}
|
||||
DNSNameServer.delete_objects(context, **primary_keys)
|
||||
# to update fields:
|
||||
dns = DNSNameServer.get_object(context, address='asd', subnet_id='xxx')
|
||||
dns.order = 2
|
||||
dns.update()
|
||||
|
||||
# to remove object with filter arguments:
|
||||
filters = {'address': 'asd', 'subnet_id': 'xxx'}
|
||||
DNSNameServer.delete_objects(context, **filters)
|
||||
|
||||
|
||||
Filter, sort and paginate
|
||||
@ -107,6 +112,11 @@ To limit or paginate results, :code:`Pager` object can be used. It accepts
|
||||
.. code-block:: Python
|
||||
|
||||
# filtering
|
||||
|
||||
# to get an object based on primary key filter
|
||||
dns = DNSNameServer.get_object(context, address='asd', subnet_id='xxx')
|
||||
|
||||
# to get multiple objects
|
||||
dnses = DNSNameServer.get_objects(context, subnet_id='xxx')
|
||||
|
||||
filters = {'subnet_id': ['xxx', 'yyy']}
|
||||
|
Loading…
Reference in New Issue
Block a user