Added domain and record description editing

Change-Id: I8cdf3b9fa986255a9c1787f4ed8375bded8ee062
Closes-Bug: 1213889
This commit is contained in:
Graham Hayes 2013-10-30 18:22:54 +00:00
parent 6714726520
commit e2d7dc2c5c
6 changed files with 55 additions and 15 deletions

View File

@ -52,6 +52,7 @@ class CreateDomainCommand(base.CreateCommand):
parser.add_argument('--name', help="Domain Name", required=True)
parser.add_argument('--email', help="Domain Email", required=True)
parser.add_argument('--ttl', type=int, help="Time To Live (Seconds)")
parser.add_argument('--description', help="Description")
return parser
@ -61,6 +62,9 @@ class CreateDomainCommand(base.CreateCommand):
email=parsed_args.email,
)
if parsed_args.description:
domain.description = parsed_args.description
if parsed_args.ttl:
domain.ttl = parsed_args.ttl
@ -77,6 +81,9 @@ class UpdateDomainCommand(base.UpdateCommand):
parser.add_argument('--name', help="Domain Name")
parser.add_argument('--email', help="Domain Email")
parser.add_argument('--ttl', type=int, help="Time To Live (Seconds)")
description_group = parser.add_mutually_exclusive_group()
description_group.add_argument('--description', help="Description")
description_group.add_argument('--no-description', action='store_true')
return parser
@ -93,6 +100,11 @@ class UpdateDomainCommand(base.UpdateCommand):
if parsed_args.ttl:
domain.ttl = parsed_args.ttl
if parsed_args.no_description:
domain.description = None
elif parsed_args.description:
domain.description = parsed_args.description
return self.client.domains.update(domain)

View File

@ -63,6 +63,7 @@ class CreateRecordCommand(base.CreateCommand):
parser.add_argument('--data', help="Record Data", required=True)
parser.add_argument('--ttl', type=int, help="Record TTL")
parser.add_argument('--priority', type=int, help="Record Priority")
parser.add_argument('--description', help="Description")
return parser
@ -79,6 +80,9 @@ class CreateRecordCommand(base.CreateCommand):
if parsed_args.priority:
record.priority = parsed_args.priority
if parsed_args.description:
record.description = parsed_args.description
return self.client.records.create(parsed_args.domain_id, record)
@ -94,6 +98,10 @@ class UpdateRecordCommand(base.UpdateCommand):
parser.add_argument('--type', help="Record Type")
parser.add_argument('--data', help="Record Data")
description_group = parser.add_mutually_exclusive_group()
description_group.add_argument('--description', help="Description")
description_group.add_argument('--no-description', action='store_true')
ttl_group = parser.add_mutually_exclusive_group()
ttl_group.add_argument('--ttl', type=int,
help="Record Time To Live (Seconds)")
@ -129,6 +137,11 @@ class UpdateRecordCommand(base.UpdateCommand):
elif parsed_args.priority:
record.priority = parsed_args.priority
if parsed_args.no_description:
record.description = None
elif parsed_args.description:
record.description = parsed_args.description
return self.client.records.update(parsed_args.domain_id, record)

View File

@ -1,10 +1,11 @@
{
"id": "/schemas/domain",
"id": "domain",
"$schema": "http://json-schema.org/draft-03/hyper-schema",
"title": "domain",
"description": "Domain",
"additionalProperties": false,
"properties": {
"id": {
@ -31,25 +32,30 @@
"ttl": {
"type": "integer",
"description": "Time to live",
"min": 1,
"max": 4294967295
"minimum": 0,
"maximum": 2147483647
},
"serial": {
"type": "integer",
"description": "Serial Number",
"min": 1,
"max": 4294967295,
"minimum": 1,
"maximum": 4294967295,
"readonly": true
},
"description": {
"type": ["string", "null"],
"description": "Description for the Domain",
"maxLength": 160
},
"created_at": {
"type": "string",
"description": "Date and time of image registration",
"description": "Date and time of domain creation",
"format": "date-time",
"readonly": true
},
"updated_at": {
"type": ["string", "null"],
"description": "Date and time of image registration",
"description": "Date and time of last domain update",
"format": "date-time",
"readonly": true
}

View File

@ -1,10 +1,11 @@
{
"id": "/schemas/record",
"id": "record",
"$schema": "http://json-schema.org/draft-03/hyper-schema",
"title": "record",
"description": "Record",
"additionalProperties": false,
"properties": {
"id": {
@ -41,24 +42,29 @@
"priority": {
"type": ["integer", "null"],
"description": "DNS Record Priority",
"min": 1,
"max": 65535
"minimum": 1,
"maximum": 65535
},
"ttl": {
"type": ["integer", "null"],
"description": "Time to live",
"min": 1,
"max": 4294967295
"minimum": 0,
"maximum": 2147483647
},
"description": {
"type": ["string", "null"],
"description": "Description for the record",
"maxLength": 160
},
"created_at": {
"type": "string",
"description": "Date and time of image registration",
"description": "Date and time of record creation",
"format": "date-time",
"readonly": true
},
"updated_at": {
"type": ["string", "null"],
"description": "Date and time of image registration",
"description": "Date and time of last record update",
"format": "date-time",
"readonly": true
}

View File

@ -1,10 +1,11 @@
{
"id": "/schemas/server",
"id": "server",
"$schema": "http://json-schema.org/draft-03/hyper-schema",
"title": "server",
"description": "Server",
"additionalProperties": false,
"properties": {
"id": {

View File

@ -121,6 +121,7 @@ ttl Default TTL for records
serial Domain Server Number
created_at Date and time this domain was created at
updated_at Date and time this domain was last updated
description Domain Description
======================= =======================================================
Listing Domains
@ -245,6 +246,7 @@ priority Rercord Priority (Valid only for MX and SRV records)
ttl Record TTL
created_at Date and time this record was created at
updated_at Date and time this record was last updated
description Record Description
======================= =======================================================
Listing Records