diff --git a/designateclient/cli/touch.py b/designateclient/cli/touch.py new file mode 100644 index 0000000..4644295 --- /dev/null +++ b/designateclient/cli/touch.py @@ -0,0 +1,35 @@ +# Copyright 2012 Managed I.T. +# +# Author: Kiall Mac Innes +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +import logging +from designateclient.cli import base + +LOG = logging.getLogger(__name__) + + +class TouchDomainCommand(base.Command): + """ Touch a single Domain """ + + def get_parser(self, prog_name): + parser = super(TouchDomainCommand, self).get_parser(prog_name) + + parser.add_argument('domain_id', help="Domain ID") + + return parser + + def execute(self, parsed_args): + self.client.touch.domain(parsed_args.domain_id) + + LOG.info('Domain touched sucessfully') diff --git a/designateclient/v1/touch.py b/designateclient/v1/touch.py new file mode 100644 index 0000000..9b0120c --- /dev/null +++ b/designateclient/v1/touch.py @@ -0,0 +1,24 @@ +# Copyright 2013 Hewlett-Packard Development Company, L.P. +# +# Author: Kiall Mac Innes +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +from designateclient.v1.base import Controller + + +class TouchController(Controller): + def domain(self, domain_id): + """ + Touch a single Domain + """ + self.client.post('/domains/%s/touch' % domain_id) diff --git a/setup.cfg b/setup.cfg index e55cec9..46b9928 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,6 +36,7 @@ designateclient.v1.controllers = records = designateclient.v1.records:RecordsController servers = designateclient.v1.servers:ServersController sync = designateclient.v1.sync:SyncController + touch = designateclient.v1.touch:TouchController designateclient.cli = domain-list = designateclient.cli.domains:ListDomainsCommand @@ -63,6 +64,8 @@ designateclient.cli = sync-domain = designateclient.cli.sync:SyncDomainCommand sync-record = designateclient.cli.sync:SyncRecordCommand + touch-domain = designateclient.cli.touch:TouchDomainCommand + report-count-all = designateclient.cli.reports:CountsCommand report-count-domains = designateclient.cli.reports:DomainCountCommand report-count-records = designateclient.cli.reports:RecordCountCommand