Add openstack zone transfer accept list cli to designateclient

This patch add cli for listing accepted zone ownership transfer

and corresponding test cases.

Related-Bug: #1499539

Change-Id: I3eec36c73b2dacd4eed3b8578c4d51593b43104d
depends-on: I3dc042f666be43649bb3dec6e92cc67d1c32578f
This commit is contained in:
sonu.kumar 2016-06-14 15:12:38 +05:30 committed by sonu
parent fcac6337b9
commit 8bc106654c
6 changed files with 47 additions and 0 deletions

View File

@ -249,6 +249,20 @@ class TestZoneTransfers(v2.APIV2TestCase, v2.CrudMixin):
response = self.client.zone_transfers.get_accept(accept_id)
self.assertEqual(ref, response)
def test_list_accepts(self):
accept_id = "098bee04-fe30-4a83-8ccd-e0c496755816"
ref = {
"id": accept_id,
"status": "COMPLETE"
}
parts = ["zones", "tasks", "transfer_accepts"]
self.stub_url('GET', parts=parts, json={"transfer_accepts": ref})
self.client.zone_transfers.list_accepts()
self.assertRequestBodyIs("")
class TestZoneExports(v2.APIV2TestCase, v2.CrudMixin):
def new_ref(self, **kwargs):

View File

@ -382,6 +382,27 @@ class AcceptTransferRequestCommand(show.ShowOne):
return six.moves.zip(*sorted(six.iteritems(data)))
class ListTransferAcceptsCommand(lister.Lister):
"""List Zone Transfer Accepts"""
columns = ['id', 'zone_id', 'project_id',
'zone_transfer_request_id', 'status', 'key']
def get_parser(self, prog_name):
parser = super(ListTransferAcceptsCommand, self).get_parser(
prog_name)
return parser
def take_action(self, parsed_args):
client = self.app.client_manager.dns
data = client.zone_transfers.list_requests()
cols = self.columns
return cols, (utils.get_item_properties(s, cols) for s in data)
class ShowTransferAcceptCommand(show.ShowOne):
"""Show Zone Transfer Accept"""

View File

@ -125,6 +125,10 @@ class ZoneTransfersController(V2Controller):
url = '/zones/tasks/transfer_accepts/%s' % accept_id
return self._get(url)
def list_accepts(self):
url = '/zones/tasks/transfer_accepts'
return self._get(url, response_key="transfer_accepts")
class ZoneExportsController(V2Controller):
def create(self, zone):

View File

@ -356,6 +356,12 @@ Show Zone Transfer Accept
$openstack zone transfer accept show a8750f50-d7e6-403a-89d2-e209d62ef60e
List Zone Transfer Accept
.. code-block:: shell-session
$openstack zone transfer accept list
Working with tld
-----------------

View File

@ -118,6 +118,7 @@ zone transfer request show Show Zone Transfer Request Details
zone transfer request set Set a Zone Transfer Request
zone transfer request delete Delete a Zone Transfer Request
zone transfer accept request Accept a Zone Transfer Request
zone transfer accept list List Zone Transfer Accepts
zone transfer accept show Show Zone Transfer Accept
zone abandon Abandon a zone
zone axfr AXFR a zone

View File

@ -126,6 +126,7 @@ openstack.dns.v2 =
zone_transfer_request_set = designateclient.v2.cli.zones:SetTransferRequestCommand
zone_transfer_request_delete = designateclient.v2.cli.zones:DeleteTransferRequestCommand
zone_transfer_accept_request = designateclient.v2.cli.zones:AcceptTransferRequestCommand
zone_transfer_accept_list = designateclient.v2.cli.zones:ListTransferAcceptsCommand
zone_transfer_accept_show = designateclient.v2.cli.zones:ShowTransferAcceptCommand
recordset_create = designateclient.v2.cli.recordsets:CreateRecordSetCommand