summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Hayes <graham.hayes@hp.com>2013-10-30 18:22:54 +0000
committerGraham Hayes <graham.hayes@hp.com>2013-10-30 18:41:06 +0000
commite2d7dc2c5cd0c7e2e2a87f9742f9456968b705c9 (patch)
tree42e7361bcee2ef68150625876cfe42db088f6d85
parent67147265207435a58748e13e0565967781cc5c61 (diff)
downloadpython-designateclient-e2d7dc2c5cd0c7e2e2a87f9742f9456968b705c9.tar.gz
Added domain and record description editing
Change-Id: I8cdf3b9fa986255a9c1787f4ed8375bded8ee062 Closes-Bug: 1213889
-rw-r--r--designateclient/cli/domains.py12
-rw-r--r--designateclient/cli/records.py13
-rw-r--r--designateclient/resources/schemas/v1/domain.json20
-rw-r--r--designateclient/resources/schemas/v1/record.json20
-rw-r--r--designateclient/resources/schemas/v1/server.json3
-rw-r--r--doc/source/bindings.rst2
6 files changed, 55 insertions, 15 deletions
diff --git a/designateclient/cli/domains.py b/designateclient/cli/domains.py
index 59787bb..18de93e 100644
--- a/designateclient/cli/domains.py
+++ b/designateclient/cli/domains.py
@@ -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)
diff --git a/designateclient/cli/records.py b/designateclient/cli/records.py
index cca7d03..13dab2c 100644
--- a/designateclient/cli/records.py
+++ b/designateclient/cli/records.py
@@ -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)
diff --git a/designateclient/resources/schemas/v1/domain.json b/designateclient/resources/schemas/v1/domain.json
index 6e92e47..4bfb87d 100644
--- a/designateclient/resources/schemas/v1/domain.json
+++ b/designateclient/resources/schemas/v1/domain.json
@@ -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
}
diff --git a/designateclient/resources/schemas/v1/record.json b/designateclient/resources/schemas/v1/record.json
index 64ef7da..10a2129 100644
--- a/designateclient/resources/schemas/v1/record.json
+++ b/designateclient/resources/schemas/v1/record.json
@@ -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
}
diff --git a/designateclient/resources/schemas/v1/server.json b/designateclient/resources/schemas/v1/server.json
index 66e348c..402b42b 100644
--- a/designateclient/resources/schemas/v1/server.json
+++ b/designateclient/resources/schemas/v1/server.json
@@ -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": {
diff --git a/doc/source/bindings.rst b/doc/source/bindings.rst
index c162bd2..23ddae1 100644
--- a/doc/source/bindings.rst
+++ b/doc/source/bindings.rst
@@ -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