Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Feature/search record by name #240

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gandi/cli/commands/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def record(gandi):
@record.command()
@click.option('--zone-id', '-z', default=None, type=click.INT,
help='Zone ID to use, if not set default zone will be used.')
@click.option('--name', '-n', default=None, required=False,
help='Name of entry to search')
@click.option('--output', '-o', is_flag=True,
help='Write the records into a file.')
@click.option('--format', '-f', type=click.Choice(['text', 'json']),
Expand All @@ -28,11 +30,15 @@ def record(gandi):
show_default=True)
@click.argument('domain', required=True)
@pass_gandi
def list(gandi, domain, zone_id, output, format, limit):
def list(gandi, domain, name, zone_id, output, format, limit):
"""List DNS zone records for a domain."""
options = {
'items_per_page': limit,
}

if name is not None:
options.update({'~name' : '%{}%'.format(name)})

output_keys = ['name', 'type', 'value', 'ttl']

if not zone_id:
Expand Down