Add a command to list the nameservers for a domain
Change-Id: Id44b9f8cfc0a79a7514ff338aab42f39067e1226
This commit is contained in:
parent
48bcdae017
commit
63c3a1a785
@ -108,3 +108,19 @@ class DeleteDomainCommand(base.DeleteCommand):
|
|||||||
|
|
||||||
def execute(self, parsed_args):
|
def execute(self, parsed_args):
|
||||||
return self.client.domains.delete(parsed_args.id)
|
return self.client.domains.delete(parsed_args.id)
|
||||||
|
|
||||||
|
|
||||||
|
class ListDomainServersCommand(base.ListCommand):
|
||||||
|
""" List Domain Servers """
|
||||||
|
|
||||||
|
columns = ['name']
|
||||||
|
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super(ListDomainServersCommand, self).get_parser(prog_name)
|
||||||
|
|
||||||
|
parser.add_argument('id', help="Domain ID")
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def execute(self, parsed_args):
|
||||||
|
return self.client.domains.list_domain_servers(parsed_args.id)
|
||||||
|
@ -20,6 +20,7 @@ from monikerclient.v1.base import CrudController
|
|||||||
|
|
||||||
|
|
||||||
Domain = warlock.model_factory(utils.load_schema('v1', 'domain'))
|
Domain = warlock.model_factory(utils.load_schema('v1', 'domain'))
|
||||||
|
Server = warlock.model_factory(utils.load_schema('v1', 'server'))
|
||||||
|
|
||||||
|
|
||||||
class DomainsController(CrudController):
|
class DomainsController(CrudController):
|
||||||
@ -77,3 +78,14 @@ class DomainsController(CrudController):
|
|||||||
self.client.delete('/domains/%s' % domain.id)
|
self.client.delete('/domains/%s' % domain.id)
|
||||||
else:
|
else:
|
||||||
self.client.delete('/domains/%s' % domain)
|
self.client.delete('/domains/%s' % domain)
|
||||||
|
|
||||||
|
def list_domain_servers(self, domain_id):
|
||||||
|
"""
|
||||||
|
Retrieve the list of nameservers for a domain
|
||||||
|
|
||||||
|
:param domain_id: Domain Identifier
|
||||||
|
:returns: A list of :class:`Server`s
|
||||||
|
"""
|
||||||
|
response = self.client.get('/domains/%s/servers' % domain_id)
|
||||||
|
|
||||||
|
return [Server(i) for i in response.json['servers']]
|
||||||
|
2
setup.py
2
setup.py
@ -53,6 +53,8 @@ setup(
|
|||||||
domain-create = monikerclient.cli.domains:CreateDomainCommand
|
domain-create = monikerclient.cli.domains:CreateDomainCommand
|
||||||
domain-update = monikerclient.cli.domains:UpdateDomainCommand
|
domain-update = monikerclient.cli.domains:UpdateDomainCommand
|
||||||
domain-delete = monikerclient.cli.domains:DeleteDomainCommand
|
domain-delete = monikerclient.cli.domains:DeleteDomainCommand
|
||||||
|
domain-servers-list = monikerclient.cli.domains\
|
||||||
|
:ListDomainServersCommand
|
||||||
|
|
||||||
record-list = monikerclient.cli.records:ListRecordsCommand
|
record-list = monikerclient.cli.records:ListRecordsCommand
|
||||||
record-get = monikerclient.cli.records:GetRecordCommand
|
record-get = monikerclient.cli.records:GetRecordCommand
|
||||||
|
Loading…
x
Reference in New Issue
Block a user