diff --git a/bin/designate b/bin/designate deleted file mode 100755 index 510ff8f0..00000000 --- a/bin/designate +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# 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 sys -from designateclient.shell import DesignateShell - -shell = DesignateShell() -sys.exit(shell.run(sys.argv[1:])) diff --git a/designateclient/cli/__init__.py b/designateclient/cli/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/designateclient/cli/base.py b/designateclient/cli/base.py deleted file mode 100644 index af4f2de2..00000000 --- a/designateclient/cli/base.py +++ /dev/null @@ -1,143 +0,0 @@ -# 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 abc -import warnings - -from keystoneauth1 import exceptions as ks_exceptions -from osc_lib.command import command -import six - -from designateclient import exceptions -from designateclient import utils -from designateclient.v1 import Client - - -@six.add_metaclass(abc.ABCMeta) -class Command(command.Command): - def run(self, parsed_args): - - warnings.simplefilter('once', category=DeprecationWarning) - warnings.warn( - 'The "designate" CLI is being deprecated in favour of the ' - '"openstack" CLI plugin. All designate API v2 commands are ' - 'implemented there. When the v1 API is removed this CLI will ' - 'stop functioning', - DeprecationWarning) - warnings.resetwarnings() - warnings.simplefilter('ignore', category=DeprecationWarning) - - self.client = Client( - region_name=self.app.options.os_region_name, - service_type=self.app.options.os_service_type, - endpoint_type=self.app.options.os_endpoint_type, - session=self.app.session, - all_tenants=self.app.options.all_tenants, - edit_managed=self.app.options.edit_managed, - endpoint=self.app.options.os_endpoint) - warnings.resetwarnings() - try: - return super(Command, self).run(parsed_args) - except exceptions.RemoteError as e: - columns = ['Code', 'Type'] - values = [e.code, e.type] - - if e.message: - columns.append('Message') - values.append(e.message) - - if e.errors: - columns.append('Errors') - values.append(e.errors) - - self.error_output(parsed_args, columns, values) - except ks_exceptions.EndpointNotFound as e: - self.app.log.error('No endpoint was found. You must provide a ' - 'username or user id via --os-username, ' - '--os-user-id, env[OS_USERNAME] or ' - 'env[OS_USER_ID]. You may also be using a ' - 'cloud that does not have the V1 API enabled. ' - 'If your cloud does not have the V1 DNS API ' - 'use the openstack CLI to interact with the ' - 'DNS Service.') - - return 1 - - def error_output(self, parsed_args, column_names, data): - self.formatter.emit_one(column_names, - data, - self.app.stdout, - parsed_args) - self.app.log.error('The requested action did not complete ' - 'successfully') - - @abc.abstractmethod - def execute(self, parsed_args): - """ - Execute something, this is since we overload self.take_action() - in order to format the data - - This method __NEEDS__ to be overloaded! - - :param parsed_args: The parsed args that are given by take_action() - """ - - def post_execute(self, data): - """ - Format the results locally if needed, by default we just return data - - :param data: Whatever is returned by self.execute() - """ - return data - - def take_action(self, parsed_args): - results = self.execute(parsed_args) - return self.post_execute(results) - - def find_resourceid_by_name_or_id(self, resource_plural, name_or_id): - resource_client = getattr(self.client, resource_plural) - return utils.find_resourceid_by_name_or_id(resource_client, name_or_id) - - -class ListCommand(Command, command.Lister): - columns = None - - def post_execute(self, results): - if len(results) > 0: - columns = self.columns or utils.get_columns(results) - data = [utils.get_item_properties(i, columns) for i in results] - return columns, data - else: - return [], () - - -class GetCommand(Command, command.ShowOne): - def post_execute(self, results): - return results.keys(), results.values() - - -class CreateCommand(Command, command.ShowOne): - def post_execute(self, results): - return results.keys(), results.values() - - -class UpdateCommand(Command, command.ShowOne): - def post_execute(self, results): - return results.keys(), results.values() - - -class DeleteCommand(Command, command.ShowOne): - def post_execute(self, results): - return [], [] diff --git a/designateclient/cli/diagnostics.py b/designateclient/cli/diagnostics.py deleted file mode 100644 index e621616c..00000000 --- a/designateclient/cli/diagnostics.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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 PingCommand(base.GetCommand): - """Ping a service on a given host""" - - def get_parser(self, prog_name): - parser = super(PingCommand, self).get_parser(prog_name) - - parser.add_argument('--service', help="Service name (e.g. central)", - required=True) - parser.add_argument('--host', help="Hostname", required=True) - - return parser - - def execute(self, parsed_args): - return self.client.diagnostics.ping(parsed_args.service, - parsed_args.host) diff --git a/designateclient/cli/domains.py b/designateclient/cli/domains.py deleted file mode 100644 index 25ccd315..00000000 --- a/designateclient/cli/domains.py +++ /dev/null @@ -1,144 +0,0 @@ -# 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 -from designateclient.v1.domains import Domain - -LOG = logging.getLogger(__name__) - - -class ListDomainsCommand(base.ListCommand): - """List Domains""" - - columns = ['id', 'name', 'serial'] - - def execute(self, parsed_args): - return self.client.domains.list() - - -class GetDomainCommand(base.GetCommand): - """Get Domain""" - - def get_parser(self, prog_name): - parser = super(GetDomainCommand, self).get_parser(prog_name) - - parser.add_argument('id', help="Domain ID or name.") - - return parser - - def execute(self, parsed_args): - id = self.find_resourceid_by_name_or_id('domains', parsed_args.id) - return self.client.domains.get(id) - - -class CreateDomainCommand(base.CreateCommand): - """Create Domain""" - - def get_parser(self, prog_name): - parser = super(CreateDomainCommand, self).get_parser(prog_name) - - 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 - - def execute(self, parsed_args): - domain = Domain( - name=parsed_args.name, - email=parsed_args.email, - ) - - if parsed_args.description: - domain.description = parsed_args.description - - if parsed_args.ttl is not None: - domain.ttl = parsed_args.ttl - - return self.client.domains.create(domain) - - -class UpdateDomainCommand(base.UpdateCommand): - """Update Domain""" - - def get_parser(self, prog_name): - parser = super(UpdateDomainCommand, self).get_parser(prog_name) - - parser.add_argument('id', help="Domain ID or name.") - 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 - - def execute(self, parsed_args): - # TODO(kiall): API needs updating.. this get is silly - id = self.find_resourceid_by_name_or_id('domains', parsed_args.id) - domain = self.client.domains.get(id) - - if parsed_args.name: - domain.name = parsed_args.name - - if parsed_args.email: - domain.email = parsed_args.email - - if parsed_args.ttl is not None: - 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) - - -class DeleteDomainCommand(base.DeleteCommand): - """Delete Domain""" - - def get_parser(self, prog_name): - parser = super(DeleteDomainCommand, self).get_parser(prog_name) - - parser.add_argument('id', help="Domain ID or name.") - - return parser - - def execute(self, parsed_args): - id = self.find_resourceid_by_name_or_id('domains', parsed_args.id) - return self.client.domains.delete(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 or name.") - - return parser - - def execute(self, parsed_args): - id = self.find_resourceid_by_name_or_id('domains', parsed_args.id) - return self.client.domains.list_domain_servers(id) diff --git a/designateclient/cli/quotas.py b/designateclient/cli/quotas.py deleted file mode 100644 index ae416907..00000000 --- a/designateclient/cli/quotas.py +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 2014 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# 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 GetQuotaCommand(base.GetCommand): - """Get Quota""" - - def get_parser(self, prog_name): - parser = super(GetQuotaCommand, self).get_parser(prog_name) - - parser.add_argument('tenant_id', help="Tenant ID") - - return parser - - def execute(self, parsed_args): - return self.client.quotas.get(parsed_args.tenant_id) - - -class UpdateQuotaCommand(base.UpdateCommand): - """Update Quota""" - - def get_parser(self, prog_name): - parser = super(UpdateQuotaCommand, self).get_parser(prog_name) - - parser.add_argument('tenant_id', help="Tenant ID.") - parser.add_argument('--domains', help="Allowed domains.", type=int) - parser.add_argument('--domain-recordsets', - help="Allowed domain records.", - type=int) - parser.add_argument('--recordset-records', - help="Allowed recordset records.", - type=int) - parser.add_argument('--domain-records', - help="Allowed domain records.", - type=int) - parser.add_argument('--api-export-size', - help="Allowed zone export recordsets.", - type=int) - return parser - - def execute(self, parsed_args): - # TODO(kiall): API needs updating.. this get is silly - quota = self.client.quotas.get(parsed_args.tenant_id) - - for key, old in quota.items(): - new = getattr(parsed_args, key) - if new is not None and new != old: - quota[key] = new - return self.client.quotas.update(parsed_args.tenant_id, quota) - - -class ResetQuotaCommand(base.DeleteCommand): - """Reset Quota""" - - def get_parser(self, prog_name): - parser = super(ResetQuotaCommand, self).get_parser(prog_name) - - parser.add_argument('tenant_id', help="Tenant ID.") - - return parser - - def execute(self, parsed_args): - self.client.quotas.reset(parsed_args.tenant_id) diff --git a/designateclient/cli/records.py b/designateclient/cli/records.py deleted file mode 100644 index 6e276ca5..00000000 --- a/designateclient/cli/records.py +++ /dev/null @@ -1,187 +0,0 @@ -# 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 -from designateclient.v1.records import Record - -LOG = logging.getLogger(__name__) - - -class ListRecordsCommand(base.ListCommand): - """List Records""" - - columns = ['id', 'type', 'name', 'data'] - - def get_parser(self, prog_name): - parser = super(ListRecordsCommand, self).get_parser(prog_name) - - parser.add_argument('domain_id', help="Domain ID or name.") - - return parser - - def execute(self, parsed_args): - domain_id = self.find_resourceid_by_name_or_id( - 'domains', parsed_args.domain_id) - return self.client.records.list(domain_id) - - -class GetRecordCommand(base.GetCommand): - """Get Record""" - - def get_parser(self, prog_name): - parser = super(GetRecordCommand, self).get_parser(prog_name) - - parser.add_argument('domain_id', help="Domain ID or name.") - parser.add_argument('id', help="Record ID.") - - return parser - - def execute(self, parsed_args): - domain_id = self.find_resourceid_by_name_or_id( - 'domains', parsed_args.domain_id) - return self.client.records.get(domain_id, parsed_args.id) - - -class CreateRecordCommand(base.CreateCommand): - """Create Record""" - - def get_parser(self, prog_name): - parser = super(CreateRecordCommand, self).get_parser(prog_name) - - parser.add_argument('domain_id', help="Domain ID or name.") - parser.add_argument( - '--name', help="Record (relative|absolute) name.", required=True) - parser.add_argument('--type', help="Record type.", required=True) - 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 - - def execute(self, parsed_args): - domain_id = self.find_resourceid_by_name_or_id( - 'domains', parsed_args.domain_id) - - if not parsed_args.name.endswith('.'): - # Relative name? - domain_name = self.client.domains.get(domain_id)['name'] - absolute = parsed_args.name + '.' - relative = absolute + domain_name - if absolute.endswith('.' + domain_name): - # Relative name or absolute name missing final period? - msg = ('"%s" is a relative name but looks like an absolute ' - 'name, use --name "%s" or "%s"' - % (parsed_args.name, absolute, relative)) - raise ValueError(msg) - parsed_args.name = relative - - record = Record( - name=parsed_args.name, - type=parsed_args.type, - data=parsed_args.data, - ) - - if parsed_args.ttl is not None: - record.ttl = parsed_args.ttl - - if parsed_args.priority is not None: - record.priority = parsed_args.priority - - if parsed_args.description: - record.description = parsed_args.description - - return self.client.records.create(domain_id, record) - - -class UpdateRecordCommand(base.UpdateCommand): - """Update Record""" - - def get_parser(self, prog_name): - parser = super(UpdateRecordCommand, self).get_parser(prog_name) - - parser.add_argument('domain_id', help="Domain ID or name.") - parser.add_argument('id', help="Record ID.") - parser.add_argument('--name', help="Record name.") - 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).") - ttl_group.add_argument('--no-ttl', action='store_true') - - priotity_group = parser.add_mutually_exclusive_group() - priotity_group.add_argument('--priority', type=int, - help="Record priority.") - priotity_group.add_argument('--no-priority', action='store_true') - - return parser - - def execute(self, parsed_args): - # TODO(kiall): API needs updating.. this get is silly - record = self.client.records.get(parsed_args.domain_id, parsed_args.id) - - if parsed_args.name: - record.name = parsed_args.name - - if parsed_args.type: - record.type = parsed_args.type - - if parsed_args.data: - record.data = parsed_args.data - - if parsed_args.no_ttl: - record.ttl = None - elif parsed_args.ttl is not None: - record.ttl = parsed_args.ttl - - if parsed_args.no_priority: - record.priority = None - elif parsed_args.priority is not None: - record.priority = parsed_args.priority - - if parsed_args.no_description: - record.description = None - elif parsed_args.description: - record.description = parsed_args.description - - domain_id = self.find_resourceid_by_name_or_id( - 'domains', parsed_args.domain_id) - return self.client.records.update(domain_id, record) - - -class DeleteRecordCommand(base.DeleteCommand): - """Delete Record""" - - def get_parser(self, prog_name): - parser = super(DeleteRecordCommand, self).get_parser(prog_name) - - parser.add_argument('domain_id', help="Domain ID or name.") - parser.add_argument('id', help="Record ID.") - - return parser - - def execute(self, parsed_args): - domain_id = self.find_resourceid_by_name_or_id( - 'domains', parsed_args.domain_id) - return self.client.records.delete(domain_id, parsed_args.id) diff --git a/designateclient/cli/reports.py b/designateclient/cli/reports.py deleted file mode 100644 index 6ecfc2e1..00000000 --- a/designateclient/cli/reports.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2013 Hewlett-Packard Development Company, L.P. All Rights Reserved. -# -# Author: Patrick Galbraith -# -# 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.cli import base - - -class DomainCountCommand(base.GetCommand): - """Get counts for total domains""" - - def execute(self, parsed_args): - return self.client.reports.count_domains() - - -class RecordCountCommand(base.GetCommand): - """Get counts for total records""" - - def execute(self, parsed_args): - return self.client.reports.count_records() - - -class TenantCountCommand(base.GetCommand): - """Get counts for total tenants""" - - def execute(self, parsed_args): - return self.client.reports.count_tenants() - - -class CountsCommand(base.GetCommand): - """Get count totals for all tenants, domains and records""" - - def execute(self, parsed_args): - return self.client.reports.count_all() - - -class TenantsCommand(base.ListCommand): - """Get list of tenants and domain count for each""" - - columns = ['domain_count', 'id'] - - def execute(self, parsed_args): - return self.client.reports.tenants_all() - - -class TenantCommand(base.ListCommand): - """Get a list of domains for given tenant""" - - columns = ['domain'] - - def get_parser(self, prog_name): - parser = super(TenantCommand, self).get_parser(prog_name) - - parser.add_argument('--report-tenant-id', - help="The tenant_id being reported on.", - required=True) - - return parser - - def execute(self, parsed_args): - return self.client.reports.tenant_domains(parsed_args.report_tenant_id) diff --git a/designateclient/cli/servers.py b/designateclient/cli/servers.py deleted file mode 100644 index 184271bd..00000000 --- a/designateclient/cli/servers.py +++ /dev/null @@ -1,98 +0,0 @@ -# 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 -from designateclient.v1.servers import Server - -LOG = logging.getLogger(__name__) - - -class ListServersCommand(base.ListCommand): - """List Servers""" - - columns = ['id', 'name'] - - def execute(self, parsed_args): - return self.client.servers.list() - - -class GetServerCommand(base.GetCommand): - """Get Server""" - - def get_parser(self, prog_name): - parser = super(GetServerCommand, self).get_parser(prog_name) - - parser.add_argument('id', help="Server ID.") - - return parser - - def execute(self, parsed_args): - return self.client.servers.get(parsed_args.id) - - -class CreateServerCommand(base.CreateCommand): - """Create Server""" - - def get_parser(self, prog_name): - parser = super(CreateServerCommand, self).get_parser(prog_name) - - parser.add_argument('--name', help="Server name.", required=True) - - return parser - - def execute(self, parsed_args): - server = Server( - name=parsed_args.name, - ) - - return self.client.servers.create(server) - - -class UpdateServerCommand(base.UpdateCommand): - """Update Server""" - - def get_parser(self, prog_name): - parser = super(UpdateServerCommand, self).get_parser(prog_name) - - parser.add_argument('id', help="Server ID.") - parser.add_argument('--name', help="Server name.") - - return parser - - def execute(self, parsed_args): - # TODO(kiall): API needs updating.. this get is silly - server = self.client.servers.get(parsed_args.id) - - if parsed_args.name: - server.name = parsed_args.name - - return self.client.servers.update(server) - - -class DeleteServerCommand(base.DeleteCommand): - """Delete Server""" - - def get_parser(self, prog_name): - parser = super(DeleteServerCommand, self).get_parser(prog_name) - - parser.add_argument('id', help="Server ID.") - - return parser - - def execute(self, parsed_args): - return self.client.servers.delete(parsed_args.id) diff --git a/designateclient/cli/sync.py b/designateclient/cli/sync.py deleted file mode 100644 index 18e2852c..00000000 --- a/designateclient/cli/sync.py +++ /dev/null @@ -1,63 +0,0 @@ -# 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 SyncAllCommand(base.DeleteCommand): - """Sync Everything""" - - def execute(self, parsed_args): - self.client.sync.sync_all() - - LOG.info('Synchronization of all domains scheduled') - - -class SyncDomainCommand(base.DeleteCommand): - """Sync a single Domain""" - - def get_parser(self, prog_name): - parser = super(SyncDomainCommand, self).get_parser(prog_name) - - parser.add_argument('domain_id', help="Domain ID") - - return parser - - def execute(self, parsed_args): - self.client.sync.sync_domain(parsed_args.domain_id) - - LOG.info('Synchronization of domain scheduled') - - -class SyncRecordCommand(base.DeleteCommand): - """Sync a single Record""" - - def get_parser(self, prog_name): - parser = super(SyncRecordCommand, self).get_parser(prog_name) - - parser.add_argument('domain_id', help="Domain ID") - parser.add_argument('record_id', help="Record ID") - - return parser - - def execute(self, parsed_args): - self.client.sync.sync_record(parsed_args.domain_id, - parsed_args.record_id) - - LOG.info('Synchronization of record scheduled') diff --git a/designateclient/cli/touch.py b/designateclient/cli/touch.py deleted file mode 100644 index a9713f02..00000000 --- a/designateclient/cli/touch.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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.DeleteCommand): - """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 successfully') diff --git a/designateclient/osc/plugin.py b/designateclient/osc/plugin.py index eeeae7a0..6b8719b5 100644 --- a/designateclient/osc/plugin.py +++ b/designateclient/osc/plugin.py @@ -16,9 +16,9 @@ """OpenStackClient plugin for DNS service.""" -from osc_lib import utils as oscutils +import os -from designateclient import shell +from osc_lib import utils as oscutils DEFAULT_API_VERSION = '2' @@ -45,7 +45,7 @@ def build_option_parser(parser): parser.add_argument( '--os-dns-api-version', metavar='', - default=shell.env('OS_DNS_API_VERSION', default="2"), + default=os.environ.get('OS_DNS_API_VERSION', '2'), help='DNS API version, default=' + DEFAULT_API_VERSION + ' (Env: OS_DNS_API_VERSION)') diff --git a/designateclient/resources/schemas/v1/domain.json b/designateclient/resources/schemas/v1/domain.json deleted file mode 100644 index 5ed584f4..00000000 --- a/designateclient/resources/schemas/v1/domain.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "id": "domain", - - "$schema": "http://json-schema.org/draft-03/hyper-schema", - - "title": "domain", - "description": "Domain", - "additionalProperties": false, - - "properties": { - "id": { - "type": "string", - "description": "Domain Identifier", - "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", - "readonly": true - }, - "name": { - "type": "string", - "description": "Domain name", - "format": "domain-name", - "maxLength": 255, - "required": true, - "readonly": true - }, - "email": { - "type": "string", - "description": "Hostmaster email address", - "format": "email", - "maxLength": 255, - "required": true - }, - "ttl": { - "type": "integer", - "description": "Time to live", - "minimum": 1, - "maximum": 2147483647 - }, - "serial": { - "type": "integer", - "description": "Serial Number", - "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 domain creation", - "format": "date-time", - "readonly": true - }, - "updated_at": { - "type": ["string", "null"], - "description": "Date and time of last domain update", - "format": "date-time", - "readonly": true - } - }, - "links": [{ - "rel": "self", - "href": "/domains/{id}" - }, { - "rel": "records", - "href": "/domains/{id}/records" - }, { - "rel": "servers", - "href": "/domains/{id}/servers" - }, { - "rel": "collection", - "href": "/domains" - }] -} diff --git a/designateclient/resources/schemas/v1/record.json b/designateclient/resources/schemas/v1/record.json deleted file mode 100644 index cecc9fd3..00000000 --- a/designateclient/resources/schemas/v1/record.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "id": "record", - - "$schema": "http://json-schema.org/draft-03/hyper-schema", - - "title": "record", - "description": "Record", - "additionalProperties": false, - - "properties": { - "id": { - "type": "string", - "description": "Record Identifier", - "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", - "readonly": true - }, - "domain_id": { - "type": "string", - "description": "Domain Identifier", - "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", - "readonly": true - }, - "name": { - "type": "string", - "description": "DNS Record Name", - "format": "host-name", - "maxLength": 255, - "required": true - }, - "type": { - "type": "string", - "description": "DNS Record Type", - "enum": ["A", "AAAA", "CNAME", "MX", "SRV", "TXT", "SPF", "NS", "PTR", "SSHFP", "SOA"], - "required": true - }, - "data": { - "type": "string", - "description": "DNS Record Value", - "maxLength": 255, - "required": true - }, - "priority": { - "type": ["integer", "null"], - "description": "DNS Record Priority", - "minimum": 0, - "maximum": 65535 - }, - "ttl": { - "type": ["integer", "null"], - "description": "Time to live", - "minimum": 1, - "maximum": 2147483647 - }, - "description": { - "type": ["string", "null"], - "description": "Description for the record", - "maxLength": 160 - }, - "created_at": { - "type": "string", - "description": "Date and time of record creation", - "format": "date-time", - "readonly": true - }, - "updated_at": { - "type": ["string", "null"], - "description": "Date and time of last record update", - "format": "date-time", - "readonly": true - } - }, - "oneOf": [{ - "description": "An A Record", - "properties": { - "type": { - "type": "string", - "enum": ["A"] - }, - "data": { - "format": "ip-address", - "required": true - }, - "priority": { - "type": "null" - } - } - }, { - "description": "An AAAA Record", - "properties": { - "type": { - "type": "string", - "enum": ["AAAA"] - }, - "data": { - "format": "ipv6", - "required": true - }, - "priority": { - "type": "null" - } - } - }, { - "description": "A CNAME Record", - "properties": { - "type": { - "type": "string", - "enum": ["CNAME"] - }, - "data": { - "format": "host-name", - "required": true - }, - "priority": { - "type": "null" - } - } - }, { - "description": "A MX Record", - "properties": { - "type": { - "type": "string", - "enum": ["MX"] - }, - "data": { - "format": "host-name", - "required": true - }, - "priority": { - "type": "integer", - "required": true - } - } - }, { - "description": "A SRV Record", - "properties": { - "type": { - "type": "string", - "enum": ["SRV"] - }, - "name": { - "type": "string", - "pattern": "^(?:_[A-Za-z0-9_\\-]{1,62}\\.){2}" - }, - "data": { - "type": "string", - "pattern": "^(?:(?:6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])\\s){2}(?!.{255,})((?!\\-)[A-Za-z0-9_\\-]{1,63}(? -# -# 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 -import os -import traceback - -from cliff.app import App -from cliff.commandmanager import CommandManager - -from designateclient import utils -from designateclient.version import version_info as version - - -def env(*vars, **kwargs): - """Search for the first defined of possibly many env vars - - Returns the first environment variable defined in vars, or - returns the default defined in kwargs. - - """ - for v in vars: - value = os.environ.get(v) - if value: - return value - return kwargs.get('default', '') - - -class DesignateShell(App): - CONSOLE_MESSAGE_FORMAT = '%(levelname)s: %(message)s' - DEFAULT_VERBOSE_LEVEL = 0 - - def __init__(self): - super(DesignateShell, self).__init__( - description='Designate Client', - version=version.version_string(), - command_manager=CommandManager('designateclient.cli'), - ) - - self.log = logging.getLogger(__name__) - - def build_option_parser(self, description, version): - parser = super(DesignateShell, self).build_option_parser( - description, version) - - parser.add_argument('--os-username', - default=env('OS_USERNAME'), - help='Name used for authentication with the ' - 'OpenStack Identity service. ' - 'Defaults to env[OS_USERNAME].') - - parser.add_argument('--os-user-id', - default=env('OS_USER_ID'), - help='User ID used for authentication with the ' - 'OpenStack Identity service. ' - 'Defaults to env[OS_USER_ID].') - - parser.add_argument('--os-user-domain-id', - default=env('OS_USER_DOMAIN_ID'), - help='Defaults to env[OS_USER_DOMAIN_ID].') - - parser.add_argument('--os-user-domain-name', - default=env('OS_USER_DOMAIN_NAME'), - help='Defaults to env[OS_USER_DOMAIN_NAME].') - - parser.add_argument('--os-password', - default=env('OS_PASSWORD'), - help='Password used for authentication with the ' - 'OpenStack Identity service. ' - 'Defaults to env[OS_PASSWORD].') - - parser.add_argument('--os-tenant-name', - default=env('OS_TENANT_NAME'), - help='Tenant to request authorization on. ' - 'Defaults to env[OS_TENANT_NAME].') - - parser.add_argument('--os-tenant-id', - default=env('OS_TENANT_ID'), - help='Tenant to request authorization on. ' - 'Defaults to env[OS_TENANT_ID].') - - parser.add_argument('--os-project-name', - default=env('OS_PROJECT_NAME'), - help='Project to request authorization on. ' - 'Defaults to env[OS_PROJECT_NAME].') - - parser.add_argument('--os-domain-name', - default=env('OS_DOMAIN_NAME'), - help='Project to request authorization on. ' - 'Defaults to env[OS_DOMAIN_NAME].') - - parser.add_argument('--os-domain-id', - default=env('OS_DOMAIN_ID'), - help='Defaults to env[OS_DOMAIN_ID].') - - parser.add_argument('--os-project-id', - default=env('OS_PROJECT_ID'), - help='Project to request authorization on. ' - 'Defaults to env[OS_PROJECT_ID].') - - parser.add_argument('--os-project-domain-id', - default=env('OS_PROJECT_DOMAIN_ID'), - help='Defaults to env[OS_PROJECT_DOMAIN_ID].') - - parser.add_argument('--os-project-domain-name', - default=env('OS_PROJECT_DOMAIN_NAME'), - help='Defaults to env[OS_PROJECT_DOMAIN_NAME].') - - parser.add_argument('--os-auth-url', - default=env('OS_AUTH_URL'), - help='Specify the Identity endpoint to use for ' - 'authentication. ' - 'Defaults to env[OS_AUTH_URL].') - - parser.add_argument('--os-region-name', - default=env('OS_REGION_NAME'), - help='Specify the region to use. ' - 'Defaults to env[OS_REGION_NAME].') - - parser.add_argument('--os-token', - default=env('OS_SERVICE_TOKEN'), - help='Specify an existing token to use instead of ' - 'retrieving one via authentication (e.g. ' - 'with username & password). ' - 'Defaults to env[OS_SERVICE_TOKEN].') - - parser.add_argument('--os-endpoint', - default=env('OS_DNS_ENDPOINT', - 'OS_SERVICE_ENDPOINT'), - help='Specify an endpoint to use instead of ' - 'retrieving one from the service catalog ' - '(via authentication). ' - 'Defaults to env[OS_DNS_ENDPOINT].') - - parser.add_argument('--os-endpoint-type', - default=env('OS_ENDPOINT_TYPE', - default='publicURL'), - help='Defaults to env[OS_ENDPOINT_TYPE].') - - parser.add_argument('--os-service-type', - default=env('OS_DNS_SERVICE_TYPE', default='dns'), - help=("Defaults to env[OS_DNS_SERVICE_TYPE], or " - "'dns'.")) - - parser.add_argument('--os-cacert', - default=env('OS_CACERT'), - help=('CA certificate bundle file. Defaults to ' - 'env[OS_CACERT].')) - - parser.add_argument('--insecure', action='store_true', - help="Explicitly allow 'insecure' SSL requests.") - - parser.add_argument('--all-tenants', action='store_true', - help="Allows to list all domains from all " - "tenants.") - - parser.add_argument('--edit-managed', action='store_true', - help='Allows to edit records that are marked as ' - 'managed.') - - return parser - - def configure_logging(self): - """Configure logging for the app - - Cliff sets some defaults we don't want so re-work it a bit - """ - - if self.options.debug: - # --debug forces verbose_level 3 - # Set this here so cliff.app.configure_logging() can work - self.options.verbose_level = 3 - - super(DesignateShell, self).configure_logging() - root_logger = logging.getLogger('') - - # Requests logs some stuff at INFO that we don't want - # unless we have DEBUG - requests_log = logging.getLogger("requests") - requests_log.setLevel(logging.ERROR) - - # Other modules we don't want DEBUG output for so - # don't reset them below - iso8601_log = logging.getLogger("iso8601") - iso8601_log.setLevel(logging.ERROR) - - # Set logging to the requested level - self.dump_stack_trace = False - if self.options.verbose_level == 0: - # --quiet - root_logger.setLevel(logging.ERROR) - elif self.options.verbose_level == 1: - # This is the default case, no --debug, --verbose or --quiet - root_logger.setLevel(logging.WARNING) - elif self.options.verbose_level == 2: - # One --verbose - root_logger.setLevel(logging.INFO) - elif self.options.verbose_level >= 3: - # Two or more --verbose - root_logger.setLevel(logging.DEBUG) - requests_log.setLevel(logging.DEBUG) - - if self.options.debug: - # --debug forces traceback - self.dump_stack_trace = True - - def initialize_app(self, argv): - super(DesignateShell, self).initialize_app(argv) - self.session = utils.get_session( - auth_url=self.options.os_auth_url, - endpoint=self.options.os_endpoint, - domain_id=self.options.os_domain_id, - domain_name=self.options.os_domain_name, - project_id=self.options.os_project_id or self.options.os_tenant_id, - project_name=(self.options.os_project_name or - self.options.os_tenant_name), - project_domain_name=self.options.os_project_domain_name, - project_domain_id=self.options.os_project_domain_id, - username=self.options.os_username, - user_id=self.options.os_user_id, - password=self.options.os_password, - user_domain_id=self.options.os_user_domain_id, - user_domain_name=self.options.os_user_domain_name, - token=self.options.os_token, - insecure=self.options.insecure, - cacert=self.options.os_cacert - ) - - def run(self, argv): - try: - return super(DesignateShell, self).run(argv) - except Exception as e: - if not logging.getLogger('').handlers: - logging.basicConfig() - if self.dump_stack_trace: - self.log.error(traceback.format_exc(e)) - else: - self.log.error('Exception raised: ' + str(e)) - return 1 diff --git a/designateclient/tests/test_utils.py b/designateclient/tests/test_utils.py index e4fa7b0f..359d0e19 100644 --- a/designateclient/tests/test_utils.py +++ b/designateclient/tests/test_utils.py @@ -62,24 +62,3 @@ class UtilsTestCase(base.TestCase): self.assertRaises(exceptions.NoUniqueMatch, self._find_resourceid_by_name_or_id, 'baba', by_name=True) - - def test_load_schema(self): - schema = utils.load_schema('v1', 'domain') - self.assertIsInstance(schema, dict) - - def test_load_schema_missing(self): - self.assertRaises(exceptions.ResourceNotFound, utils.load_schema, - 'v1', 'missing') - - def test_resource_string_empty_param(self): - self.assertRaises(ValueError, utils.resource_string) - - def test_resource_string(self): - name = ['schemas', 'v1', 'domain.json'] - resource_string = utils.resource_string(*name) - self.assertIsNotNone(resource_string) - - def test_resource_string_missing(self): - name = ['schemas', 'v1', 'missing'] - self.assertRaises(exceptions.ResourceNotFound, utils.resource_string, - *name) diff --git a/designateclient/tests/test_v1/__init__.py b/designateclient/tests/test_v1/__init__.py deleted file mode 100644 index 3654a916..00000000 --- a/designateclient/tests/test_v1/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2015 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. -import uuid - -from designateclient.tests import base - - -class CrudMixin(object): - path_prefix = None - - def new_ref(self, **kwargs): - kwargs.setdefault('id', uuid.uuid4().hex) - return kwargs - - def stub_entity(self, method, parts=None, entity=None, id=None, **kwargs): - if entity: - kwargs['json'] = entity - - if not parts: - parts = [self.RESOURCE] - - if self.path_prefix: - parts.insert(0, self.path_prefix) - - if id: - if not parts: - parts = [] - - parts.append(id) - - self.stub_url(method, parts=parts, **kwargs) - - def assertList(self, expected, actual): - self.assertEqual(len(expected), len(actual)) - for i in expected: - self.assertIn(i, actual) - - -class APIV1TestCase(base.APITestCase): - VERSION = "1" diff --git a/designateclient/tests/test_v1/test_client.py b/designateclient/tests/test_v1/test_client.py deleted file mode 100644 index f46f64da..00000000 --- a/designateclient/tests/test_v1/test_client.py +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright 2015 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.tests import test_v1 -from designateclient import utils -from designateclient import v1 - -from keystoneauth1 import session as keystone_session - - -class TestClient(test_v1.APIV1TestCase): - def test_all_tenants(self): - # Create a client with the all_tenants flag set to True - client = v1.Client(all_tenants=True) - - # Verify this has been picked up - self.assertTrue(client.all_tenants) - - def test_all_tenants_not_supplied(self): - # Create a client without supplying any all_tenants flag - client = v1.Client() - - # Verify all_tenants is False - self.assertFalse(client.all_tenants) - self.assertIsNotNone(client.all_tenants) - - def test_all_tenants_through_session(self): - # Create a session with the all_tenants flag set to True - session = utils.get_session( - auth_url='Anything', - endpoint='Anything', - domain_id='Anything', - domain_name='Anything', - project_id='Anything', - project_name='Anything', - project_domain_name='Anything', - project_domain_id='Anything', - username='Anything', - user_id='Anything', - password='Anything', - user_domain_id='Anything', - user_domain_name='Anything', - token=None, - insecure=False, - cacert=None, - all_tenants=True) - - # Create a client using the pre-created session - client = v1.Client(session=session) - - # Verify the all_tenants flag has been picked up - self.assertTrue(client.all_tenants) - - def test_edit_managed(self): - # Create a client with the edit_managed flag set to True - client = v1.Client(edit_managed=True) - - # Verify this has been picked up - self.assertTrue(client.edit_managed) - - def test_edit_managed_not_supplied(self): - # Create a client without supplying any edit_managed flag - client = v1.Client() - - # Verify edit_managed is False - self.assertFalse(client.edit_managed) - self.assertIsNotNone(client.edit_managed) - - def test_edit_managed_through_session(self): - # Create a session with the edit_managed flag set to True - session = utils.get_session( - auth_url='Anything', - endpoint='Anything', - domain_id='Anything', - domain_name='Anything', - project_id='Anything', - project_name='Anything', - project_domain_name='Anything', - project_domain_id='Anything', - username='Anything', - user_id='Anything', - password='Anything', - user_domain_id='Anything', - user_domain_name='Anything', - token=None, - insecure=False, - cacert=None, - edit_managed=True) - - # Create a client using the pre-created session - client = v1.Client(session=session) - - # Verify the edit_managed flag has been picked up - self.assertTrue(client.edit_managed) - - def test_timeout_new_session(self): - client = v1.Client( - auth_url="http://127.0.0.1:22/", - timeout=1, - ) - assert client.session.timeout == 1 - - def test_timeout_override_session_timeout(self): - # The adapter timeout should override the session timeout - session = keystone_session.Session(timeout=10) - client = v1.Client( - auth_url="http://127.0.0.1:22/", - session=session, - timeout=2, - ) - self.assertEqual(2, client.session.timeout) diff --git a/designateclient/tests/test_v1/test_diagnostics.py b/designateclient/tests/test_v1/test_diagnostics.py deleted file mode 100644 index 09487f1b..00000000 --- a/designateclient/tests/test_v1/test_diagnostics.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 mock -from mock import patch - -from designateclient.tests import test_v1 -from designateclient.v1 import diagnostics - - -class TestDiagnostics(test_v1.APIV1TestCase, test_v1.CrudMixin): - - @patch.object(diagnostics.DiagnosticsController, "ping") - def test_ping(self, ping): - args = mock.MagicMock() - args.service = "foo" - args.host = "host1" - self.client.diagnostics.ping(args.host, args.service) - self.client.diagnostics.ping.assert_called_with("host1", "foo") diff --git a/designateclient/tests/test_v1/test_domain.py b/designateclient/tests/test_v1/test_domain.py deleted file mode 100644 index fa69030c..00000000 --- a/designateclient/tests/test_v1/test_domain.py +++ /dev/null @@ -1,184 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 uuid - -from mock import patch - -from designateclient.tests import test_v1 -from designateclient import utils -from designateclient.v1 import domains -from designateclient import warlock - -Domain = warlock.model_factory(utils.load_schema('v1', 'domain')) - - -class TestDomain(test_v1.APIV1TestCase, test_v1.CrudMixin): - RESOURCE = 'domains' - - def new_ref(self, **kwargs): - ref = super(TestDomain, self).new_ref(**kwargs) - ref.setdefault("name", uuid.uuid4().hex) - ref.setdefault("email", "abc@example.com.") - ref.setdefault("ttl", 3600) - return ref - - def test_create(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "domain1.com.", - "email": "nsadmin@example.org", - "ttl": 60} - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - response = self.client.domains.create(values["name"]) - self.assertEqual(ref['id'], response['id']) - - def test_create_with_description(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "domain1.com.", - "email": "nsadmin@example.org", - "ttl": 60, - "description": "fully qualified domain"} - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - response = self.client.domains.create(values["name"]) - self.assertEqual(ref['id'], response['id']) - - def test_create_with_description_too_long(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "domain1.com.", - "email": "nsadmin@example.org", - "ttl": 60, - "description": "d" * 161} - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.assertRaises(ValueError, self.client.domains.create, - values["name"]) - - def test_create_with_zero_ttl(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "domain1.com.", - "email": "nsadmin@example.org", - "ttl": 0} - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.assertRaises(ValueError, self.client.domains.create, - values["name"]) - - def test_create_with_negative_ttl(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "domain1.com.", - "email": "nsadmin@example.org", - "ttl": -1} - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.assertRaises(ValueError, self.client.domains.create, - values["name"]) - - def test_create_with_no_ttl(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "domain1.com.", - "email": "nsadmin@example.org", - "ttl": ""} - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.assertRaises(ValueError, self.client.domains.create, - values["name"]) - - def test_create_with_name_too_long(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "domain" + "a" * 255 + ".com.", - "email": "nsadmin@example.org", - "ttl": 60} - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.assertRaises(ValueError, self.client.domains.create, - values["name"]) - - def test_list(self): - items = [ - self.new_ref(email="abc@example.org", - id="89acac79-38e7-497d-807c-a011e1310438"), - self.new_ref(email="root@example.org", - id="89acac79-38e7-497d-807c-a011e1310435") - ] - - self.stub_url("GET", parts=[self.RESOURCE], json={"domains": items}) - - listed = self.client.domains.list() - self.assertList(items, listed) - self.assertQueryStringIs("") - - def test_get(self): - ref = self.new_ref(email="abc@example.org", - id="89acac79-38e7-497d-807c-a011e1310438") - - self.stub_entity("GET", entity=ref, id=ref["id"]) - - response = self.client.domains.get(ref["id"]) - self.assertEqual(ref, response) - - def test_delete(self): - ref = self.new_ref(email="abc@example.org", - id="89acac79-38e7-497d-807c-a011e1310438") - - self.stub_entity("DELETE", entity=ref, id=ref["id"]) - - self.client.domains.delete(ref["id"]) - self.assertRequestBodyIs(None) - - def test_update(self): - ref = self.new_ref(id="89acac79-38e7-497d-807c-a011e1310438") - - self.stub_entity("PUT", entity=ref, id=ref["id"]) - - values = ref.copy() - - self.client.domains.update(Domain(values)) - - @patch.object(domains.DomainsController, "list_domain_servers") - def test_list_domain_servers(self, domains_get): - domains_get.return_value = [{"id": "foo", "name": "ns1.example.com."}] - - ref = [{ - "id": "foo", - "name": "ns1.example.com.", - }] - parts = ["domains", "foo", "servers"] - self.stub_url("GET", parts=parts, json={"servers": ref}) - - response = self.client.domains.list_domain_servers("foo") - self.assertEqual(ref, response) diff --git a/designateclient/tests/test_v1/test_quotas.py b/designateclient/tests/test_v1/test_quotas.py deleted file mode 100644 index 4e739405..00000000 --- a/designateclient/tests/test_v1/test_quotas.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 mock -from mock import patch - -from designateclient.tests import test_v1 -from designateclient.v1 import quotas - - -class TestQuota(test_v1.APIV1TestCase, test_v1.CrudMixin): - - @patch.object(quotas.QuotasController, "get") - def test_get(self, quota_get): - QUOTA = {"domains": 10, - "recordset_records": 20, - "domain_records": 500, - "domain_recordsets": 500} - quota_get.return_value = QUOTA - response = self.client.quotas.get("foo") - self.assertEqual(QUOTA, response) - - @patch.object(quotas.QuotasController, "update") - def test_update(self, quota_update): - args = mock.MagicMock() - args.tenant_id = "1234" - args.value = {"domains": 1000} - self.client.quotas.update(args.tenant_id, args.value) - self.client.quotas.update.assert_called_with(args.tenant_id, - args.value) - - @patch.object(quotas.QuotasController, "reset") - def test_reset(self, quota_reset): - args = mock.MagicMock() - args.tenant_id = "1234" - self.client.quotas.reset(args.tenant_id) - self.client.quotas.reset.assert_called_with("1234") diff --git a/designateclient/tests/test_v1/test_records.py b/designateclient/tests/test_v1/test_records.py deleted file mode 100644 index b1b54b5f..00000000 --- a/designateclient/tests/test_v1/test_records.py +++ /dev/null @@ -1,222 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 uuid - -from designateclient.tests import test_v1 -from designateclient import utils -from designateclient import warlock - - -Record = warlock.model_factory(utils.load_schema('v1', 'record')) - -DOMAIN = { - "id": str(uuid.uuid4()), - "name": "example.com." -} - - -class TestRecords(test_v1.APIV1TestCase, test_v1.CrudMixin): - RESOURCE = 'records' - - def new_ref(self, **kwargs): - ref = super(TestRecords, self).new_ref(**kwargs) - ref.setdefault("name", uuid.uuid4().hex) - ref.setdefault("type", "A") - ref.setdefault("data", "10.0.0.1") - return ref - - def test_create_record(self): - ref = self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_AAAA_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778888", - type="AAAA", - data="2001:db8:0:1234:0:5678:9:12") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_MX_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778989", - type="MX", - data="mail.example.com.", - priority=10) - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_CNAME_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778890", - type="CNAME", - data="example.com.") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_TXT_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778889", - type="TXT", - data="This is a TXT record") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_SRV_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778888", - type="SRV", - data="0 5060 sip.example.com.", - priority=30) - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_NS_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677779999", - type="NS", - data="ns1.example.com.") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_PTR_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778891", - type="PTR", - data="www.example.com.") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_SPF_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778899", - type="SPF", - data="v=spf1 +mx a:colo.example.com/28 -all") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_create_SSHFP_record(self): - ref = self.new_ref(id="11112222-3333-4444-5555-666677778888", - type="SSHFP", - data="2 1 6c3c958af43d953f91f40e0d84157f4fe7b4a898") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("POST", parts=parts, json=ref) - - values = ref.copy() - del values["id"] - - self.client.records.create(DOMAIN['id'], Record(values)) - self.assertRequestBodyIs(json=values) - - def test_get(self): - ref = self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_entity("GET", entity=ref, id=ref["id"], parts=parts) - - response = self.client.records.get(DOMAIN["id"], ref["id"]) - self.assertEqual(ref, response) - - def test_list(self): - items = [ - self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad"), - self.new_ref(id="11112222-3333-4444-5555-666677778888") - ] - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_url("GET", parts=parts, json={"records": items}) - - listed = self.client.records.list(DOMAIN["id"]) - self.assertList(items, listed) - self.assertQueryStringIs("") - - def test_update(self): - ref = self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad", - type="A", - data="192.0.2.5") - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_entity("PUT", entity=ref, id=ref["id"], parts=parts) - - values = ref.copy() - del values["id"] - - self.client.records.update(DOMAIN["id"], Record(ref)) - - def test_delete(self): - ref = self.new_ref() - - parts = ["domains", DOMAIN["id"], self.RESOURCE] - self.stub_entity("DELETE", id=ref["id"], parts=parts) - - self.client.records.delete(DOMAIN["id"], ref["id"]) - self.assertRequestBodyIs(None) diff --git a/designateclient/tests/test_v1/test_reports.py b/designateclient/tests/test_v1/test_reports.py deleted file mode 100644 index 0edd1543..00000000 --- a/designateclient/tests/test_v1/test_reports.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 mock -from mock import patch - -from designateclient.tests import test_v1 -from designateclient.v1 import reports - - -class TestReports(test_v1.APIV1TestCase, test_v1.CrudMixin): - - @patch.object(reports.ReportsController, "count_all") - def test_count_all(self, count_all): - self.client.reports.count_all() - self.client.reports.count_all.assert_called_with() - - @patch.object(reports.ReportsController, "count_domains") - def test_count_domain(self, count_domains): - self.client.reports.count_domains() - self.client.reports.count_domains.assert_called_once_with() - - @patch.object(reports.ReportsController, "count_tenants") - def test_count_tenants(self, count_tenants): - self.client.reports.count_tenants() - self.client.reports.count_tenants.assert_called_once_with() - - @patch.object(reports.ReportsController, "count_records") - def test_count_records(self, count_records): - self.client.reports.count_records() - self.client.reports.count_records.assert_called_once_with() - - @patch.object(reports.ReportsController, "tenants_all") - def test_tenants_all(self, tenants_all): - self.client.reports.tenants_all() - self.client.reports.tenants_all.assert_called_once_with() - - @patch.object(reports.ReportsController, "tenant_domains") - def test_tenant_domains(self, tenant_domains): - args = mock.MagicMock() - args.other_tenant_id = "uuid" - self.client.reports.tenant_domains(args.other_tenant_id) - self.client.reports.tenant_domains.assert_called_once_with("uuid") diff --git a/designateclient/tests/test_v1/test_servers.py b/designateclient/tests/test_v1/test_servers.py deleted file mode 100644 index b8fa653b..00000000 --- a/designateclient/tests/test_v1/test_servers.py +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 uuid - -import mock -from mock import patch - -from designateclient.tests import test_v1 -from designateclient.v1 import servers - - -class TestServers(test_v1.APIV1TestCase, test_v1.CrudMixin): - RESOURCE = 'servers' - - def new_ref(self, **kwargs): - ref = super(TestServers, self).new_ref(**kwargs) - ref.setdefault("name", uuid.uuid4().hex) - return ref - - def test_list(self): - items = [ - self.new_ref(name="ns1.example.org.", - id="89acac79-38e7-497d-807c-a011e1310438"), - self.new_ref(name="ns2.example.org.", - id="89acac79-38e7-497d-807c-a011e1310435") - ] - - self.stub_url("GET", parts=[self.RESOURCE], json={"servers": items}) - - listed = self.client.servers.list() - self.assertList(items, listed) - self.assertQueryStringIs("") - - def test_get(self): - ref = self.new_ref(name="ns1.example.org.", - id="89acac79-38e7-497d-807c-a011e1310438") - - self.stub_entity("GET", entity=ref, id=ref["id"]) - - response = self.client.servers.get(ref["id"]) - self.assertEqual(ref, response) - - def test_create(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "ns1.example.org."} - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.servers.create({"name": "ns1.example.org."}) - self.assertRequestBodyIs(json=values) - - def test_create_with_name_too_long(self): - ref = {"id": "89acac79-38e7-497d-807c-a011e1310438", - "name": "ns1." + "foo" * 85 + ".org."} - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.assertRaises(ValueError, self.client.servers.create, - {"name": "ns1.example.org."}) - - @patch.object(servers.ServersController, "update") - def test_update(self, server_update): - ref = self.new_ref() - - self.stub_entity("PUT", entity=ref, id=ref["id"]) - - mock_server = mock.MagicMock() - self.client.servers.update(mock_server) - self.client.servers.update.assert_called_with(mock_server) - - def test_delete(self): - ref = self.new_ref() - - self.stub_entity("DELETE", id=ref["id"]) - - self.client.servers.delete(ref["id"]) - self.assertRequestBodyIs(None) diff --git a/designateclient/tests/test_v1/test_sync.py b/designateclient/tests/test_v1/test_sync.py deleted file mode 100644 index 88ad5d1e..00000000 --- a/designateclient/tests/test_v1/test_sync.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 mock -from mock import patch - -from designateclient.tests import test_v1 -from designateclient.v1 import sync - - -class TestSync(test_v1.APIV1TestCase, test_v1.CrudMixin): - - @patch.object(sync.SyncController, "sync_all") - def test_sync_all(self, sync_all): - self.client.sync.sync_all() - self.client.sync.sync_all.assert_called_with() - - @patch.object(sync.SyncController, "sync_domain") - def test_sync_domain(self, sync_domain): - args = mock.MagicMock() - args.tenant_id = "1234" - self.client.sync.sync_domain(args.tenant_id) - self.client.sync.sync_domain.assert_called_with("1234") - - @patch.object(sync.SyncController, "sync_record") - def test_sync_record(self, sync_record): - args = mock.MagicMock() - args.tenant_id = "1234" - args.record_id = "uuid" - self.client.sync.sync_record(args.tenant_id, args.record_id) - self.client.sync.sync_record.assert_called_with("1234", "uuid") diff --git a/designateclient/tests/test_v1/test_touch.py b/designateclient/tests/test_v1/test_touch.py deleted file mode 100644 index 5c944b03..00000000 --- a/designateclient/tests/test_v1/test_touch.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2015 NEC Corporation. All rights reserved. -# -# 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 mock -from mock import patch - -from designateclient.tests import test_v1 -from designateclient.v1 import touch - - -class TestTouch(test_v1.APIV1TestCase, test_v1.CrudMixin): - - @patch.object(touch.TouchController, "domain") - def test_domain(self, domain): - args = mock.MagicMock() - args.domain_id = "1234" - self.client.touch.domain(args.domain_id) - self.client.touch.domain.assert_called_with("1234") diff --git a/designateclient/utils.py b/designateclient/utils.py index d526fd86..cf1ddcea 100644 --- a/designateclient/utils.py +++ b/designateclient/utils.py @@ -14,47 +14,18 @@ # License for the specific language governing permissions and limitations # under the License. -import os import uuid -from oslo_serialization import jsonutils - from debtcollector import removals from keystoneauth1 import adapter from keystoneauth1.identity import generic from keystoneauth1 import session as ks_session from keystoneauth1 import token_endpoint -import pkg_resources import six from designateclient import exceptions -def resource_string(*args, **kwargs): - if len(args) == 0: - raise ValueError() - - package = kwargs.pop('package', None) - - if not package: - package = 'designateclient' - - resource_path = os.path.join('resources', *args) - - if not pkg_resources.resource_exists(package, resource_path): - raise exceptions.ResourceNotFound('Could not find the requested ' - 'resource: %s' % resource_path) - - return pkg_resources.resource_string(package, resource_path) - - -def load_schema(version, name, package=None): - schema_string = resource_string('schemas', version, '%s.json' % name, - package=package) - - return jsonutils.loads(schema_string) - - def get_item_properties(item, fields, mixed_case_fields=[], formatters={}): """Return a tuple containing the item properties. diff --git a/designateclient/v1/__init__.py b/designateclient/v1/__init__.py deleted file mode 100644 index 2474a4e5..00000000 --- a/designateclient/v1/__init__.py +++ /dev/null @@ -1,161 +0,0 @@ -# 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. -from debtcollector import removals -from stevedore import extension - -from designateclient import exceptions -from designateclient import utils -from designateclient import version - - -@removals.removed_class( - 'designateclient.v1.Client', - replacement='designateclient.v2.client.Client', - message='Designate v1 API is being retired, and the v1 Client class will ' - 'stop functioning. Please update code to the ' - 'designateclient.v2.client.Client class. The API is deprecated', - version='2.2.0', - removal_version='?', - stacklevel=3) -class Client(object): - """Client for the Designate v1 API""" - - def __init__(self, endpoint=None, username=None, user_id=None, - user_domain_id=None, user_domain_name=None, password=None, - tenant_name=None, tenant_id=None, domain_name=None, - domain_id=None, project_name=None, - project_id=None, project_domain_name=None, - project_domain_id=None, auth_url=None, token=None, - endpoint_type='publicURL', region_name=None, - service_type='dns', insecure=False, session=None, - cacert=None, all_tenants=None, edit_managed=None, - timeout=None): - """ - :param endpoint: Endpoint URL - :param token: A token instead of username / password - :param insecure: Allow "insecure" HTTPS requests - """ - - if endpoint: - endpoint = endpoint.rstrip('/') - if not endpoint.endswith('v1'): - endpoint = "%s/v1" % endpoint - - # Compatibility code to mimic the old behaviour of the client - if session is None: - session = utils.get_session( - auth_url=auth_url, - endpoint=endpoint, - domain_id=domain_id, - domain_name=domain_name, - project_id=project_id or tenant_id, - project_name=project_name or tenant_name, - project_domain_name=project_domain_name, - project_domain_id=project_domain_id, - username=username, - user_id=user_id, - password=password, - user_domain_id=user_domain_id, - user_domain_name=user_domain_name, - token=token, - insecure=insecure, - cacert=cacert, - ) - - # NOTE: all_tenants and edit_managed are pulled from the session for - # backwards compat reasons, do not pull additional modifiers from - # here. Once removed, the kwargs above should default to False. - if all_tenants is None: - self.all_tenants = getattr(session, 'all_tenants', False) - else: - self.all_tenants = all_tenants - - if edit_managed is None: - self.edit_managed = getattr(session, 'edit_managed', False) - else: - self.edit_managed = edit_managed - - # Since we have to behave nicely like a legacy client/bindings we use - # an adapter around the session to not modify it's state. - interface = endpoint_type.rstrip('URL') - - self.session = utils.AdapterWithTimeout( - session, - auth=session.auth, - endpoint_override=endpoint, - region_name=region_name, - service_type=service_type, - interface=interface, - user_agent='python-designateclient-%s' % version.version_info, - version='1', - timeout=timeout, - ) - - def _load_controller(ext): - controller = ext.plugin(client=self) - setattr(self, ext.name, controller) - - # Load all controllers - mgr = extension.ExtensionManager('designateclient.v1.controllers') - mgr.map(_load_controller) - - def wrap_api_call(self, func, *args, **kw): - """ - Wrap a self. with exception handling - - :param func: The function to wrap - """ - kw['raise_exc'] = False - kw.setdefault('headers', {}) - kw['headers'].setdefault('Content-Type', 'application/json') - if self.all_tenants: - kw['headers'].update({'X-Auth-All-Projects': 'true'}) - if self.edit_managed: - kw['headers'].update({'X-Designate-Edit-Managed-Records': 'true'}) - - # Trigger the request - response = func(*args, **kw) - - # Decode is response, if possible - try: - response_payload = response.json() - except ValueError: - response_payload = {} - - if response.status_code == 400: - raise exceptions.BadRequest(**response_payload) - elif response.status_code in (401, 403, 413): - raise exceptions.Forbidden(**response_payload) - elif response.status_code == 404: - raise exceptions.NotFound(**response_payload) - elif response.status_code == 409: - raise exceptions.Conflict(**response_payload) - elif response.status_code >= 500: - raise exceptions.Unknown(**response_payload) - else: - return response - - def get(self, path, **kw): - return self.wrap_api_call(self.session.get, path, **kw) - - def post(self, path, **kw): - return self.wrap_api_call(self.session.post, path, **kw) - - def put(self, path, **kw): - return self.wrap_api_call(self.session.put, path, **kw) - - def delete(self, path, **kw): - return self.wrap_api_call(self.session.delete, path, **kw) diff --git a/designateclient/v1/diagnostics.py b/designateclient/v1/diagnostics.py deleted file mode 100644 index d2e51539..00000000 --- a/designateclient/v1/diagnostics.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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. -from designateclient import client - - -class DiagnosticsController(client.Controller): - def ping(self, service, host): - """ - Ping a service on a given host - """ - response = self.client.get('/diagnostics/ping/%s/%s' % - (service, host)) - - return response.json() diff --git a/designateclient/v1/domains.py b/designateclient/v1/domains.py deleted file mode 100644 index 1430bbf3..00000000 --- a/designateclient/v1/domains.py +++ /dev/null @@ -1,93 +0,0 @@ -# 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. - -from oslo_serialization import jsonutils - -from designateclient import client -from designateclient import utils -from designateclient import warlock - - -Domain = warlock.model_factory(utils.load_schema('v1', 'domain')) -Server = warlock.model_factory(utils.load_schema('v1', 'server')) - - -class DomainsController(client.CrudController): - def list(self): - """ - Retrieve a list of domains - - :returns: A list of :class:`Domain` - """ - response = self.client.get('/domains') - - return [Domain(i) for i in response.json()['domains']] - - def get(self, domain_id): - """ - Retrieve a domain - - :param domain_id: Domain Identifier - :returns: :class:`Domain` - """ - response = self.client.get('/domains/%s' % domain_id) - - return Domain(response.json()) - - def create(self, domain): - """ - Create a domain - - :param domain: A :class:`Domain` to create - :returns: :class:`Domain` - """ - response = self.client.post('/domains', data=jsonutils.dumps(domain)) - - return Domain(response.json()) - - def update(self, domain): - """ - Update a domain - - :param domain: A :class:`Domain` to update - :returns: :class:`Domain` - """ - response = self.client.put('/domains/%s' % domain.id, - data=jsonutils.dumps(domain.changes)) - - return Domain(response.json()) - - def delete(self, domain): - """ - Delete a domain - - :param domain: A :class:`Domain`, or Domain Identifier to delete - """ - if isinstance(domain, Domain): - self.client.delete('/domains/%s' % domain.id) - else: - 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` - """ - response = self.client.get('/domains/%s/servers' % domain_id) - - return [Server(i) for i in response.json()['servers']] diff --git a/designateclient/v1/quotas.py b/designateclient/v1/quotas.py deleted file mode 100644 index 432edf28..00000000 --- a/designateclient/v1/quotas.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2014 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# 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 oslo_serialization import jsonutils - -from designateclient import client - - -class QuotasController(client.Controller): - def get(self, tenant_id): - """ - Ping a service on a given host - """ - response = self.client.get('/quotas/%s' % tenant_id) - - return response.json() - - def update(self, tenant_id, values): - response = self.client.put('/quotas/%s' % tenant_id, - data=jsonutils.dumps(values)) - return response.json() - - def reset(self, tenant_id): - response = self.client.delete('/quotas/%s' % tenant_id) - - return response diff --git a/designateclient/v1/records.py b/designateclient/v1/records.py deleted file mode 100644 index c239e126..00000000 --- a/designateclient/v1/records.py +++ /dev/null @@ -1,115 +0,0 @@ -# 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. - -from oslo_serialization import jsonutils - -from designateclient import client -from designateclient import utils -from designateclient.v1.domains import Domain -from designateclient import warlock - - -Record = warlock.model_factory(utils.load_schema('v1', 'record')) - - -class RecordsController(client.CrudController): - def list(self, domain): - """ - Retrieve a list of records - - :param domain: :class:`Domain` or Domain Identifier - :returns: A list of :class:`Record` - """ - domain_id = domain.id if isinstance(domain, Domain) else domain - - response = self.client.get('/domains/%(domain_id)s/records' % { - 'domain_id': domain_id - }) - - return [Record(i) for i in response.json()['records']] - - def get(self, domain, record_id): - """ - Retrieve a record - - :param domain: :class:`Domain` or Domain Identifier - :param record_id: Record Identifier - :returns: :class:`Record` - """ - domain_id = domain.id if isinstance(domain, Domain) else domain - - uri = '/domains/%(domain_id)s/records/%(record_id)s' % { - 'domain_id': domain_id, - 'record_id': record_id - } - - response = self.client.get(uri) - - return Record(response.json()) - - def create(self, domain, record): - """ - Create a record - - :param domain: :class:`Domain` or Domain Identifier - :param record: A :class:`Record` to create - :returns: :class:`Record` - """ - domain_id = domain.id if isinstance(domain, Domain) else domain - - uri = '/domains/%(domain_id)s/records' % { - 'domain_id': domain_id - } - - response = self.client.post(uri, data=jsonutils.dumps(record)) - - return Record(response.json()) - - def update(self, domain, record): - """ - Update a record - - :param domain: :class:`Domain` or Domain Identifier - :param record: A :class:`Record` to update - :returns: :class:`Record` - """ - domain_id = domain.id if isinstance(domain, Domain) else domain - - uri = '/domains/%(domain_id)s/records/%(record_id)s' % { - 'domain_id': domain_id, - 'record_id': record.id - } - - response = self.client.put(uri, data=jsonutils.dumps(record.changes)) - - return Record(response.json()) - - def delete(self, domain, record): - """ - Delete a record - - :param domain: :class:`Domain` or Domain Identifier - :param record: A :class:`Record`, or Record Identifier to delete - """ - domain_id = domain.id if isinstance(domain, Domain) else domain - record_id = record.id if isinstance(record, Record) else record - - uri = '/domains/%(domain_id)s/records/%(record_id)s' % { - 'domain_id': domain_id, - 'record_id': record_id - } - - self.client.delete(uri) diff --git a/designateclient/v1/reports.py b/designateclient/v1/reports.py deleted file mode 100644 index 4a32c6c8..00000000 --- a/designateclient/v1/reports.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2013 Hewlett-Packard Development Company, L.P. All Rights Reserved. -# -# Author: Patrick Galbraith -# -# 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 import client - - -class ReportsController(client.Controller): - def count_all(self): - """ - Domain, Records and tenant total count - """ - response = self.client.get('/reports/counts') - - return response.json() - - def count_domains(self): - """ - Domain total count - """ - response = self.client.get('/reports/counts/domains') - - return response.json() - - def count_tenants(self): - """ - Tenant total count - """ - response = self.client.get('/reports/counts/tenants') - - return response.json() - - def count_records(self): - """ - Record total count - """ - response = self.client.get('/reports/counts/records') - - return response.json() - - def tenants_all(self): - """ - Per tenant count - """ - response = self.client.get('/reports/tenants') - - return response.json()['tenants'] - - def tenant_domains(self, other_tenant_id): - """ - Tenant's domain count - """ - response = self.client.get('/reports/tenants/%s' % - other_tenant_id) - - return [{'domain': d} for d in response.json()['domains']] diff --git a/designateclient/v1/servers.py b/designateclient/v1/servers.py deleted file mode 100644 index 34dcca67..00000000 --- a/designateclient/v1/servers.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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. - -from oslo_serialization import jsonutils - -from designateclient import client -from designateclient import utils -from designateclient import warlock - - -Server = warlock.model_factory(utils.load_schema('v1', 'server')) - - -class ServersController(client.CrudController): - def list(self): - """ - Retrieve a list of servers - - :returns: A list of :class:`Server` - """ - response = self.client.get('/servers') - - return [Server(i) for i in response.json()['servers']] - - def get(self, server_id): - """ - Retrieve a server - - :param server_id: Server Identifier - :returns: :class:`Server` - """ - response = self.client.get('/servers/%s' % server_id) - - return Server(response.json()) - - def create(self, server): - """ - Create a server - - :param server: A :class:`Server` to create - :returns: :class:`Server` - """ - response = self.client.post('/servers', data=jsonutils.dumps(server)) - - return Server(response.json()) - - def update(self, server): - """ - Update a server - - :param server: A :class:`Server` to update - :returns: :class:`Server` - """ - response = self.client.put('/servers/%s' % server.id, - data=jsonutils.dumps(server.changes)) - - return Server(response.json()) - - def delete(self, server): - """ - Delete a server - - :param server: A :class:`Server`, or Server Identifier to delete - """ - if isinstance(server, Server): - self.client.delete('/servers/%s' % server.id) - else: - self.client.delete('/servers/%s' % server) diff --git a/designateclient/v1/sync.py b/designateclient/v1/sync.py deleted file mode 100644 index f86e6426..00000000 --- a/designateclient/v1/sync.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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. -from designateclient import client - - -class SyncController(client.Controller): - def sync_all(self): - """ - Sync Everything - """ - self.client.post('/domains/sync') - - def sync_domain(self, domain_id): - """ - Sync Single Domain - """ - self.client.post('/domains/%s/sync' % domain_id) - - def sync_record(self, domain_id, record_id): - """ - Sync Single Record - """ - self.client.post('/domains/%s/records/%s/sync' % - (domain_id, record_id)) diff --git a/designateclient/v1/touch.py b/designateclient/v1/touch.py deleted file mode 100644 index bbbdbd2f..00000000 --- a/designateclient/v1/touch.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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 import client - - -class TouchController(client.Controller): - def domain(self, domain_id): - """ - Touch a single Domain - """ - self.client.post('/domains/%s/touch' % domain_id) diff --git a/doc/examples/recordset_create.py b/doc/examples/recordset_create.py index 1bad60f4..4be7c4dd 100644 --- a/doc/examples/recordset_create.py +++ b/doc/examples/recordset_create.py @@ -1,9 +1,9 @@ from __future__ import print_function import logging +import os from designateclient.v2 import client from designateclient import exceptions -from designateclient import shell from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session @@ -17,10 +17,10 @@ Example script to create or get a domain and add some records to it. auth = generic.Password( - auth_url=shell.env('OS_AUTH_URL'), - username=shell.env('OS_USERNAME'), - password=shell.env('OS_PASSWORD'), - project_name=shell.env('OS_PROJECT_NAME'), + auth_url=os.environ.get('OS_AUTH_URL'), + username=os.environ.get('OS_USERNAME'), + password=os.environ.get('OS_PASSWORD'), + project_name=os.environ.get('OS_PROJECT_NAME'), project_domain_id='default', user_domain_id='default') diff --git a/doc/examples/recordset_crud.py b/doc/examples/recordset_crud.py index f00e41e2..6b09197d 100644 --- a/doc/examples/recordset_crud.py +++ b/doc/examples/recordset_crud.py @@ -1,8 +1,8 @@ import logging +import os from designateclient.v2 import client from designateclient import exceptions -from designateclient import shell from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session @@ -11,10 +11,10 @@ from keystoneauth1 import session as keystone_session logging.basicConfig(level='DEBUG') auth = generic.Password( - auth_url=shell.env('OS_AUTH_URL'), - username=shell.env('OS_USERNAME'), - password=shell.env('OS_PASSWORD'), - project_name=shell.env('OS_PROJECT_NAME'), + auth_url=os.environ.get('OS_AUTH_URL'), + username=os.environ.get('OS_USERNAME'), + password=os.environ.get('OS_PASSWORD'), + project_name=os.environ.get('OS_PROJECT_NAME'), project_domain_id='default', user_domain_id='default') diff --git a/doc/examples/zone_create_primary.py b/doc/examples/zone_create_primary.py index 91d822c5..2ebc404a 100644 --- a/doc/examples/zone_create_primary.py +++ b/doc/examples/zone_create_primary.py @@ -1,9 +1,9 @@ from __future__ import print_function import logging +import os from designateclient import exceptions -from designateclient import shell from designateclient.v2 import client from keystoneauth1.identity import generic @@ -13,10 +13,10 @@ from keystoneauth1 import session as keystone_session logging.basicConfig(level='DEBUG') auth = generic.Password( - auth_url=shell.env('OS_AUTH_URL'), - username=shell.env('OS_USERNAME'), - password=shell.env('OS_PASSWORD'), - project_name=shell.env('OS_PROJECT_NAME'), + auth_url=os.environ.get('OS_AUTH_URL'), + username=os.environ.get('OS_USERNAME'), + password=os.environ.get('OS_PASSWORD'), + project_name=os.environ.get('OS_PROJECT_NAME'), project_domain_id='default', user_domain_id='default') diff --git a/doc/examples/zone_create_secondary.py b/doc/examples/zone_create_secondary.py index 876d1ba9..febbe906 100644 --- a/doc/examples/zone_create_secondary.py +++ b/doc/examples/zone_create_secondary.py @@ -1,21 +1,20 @@ import logging +import os import uuid from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session -from designateclient import exceptions -from designateclient import shell from designateclient.v2 import client logging.basicConfig(level='DEBUG') auth = generic.Password( - auth_url=shell.env('OS_AUTH_URL'), - username=shell.env('OS_USERNAME'), - password=shell.env('OS_PASSWORD'), - project_name=shell.env('OS_PROJECT_NAME'), + auth_url=os.environ.get('OS_AUTH_URL'), + username=os.environ.get('OS_USERNAME'), + password=os.environ.get('OS_PASSWORD'), + project_name=os.environ.get('OS_PROJECT_NAME'), project_domain_id='default', user_domain_id='default') diff --git a/doc/examples/zone_list_nameservers.py b/doc/examples/zone_list_nameservers.py index 1ee4f8e7..b1136e7e 100644 --- a/doc/examples/zone_list_nameservers.py +++ b/doc/examples/zone_list_nameservers.py @@ -1,9 +1,8 @@ import logging +import os import uuid from designateclient.v2 import client -from designateclient import shell -from designateclient import utils from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session @@ -12,10 +11,10 @@ from keystoneauth1 import session as keystone_session logging.basicConfig(level='DEBUG') auth = generic.Password( - auth_url=shell.env('OS_AUTH_URL'), - username=shell.env('OS_USERNAME'), - password=shell.env('OS_PASSWORD'), - project_name=shell.env('OS_PROJECT_NAME'), + auth_url=os.environ.get('OS_AUTH_URL'), + username=os.environ.get('OS_USERNAME'), + password=os.environ.get('OS_PASSWORD'), + project_name=os.environ.get('OS_PROJECT_NAME'), project_domain_id='default', user_domain_id='default') diff --git a/doc/examples/zone_list_paging.py b/doc/examples/zone_list_paging.py index f62f6d90..e16227ba 100644 --- a/doc/examples/zone_list_paging.py +++ b/doc/examples/zone_list_paging.py @@ -1,19 +1,19 @@ from __future__ import print_function import logging +import os from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session -from designateclient import shell from designateclient.v2 import client logging.basicConfig(level='DEBUG') auth = generic.Password( - auth_url=shell.env('OS_AUTH_URL'), - username=shell.env('OS_USERNAME'), - password=shell.env('OS_PASSWORD'), - project_name=shell.env('OS_PROJECT_NAME'), + auth_url=os.environ.get('OS_AUTH_URL'), + username=os.environ.get('OS_USERNAME'), + password=os.environ.get('OS_PASSWORD'), + project_name=os.environ.get('OS_PROJECT_NAME'), project_domain_id='default', user_domain_id='default') diff --git a/doc/requirements.txt b/doc/requirements.txt index 68773f5b..fea43a05 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -3,4 +3,5 @@ # process, which may cause wedges in the gate later. sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD +reno>=2.7.0 # Apache-2.0 openstackdocstheme>=1.18.1 # Apache-2.0 diff --git a/doc/source/cli/index.rst b/doc/source/cli/index.rst deleted file mode 100644 index 9a925ed5..00000000 --- a/doc/source/cli/index.rst +++ /dev/null @@ -1,958 +0,0 @@ -.. ################################################### -.. ## WARNING ###################################### -.. ############## WARNING ########################## -.. ########################## WARNING ############## -.. ###################################### WARNING ## -.. ################################################### -.. ################################################### -.. ## -.. This file is tool-generated. Do not edit manually. -.. http://docs.openstack.org/contributor-guide/ -.. doc-tools/cli-reference.html -.. ## -.. ## WARNING ###################################### -.. ############## WARNING ########################## -.. ########################## WARNING ############## -.. ###################################### WARNING ## -.. ################################################### - -=========================================== -DNS service (designate) command-line client -=========================================== - -The designate client is the command-line interface (CLI) for -the DNS service (designate) API and its extensions. - -This chapter documents :command:`designate` version ``2.6.0``. - -For help on a specific :command:`designate` command, enter: - -.. code-block:: console - - $ designate help COMMAND - -.. _designate_command_usage: - -designate usage -~~~~~~~~~~~~~~~ - -.. code-block:: console - - usage: designate [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug] - [--os-username OS_USERNAME] [--os-user-id OS_USER_ID] - [--os-user-domain-id OS_USER_DOMAIN_ID] - [--os-user-domain-name OS_USER_DOMAIN_NAME] - [--os-password OS_PASSWORD] [--os-tenant-name OS_TENANT_NAME] - [--os-tenant-id OS_TENANT_ID] - [--os-project-name OS_PROJECT_NAME] - [--os-domain-name OS_DOMAIN_NAME] - [--os-domain-id OS_DOMAIN_ID] [--os-project-id OS_PROJECT_ID] - [--os-project-domain-id OS_PROJECT_DOMAIN_ID] - [--os-project-domain-name OS_PROJECT_DOMAIN_NAME] - [--os-auth-url OS_AUTH_URL] [--os-region-name OS_REGION_NAME] - [--os-token OS_TOKEN] [--os-endpoint OS_ENDPOINT] - [--os-endpoint-type OS_ENDPOINT_TYPE] - [--os-service-type OS_SERVICE_TYPE] [--os-cacert OS_CACERT] - [--insecure] [--all-tenants] [--edit-managed] - -.. _designate_command_options: - -designate optional arguments -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``--version`` - show program's version number and exit - -``-v, --verbose`` - Increase verbosity of output. Can be repeated. - -``-q, --quiet`` - Suppress output except warnings and errors. - -``--log-file LOG_FILE`` - Specify a file to log output. Disabled by default. - -``-h, --help`` - Show help message and exit. - -``--debug`` - Show tracebacks on errors. - -``--os-username OS_USERNAME`` - Name used for authentication with the OpenStack - Identity service. Defaults to ``env[OS_USERNAME]``. - -``--os-user-id OS_USER_ID`` - User ID used for authentication with the OpenStack - Identity service. Defaults to ``env[OS_USER_ID]``. - -``--os-user-domain-id OS_USER_DOMAIN_ID`` - Defaults to ``env[OS_USER_DOMAIN_ID]``. - -``--os-user-domain-name OS_USER_DOMAIN_NAME`` - Defaults to ``env[OS_USER_DOMAIN_NAME]``. - -``--os-password OS_PASSWORD`` - Password used for authentication with the OpenStack - Identity service. Defaults to ``env[OS_PASSWORD]``. - -``--os-tenant-name OS_TENANT_NAME`` - Tenant to request authorization on. Defaults to - ``env[OS_TENANT_NAME]``. - -``--os-tenant-id OS_TENANT_ID`` - Tenant to request authorization on. Defaults to - ``env[OS_TENANT_ID]``. - -``--os-project-name OS_PROJECT_NAME`` - Project to request authorization on. Defaults to - ``env[OS_PROJECT_NAME]``. - -``--os-domain-name OS_DOMAIN_NAME`` - Project to request authorization on. Defaults to - ``env[OS_DOMAIN_NAME]``. - -``--os-domain-id OS_DOMAIN_ID`` - Defaults to ``env[OS_DOMAIN_ID]``. - -``--os-project-id OS_PROJECT_ID`` - Project to request authorization on. Defaults to - ``env[OS_PROJECT_ID]``. - -``--os-project-domain-id OS_PROJECT_DOMAIN_ID`` - Defaults to ``env[OS_PROJECT_DOMAIN_ID]``. - -``--os-project-domain-name OS_PROJECT_DOMAIN_NAME`` - Defaults to ``env[OS_PROJECT_DOMAIN_NAME]``. - -``--os-auth-url OS_AUTH_URL`` - Specify the Identity endpoint to use for - authentication. Defaults to ``env[OS_AUTH_URL]``. - -``--os-region-name OS_REGION_NAME`` - Specify the region to use. Defaults to - ``env[OS_REGION_NAME]``. - -``--os-token OS_TOKEN`` - Specify an existing token to use instead of retrieving - one via authentication (e.g. with username & - password). Defaults to ``env[OS_SERVICE_TOKEN]``. - -``--os-endpoint OS_ENDPOINT`` - Specify an endpoint to use instead of retrieving one - from the service catalog (via authentication). - Defaults to ``env[OS_DNS_ENDPOINT]``. - -``--os-endpoint-type OS_ENDPOINT_TYPE`` - Defaults to ``env[OS_ENDPOINT_TYPE]``. - -``--os-service-type OS_SERVICE_TYPE`` - Defaults to ``env[OS_DNS_SERVICE_TYPE]``, or 'dns'. - -``--os-cacert OS_CACERT`` - CA certificate bundle file. Defaults to - ``env[OS_CACERT]``. - -``--insecure`` - Explicitly allow 'insecure' SSL requests. - -``--all-tenants`` - Allows to list all domains from all tenants. - -``--edit-managed`` - Allows to edit records that are marked as managed. - -.. _designate_diagnostics-ping: - -designate diagnostics-ping --------------------------- - -.. code-block:: console - - usage: designate diagnostics-ping [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--prefix PREFIX] --service SERVICE --host - HOST - -Ping a service on a given host - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--service SERVICE`` - Service name (e.g. central) - -``--host HOST`` - Hostname - -.. _designate_domain-create: - -designate domain-create ------------------------ - -.. code-block:: console - - usage: designate domain-create [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - --name NAME --email EMAIL [--ttl TTL] - [--description DESCRIPTION] - -Create Domain - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--name NAME`` - Domain name. - -``--email EMAIL`` - Domain email. - -``--ttl TTL`` - Time to live (seconds). - -``--description DESCRIPTION`` - Description. - -.. _designate_domain-delete: - -designate domain-delete ------------------------ - -.. code-block:: console - - usage: designate domain-delete [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - id - -Delete Domain - -**Positional arguments:** - -``id`` - Domain ID or name. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_domain-get: - -designate domain-get --------------------- - -.. code-block:: console - - usage: designate domain-get [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - id - -Get Domain - -**Positional arguments:** - -``id`` - Domain ID or name. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_domain-list: - -designate domain-list ---------------------- - -.. code-block:: console - - usage: designate domain-list [-h] [-f {csv,html,json,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--quote {all,minimal,none,nonnumeric}] - -List Domains - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_domain-servers-list: - -designate domain-servers-list ------------------------------ - -.. code-block:: console - - usage: designate domain-servers-list [-h] - [-f {csv,html,json,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--quote {all,minimal,none,nonnumeric}] - id - -List Domain Servers - -**Positional arguments:** - -``id`` - Domain ID or name. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_domain-update: - -designate domain-update ------------------------ - -.. code-block:: console - - usage: designate domain-update [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - [--name NAME] [--email EMAIL] [--ttl TTL] - [--description DESCRIPTION | --no-description] - id - -Update Domain - -**Positional arguments:** - -``id`` - Domain ID or name. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--name NAME`` - Domain name. - -``--email EMAIL`` - Domain email. - -``--ttl TTL`` - Time to live (seconds). - -``--description DESCRIPTION`` - Description. - -``--no-description`` - -.. _designate_quota-get: - -designate quota-get -------------------- - -.. code-block:: console - - usage: designate quota-get [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] [--print-empty] - [--noindent] [--prefix PREFIX] - tenant_id - -Get Quota - -**Positional arguments:** - -``tenant_id`` - Tenant ID - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_quota-reset: - -designate quota-reset ---------------------- - -.. code-block:: console - - usage: designate quota-reset [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - tenant_id - -Reset Quota - -**Positional arguments:** - -``tenant_id`` - Tenant ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_quota-update: - -designate quota-update ----------------------- - -.. code-block:: console - - usage: designate quota-update [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - [--domains DOMAINS] - [--domain-recordsets DOMAIN_RECORDSETS] - [--recordset-records RECORDSET_RECORDS] - [--domain-records DOMAIN_RECORDS] - [--api-export-size API_EXPORT_SIZE] - tenant_id - -Update Quota - -**Positional arguments:** - -``tenant_id`` - Tenant ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--domains DOMAINS`` - Allowed domains. - -``--domain-recordsets DOMAIN_RECORDSETS`` - Allowed domain records. - -``--recordset-records RECORDSET_RECORDS`` - Allowed recordset records. - -``--domain-records DOMAIN_RECORDS`` - Allowed domain records. - -``--api-export-size API_EXPORT_SIZE`` - Allowed zone export recordsets. - -.. _designate_record-create: - -designate record-create ------------------------ - -.. code-block:: console - - usage: designate record-create [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - --name NAME --type TYPE --data DATA [--ttl TTL] - [--priority PRIORITY] - [--description DESCRIPTION] - domain_id - -Create Record - -**Positional arguments:** - -``domain_id`` - Domain ID or name. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--name NAME`` - Record (relative|absolute) name. - -``--type TYPE`` - Record type. - -``--data DATA`` - Record data. - -``--ttl TTL`` - Record TTL. - -``--priority PRIORITY`` - Record priority. - -``--description DESCRIPTION`` - Description. - -.. _designate_record-delete: - -designate record-delete ------------------------ - -.. code-block:: console - - usage: designate record-delete [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - domain_id id - -Delete Record - -**Positional arguments:** - -``domain_id`` - Domain ID or name. - -``id`` - Record ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_record-get: - -designate record-get --------------------- - -.. code-block:: console - - usage: designate record-get [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - domain_id id - -Get Record - -**Positional arguments:** - -``domain_id`` - Domain ID or name. - -``id`` - Record ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_record-list: - -designate record-list ---------------------- - -.. code-block:: console - - usage: designate record-list [-h] [-f {csv,html,json,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--quote {all,minimal,none,nonnumeric}] - domain_id - -List Records - -**Positional arguments:** - -``domain_id`` - Domain ID or name. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_record-update: - -designate record-update ------------------------ - -.. code-block:: console - - usage: designate record-update [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - [--name NAME] [--type TYPE] [--data DATA] - [--description DESCRIPTION | --no-description] - [--ttl TTL | --no-ttl] - [--priority PRIORITY | --no-priority] - domain_id id - -Update Record - -**Positional arguments:** - -``domain_id`` - Domain ID or name. - -``id`` - Record ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--name NAME`` - Record name. - -``--type TYPE`` - Record type. - -``--data DATA`` - Record data. - -``--description DESCRIPTION`` - Description. - -``--no-description`` - -``--ttl TTL`` - Record time to live (seconds). - -``--no-ttl`` - -``--priority PRIORITY`` - Record priority. - -``--no-priority`` - -.. _designate_report-count-all: - -designate report-count-all --------------------------- - -.. code-block:: console - - usage: designate report-count-all [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--prefix PREFIX] - -Get count totals for all tenants, domains and records - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_report-count-domains: - -designate report-count-domains ------------------------------- - -.. code-block:: console - - usage: designate report-count-domains [-h] - [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--prefix PREFIX] - -Get counts for total domains - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_report-count-records: - -designate report-count-records ------------------------------- - -.. code-block:: console - - usage: designate report-count-records [-h] - [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--prefix PREFIX] - -Get counts for total records - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_report-count-tenants: - -designate report-count-tenants ------------------------------- - -.. code-block:: console - - usage: designate report-count-tenants [-h] - [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--prefix PREFIX] - -Get counts for total tenants - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_report-tenant-domains: - -designate report-tenant-domains -------------------------------- - -.. code-block:: console - - usage: designate report-tenant-domains [-h] - [-f {csv,html,json,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--quote {all,minimal,none,nonnumeric}] - --report-tenant-id REPORT_TENANT_ID - -Get a list of domains for given tenant - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--report-tenant-id REPORT_TENANT_ID`` - The tenant_id being reported on. - -.. _designate_report-tenants-all: - -designate report-tenants-all ----------------------------- - -.. code-block:: console - - usage: designate report-tenants-all [-h] [-f {csv,html,json,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--quote {all,minimal,none,nonnumeric}] - -Get list of tenants and domain count for each - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_server-create: - -designate server-create ------------------------ - -.. code-block:: console - - usage: designate server-create [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - --name NAME - -Create Server - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--name NAME`` - Server name. - -.. _designate_server-delete: - -designate server-delete ------------------------ - -.. code-block:: console - - usage: designate server-delete [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - id - -Delete Server - -**Positional arguments:** - -``id`` - Server ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_server-get: - -designate server-get --------------------- - -.. code-block:: console - - usage: designate server-get [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - id - -Get Server - -**Positional arguments:** - -``id`` - Server ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_server-list: - -designate server-list ---------------------- - -.. code-block:: console - - usage: designate server-list [-h] [-f {csv,html,json,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] - [--quote {all,minimal,none,nonnumeric}] - -List Servers - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_server-update: - -designate server-update ------------------------ - -.. code-block:: console - - usage: designate server-update [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - [--name NAME] - id - -Update Server - -**Positional arguments:** - -``id`` - Server ID. - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -``--name NAME`` - Server name. - -.. _designate_sync-all: - -designate sync-all ------------------- - -.. code-block:: console - - usage: designate sync-all [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] [--print-empty] - [--noindent] [--prefix PREFIX] - -Sync Everything - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_sync-domain: - -designate sync-domain ---------------------- - -.. code-block:: console - - usage: designate sync-domain [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - domain_id - -Sync a single Domain - -**Positional arguments:** - -``domain_id`` - Domain ID - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_sync-record: - -designate sync-record ---------------------- - -.. code-block:: console - - usage: designate sync-record [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - domain_id record_id - -Sync a single Record - -**Positional arguments:** - -``domain_id`` - Domain ID - -``record_id`` - Record ID - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - -.. _designate_touch-domain: - -designate touch-domain ----------------------- - -.. code-block:: console - - usage: designate touch-domain [-h] [-f {html,json,shell,table,value,yaml}] - [-c COLUMN] [--max-width ] - [--print-empty] [--noindent] [--prefix PREFIX] - domain_id - -Touch a single Domain - -**Positional arguments:** - -``domain_id`` - Domain ID - -**Optional arguments:** - -``-h, --help`` - show this help message and exit - diff --git a/doc/source/contributor/contributing.rst b/doc/source/contributor/contributing.rst index 7bcd1445..f1b421e6 100644 --- a/doc/source/contributor/contributing.rst +++ b/doc/source/contributor/contributing.rst @@ -30,4 +30,3 @@ Branch, work, & submit: git rebase -i # submit git-review - diff --git a/doc/source/index.rst b/doc/source/index.rst index 0d91923f..9deab3e2 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -2,28 +2,14 @@ python-designateclient ====================== -python-designateclient provides python bindings and command line tools for both -Designate v1 and v2 APIs. +python-designateclient provides python bindings and command line tools for Designate v2 APIs. The :ref:`Python API bindings ` are provided by the :program:`designateclient` module. -There are two separate command line interfaces to work with the two API -versions: - -v2: the designate plugin for the :program:`openstack` command line tool. More information can be +The designate plugin for the :program:`openstack` command line tool. More information can be found on the :ref:`designate v2 command line tool page `. -v1: the :program:`designate` command line tool. More information can be found -on the :ref:`designate v1 command line tool page `. - -.. warning:: - - The V1 API was removed in Queens, and cannot be re-enabled. - The :program:`designate` command line tool will no longer function on - installs newer than Queens. - - You'll need credentials for an OpenStack cloud that implements the Designate API in order to use the client. @@ -32,7 +18,6 @@ API in order to use the client. install/index user/index - cli/index contributor/index reference/index @@ -41,5 +26,3 @@ API in order to use the client. * :ref:`genindex` * :ref:`modindex` * :ref:`search` - -.. _Cloud DNS: http://www.hpcloud.com/products-services/dns diff --git a/doc/source/user/bindings.rst b/doc/source/user/bindings.rst index 8d79032c..22c8f389 100644 --- a/doc/source/user/bindings.rst +++ b/doc/source/user/bindings.rst @@ -1,11 +1,11 @@ .. _bindings: =========================== -Python Bindings - v1 and v2 +Python Bindings - v2 =========================== -The python-designateclient package comes with python bindings for both versions -of the Designate API: v1 and v2. These can be used to interact with the Designate +The python-designateclient package comes with python bindings +the Designate API: v2. This can be used to interact with the Designate API from any python program. Introduction - Bindings v2 @@ -38,502 +38,3 @@ To view examples of usage please checkout the *doc/examples* folder, basic usage zone = client.zones.create('i.io.', email='i@i.io') rs = client.recordsets.create(zone['id'], 'www', 'A', ['10.0.0.1']) - -Introduction -============ - -Below is a simple example of how to instantiate and perform basic tasks using -the bindings. - -.. code-block:: python - - #!/usr/bin/env python - from __future__ import print_function - from designateclient.v1 import Client - - - # Create an instance of the client, providing the necessary credentials - client = Client( - auth_url="https://example.com:5000/v3/", - username="openstack", - password="yadayada", - project_name="myproject", - project_domain_id='default', - user_domain_id='default') - - # Fetch a list of the domains this user/tenant has access to - domains = client.domains.list() - - # Iterate the list, printing some useful information - for domain in domains: - print("Domain ID: %s, Name: %s" % (domain.id, domain.name)) - -And the output this program might produce: - -.. code-block:: console - - $ python /tmp/example.py - Domain ID: 467f97b4-f074-4839-ae85-1a61fccfb83d, Name: example-one.com. - Domain ID: 6d3bf479-8a93-47ae-8c65-3dff8dba1b0d, Name: example-two.com. - - -Authentication -============== - -Designate supports either Keystone authentication, or no authentication at all. - -Keystone Authentication ------------------------ - -Below is a sample of standard authentication with keystone using keystoneauth -Sessions. For more information on keystoneauth API, see `Using Sessions`_. - -.. _Using Sessions: https://docs.openstack.org/keystoneauth/latest/using-sessions.html - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - from keystoneauth1.identity import generic - from keystoneauth1 import session as keystone_session - - - # Create an authentication plugin providing the necessary credentials - auth = generic.Password( - auth_url="https://example.com:5000/v3/", - username="openstack", - password="yadayada", - project_name="myproject", - project_domain_id='default', - user_domain_id='default' - ) - - session = keystone_session.Session(auth=auth) - - # Create an instance of the client, providing a keystoneauth Session - client = Client(session=session) - -Below is a sample of standard authentication with keystone, but also explicitly -providing the endpoint to use: - -.. note:: This is useful when a development Designate instances authenticates - against a production Keystone. - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - from keystoneauth1.identity import generic - from keystoneauth1 import session as keystone_session - - - # Create an authentication plugin providing the necessary credentials - auth = generic.Password( - auth_url="https://example.com:5000/v3/", - username="openstack", - password="yadayada", - project_name="myproject", - project_domain_id='default', - user_domain_id='default') - - session = keystone_session.Session(auth=auth) - - # Create an instance of the client, providing a keystoneauth Session - client = Client( - session=session, - endpoint="https://127.0.0.1:9001/v1/") - - -No Authentication ------------------ - -Below is a sample of interaction with a non authenticated designate: - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client, providing the endpoint directly - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - -Working with Domains -==================== - -The Domain Object ------------------ - -Object Properties: - -======================= ======================================================= -Property Description -======================= ======================================================= -id Domain ID -name Domain Name (e.g. example.com.) -email Domain Responsible Person Email (e.g. fred@example.com) -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 ---------------- - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - # List All Domains - domains = client.domains.list() - -Fetching a Domain by ID ------------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # Fetch the domain - domain = client.domains.get(domain_id) - - -Creating a Domain ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - from designateclient.v1.domains import Domain - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - # Create a new Domain object - domain = Domain(name="example.com.", email="fred@example.com") - - # Send the Create Domain API call - domain = client.domains.create(domain) - -Updating a Domain ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # Fetch the domain - domain = client.domains.get(domain_id) - - # Update a value on the Domain - domain.ttl = 300 - - # Send the Update Domain API call - domain = client.domains.update(domain) - -Deleting a Domain ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # Fetch the domain - domains = client.domains.delete(domain_id) - -Working with Records -==================== - -The Record Object ------------------ - -Object Properties: - -======================= ======================================================= -Property Description -======================= ======================================================= -id Record ID -domain_id Domain ID -name Record Name (e.g. example.com.) -type Record Type (e.g. A, AAAA, CNAME, MX, SRV etc) -data Record Data (e.g. 127.0.0.1) -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 ---------------- - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # List All Records - records = client.records.list(domain_id) - -Fetching a Record by ID ------------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - record_id = 'bd3e8520-25e0-11e3-8224-0800200c9a66' - - # Fetch the record - records = client.records.get(domain_id, record_id) - - -Creating a Record ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - from designateclient.v1.records import Record - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # Create a new Record object - record = Record(name="www.example.com.", type="A", data="127.0.0.1") - - # Send the Create Record API call - record = client.records.create(domain_id, record) - -Updating a Record ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - record_id = 'bd3e8520-25e0-11e3-8224-0800200c9a66' - - # Fetch the record - record = client.records.get(record_id) - - # Update a value on the Record - record.ttl = 300 - - # Send the Update Record API call - record = client.records.update(domain_id, record) - -Deleting a Record ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - domain_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - record_id = 'bd3e8520-25e0-11e3-8224-0800200c9a66' - - # Fetch the record - records = client.records.delete(domain_id, record_id) - -Working with Servers -==================== - -The Server Object ------------------ - -Object Properties: - -======================= ======================================================= -Property Description -======================= ======================================================= -id Server ID -name Server Name (e.g. example.com.) -created_at Date and time this server was created at -updated_at Date and time this server was last updated -======================= ======================================================= - -Listing Servers ---------------- - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - # List All Servers - servers = client.servers.list() - -Fetching a Server by ID ------------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - server_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # Fetch the server - server = client.servers.get(server_id) - - -Creating a Server ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - from designateclient.v1.servers import Server - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - # Create a new Server object - server = Server(name="ns1.example.com.") - - # Send the Create Server API call - server = client.servers.create(server) - -Updating a Server ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - server_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # Fetch the server - server = client.servers.get(server_id) - - # Update a value on the Server - server.name = "ns2.example.com" - - # Send the Update Server API call - server = client.servers.update(server) - -Deleting a Server ------------------ - -.. code-block:: python - - #!/usr/bin/env python - - from designateclient.v1 import Client - - # Create an instance of the client - client = Client( - endpoint="https://127.0.0.1:9001/v1/" - ) - - server_id = 'fb505f10-25df-11e3-8224-0800200c9a66' - - # Fetch the server - servers = client.servers.delete(server_id) diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index 2602651a..bfc041fd 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -6,5 +6,3 @@ bindings shell-v2 - shell - shell-examples diff --git a/doc/source/user/shell-examples.rst b/doc/source/user/shell-examples.rst deleted file mode 100644 index 3213fb12..00000000 --- a/doc/source/user/shell-examples.rst +++ /dev/null @@ -1,132 +0,0 @@ -==================================== -Designate Command Line Tool Examples -==================================== - -.. warning:: This page refers to command that use the V1 API, which is currently disabled, and will be removed in a future release - -Using the client against your dev environment ---------------------------------------------- -Typically the designate client talks to Keystone (or a Keystone like service) via the OS_AUTH_URL setting & retrives the designate endpoint from the returned service catalog. Using ``--os-endpoint`` or ``OS_ENDPOINT`` you can specify the end point directly, this is useful if you want to point the client at a test environment that's running without a full Keystone service. - -.. code-block:: shell-session - - $ designate --os-endpoint http://127.0.0.1:9001/v1 server-create --name ns.example.com. - +------------+--------------------------------------+ - | Field | Value | - +------------+--------------------------------------+ - | id | 3dee78df-c6b8-4fbd-8e89-3186c1a4734f | - | created_at | 2015-11-04T08:47:12.000000 | - | updated_at | None | - | name | ns.example.com. | - +------------+--------------------------------------+ - - $ designate --os-endpoint http://127.0.0.1:9001/v1 domain-create --name example.net. --email me@example.org - +-------------+--------------------------------------+ - | Field | Value | - +-------------+--------------------------------------+ - | description | None | - | created_at | 2015-11-04T08:49:53.000000 | - | updated_at | None | - | email | me@example.org | - | ttl | 3600 | - | serial | 1446626993 | - | id | f98c3d91-f514-4956-a955-20eefb413a64 | - | name | example.net. | - +-------------+--------------------------------------+ - - $ designate --os-endpoint http://127.0.0.1:9001/v1 record-create --name myhost.example.net. --type A --data 1.2.3.4 f98c3d91-f514-4956-a955-20eefb413a64 (domain_id) - +-------------+--------------------------------------+ - | Field | Value | - +-------------+--------------------------------------+ - | description | None | - | type | A | - | created_at | 2015-11-04T08:52:41.000000 | - | updated_at | None | - | domain_id | f98c3d91-f514-4956-a955-20eefb413a64 | - | priority | None | - | ttl | None | - | data | 1.2.3.4 | - | id | b5a74471-8062-4395-be70-968805a0d832 | - | name | myhost.example.net. | - +-------------+--------------------------------------+ - - $ designate domain-list - +--------------------------------------+--------------+------------+ - | id | name | serial | - +--------------------------------------+--------------+------------+ - | 88c14ecf-b034-424c-b081-ca42494dcdf9 | example.com. | 1462372104 | - +--------------------------------------+--------------+------------+ - - $ designate domain-update --email example@example.com 88c14ecf-b034-424c-b081-ca42494dcdf9 (domain_id) - +-------------+---------------------------------------+ - | Field | Value | - +-------------+---------------------------------------+ - | description | None | - | created_at | 2016-05-04T14:28:24.000000 | - | updated_at | 2016-05-04T14:29:48.000000 | - | email | example@example.com | - | ttl | 3600 | - | serial | 1462372188 | - | id | 88c14ecf-b034-424c-b081-ca42494dcdf9 | - | name | example.com. | - +-------------+---------------------------------------+ - - $ designate domain-delete 88c14ecf-b034-424c-b081-ca42494dcdf9 (domain_id) - - $ designate record-list 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain_id) - +--------------------------------------+------+-----------------------+-----------------------------------------------------------------+ - | id | type | name | data | - +--------------------------------------+------+-----------------------+-----------------------------------------------------------------+ - | fdfab9c3-51c0-42b9-b500-7779ef917915 | SOA | example.com. | ns1.example.org. pr8721.att.com. 1462372695 3600 600 86400 3600 | - | 242a16e8-8455-4b4d-af7f-45de1074aa04 | NS | example.com. | xyz.com. | - | 8dc14df7-3651-49df-8c83-0d71954c6152 | NS | example.com. | ns1.example.org. | - | 7e80531d-bd65-49bc-a316-a6a06cd7fe26 | A | example1.example.com. | 198.51.100.1 | - +--------------------------------------+------+-----------------------+-----------------------------------------------------------------+ - - $ designate record-update --name example1.example.com. --type A --data 198.5.100.2 --ttl 3600 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain-id) 7e80531d-bd65-49bc-a316-a6a06cd7fe26 (record_id) - +-------------+--------------------------------------+ - | Field | Value | - +-------------+--------------------------------------+ - | description | None | - | type | A | - | created_at | 2016-05-04T14:38:15.000000 | - | updated_at | 2016-05-04T16:12:05.000000 | - | domain_id | 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d | - | priority | None | - | ttl | 3600 | - | data | 198.5.100.2 | - | id | 7e80531d-bd65-49bc-a316-a6a06cd7fe26 | - | name | example1.example.com. | - +-------------+--------------------------------------+ - - $ designate record-delete 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain-id) 7e80531d-bd65-49bc-a316-a6a06cd7fe26 (record_id) - - $ designate quota-get 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) - +-------------------+-------+ - | Field | Value | - +-------------------+-------+ - | domains | 10 | - | domain_recordsets | 500 | - | recordset_records | 20 | - | domain_records | 500 | - +-------------------+-------+ - - $ designate quota-update --domains 50 --domain-recordsets 1000 --recordset-records 40 --domain-records 1000 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) - +-------------------+-------+ - | Field | Value | - +-------------------+-------+ - | domains | 50 | - | domain_recordsets | 1000 | - | recordset_records | 40 | - | domain_records | 1000 | - +-------------------+-------+ - - $ designate quota-get 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) - +-------------------+-------+ - | Field | Value | - +-------------------+-------+ - | domains | 10 | - | domain_recordsets | 500 | - | recordset_records | 20 | - | domain_records | 500 | - +-------------------+-------+ diff --git a/doc/source/user/shell.rst b/doc/source/user/shell.rst deleted file mode 100644 index 3217ae64..00000000 --- a/doc/source/user/shell.rst +++ /dev/null @@ -1,248 +0,0 @@ -.. _shell: - -========================================================= -Designate Command Line Tool (compatible with v1 API only) -========================================================= - -.. warning:: This page refers to command that use the V1 API, which is currently disabled, and will be removed in a future release - -The python-designateclient package comes with a command line tool (installed as :program:`designate`), this can be used to access a Designate API -without having to manipulate JSON by hand, it can also produce the output in a variety of formats (JSON, CSV) and allow you to select columns to be -displayed. - -Credentials ------------ - -As with any OpenStack utility, :program:`designate` requires certain information to -talk to the REST API, username, password, auth url (from where the other required -endpoints are retrieved once you are authenticated). - -To provide your access credentials (username, password, tenant name or tenant id) -you can pass them on the command line with the ``--os-username``, ``--os-password``, ``--os-tenant-name`` or ``--os-tenant-id`` -params, but it's easier to just set them as environment variables:: - - export OS_USERNAME=openstack - export OS_PASSWORD=yadayada - export OS_TENANT_NAME=myproject - export OS_TENANT_ID=123456789 - -You will also need to define the authentication url with ``--os-auth-url`` -or set is as an environment variable as well:: - - export OS_AUTH_URL=https://example.com:5000/v2.0/ - -Since Keystone can return multiple regions in the Service Catalog, you -can specify the one you want with ``--os-region-name`` (or -``export OS_REGION_NAME``). It defaults to the first in the list returned. - -Using the command line tool ---------------------------- - -With enough details now in the environment, you can use the designate client to create a domain and populate it with some records: - -.. code-block:: shell-session - - $ designate domain-create --name example.com. --email admin@example.com - +-------------+--------------------------------------+ - | Field | Value | - +-------------+--------------------------------------+ - | description | None | - | created_at | 2013-09-19T11:45:25.295355 | - | updated_at | None | - | email | admin@example.com | - | ttl | 3600 | - | serial | 1379591125 | - | id | eacbe2a5-95f1-4a9f-89f5-b9c58009b163 | - | name | example.com. | - +-------------+--------------------------------------+ - -Now that the domain has been created, we can start adding records. - -You'll note that the name (www.example.com) has a trailing ``.``, as per the DNS standard, we didn't set a TTL and we had to specify the parent -zone/domain by domain_id ``eacbe2a5-95f1-4a9f-89f5-b9c58009b163``. - -.. code-block:: shell-session - - $ designate record-create eacbe2a5-95f1-4a9f-89f5-b9c58009b163 --name www.example.com. --type A --data 1.2.3.4 - +-------------+--------------------------------------+ - | Field | Value | - +-------------+--------------------------------------+ - | name | www.example.com. | - | data | 1.2.3.4 | - | created_at | 2013-09-19T13:44:42.295428 | - | updated_at | None | - | id | 147f6082-8466-4951-8d13-37a10e92b11e | - | priority | None | - | ttl | None | - | type | A | - | domain_id | eacbe2a5-95f1-4a9f-89f5-b9c58009b163 | - | description | None | - +-------------+--------------------------------------+ - -subcommands ------------ - -We've already seen the ``domain-create`` and ``record-create`` subcommands, here the full list of subcommands: - -======================= ====================================================== =============== -subcommand Notes Admin Required -======================= ====================================================== =============== -complete print bash completion command -diagnostics-ping Ping a service on a given host -domain-create Create Domain -domain-delete Delete Domain -domain-get Get Domain -domain-list List Domains -domain-servers-list List Domain Servers -domain-update Update Domain -help print detailed help for another command -quota-get Get Quota -quota-reset Reset Quota -quota-update Update Quota -record-create Create Record -record-delete Delete Record -record-get Get Record -record-list List Records -record-update Update Record -report-count-all Get count totals for all tenants, domains and records -report-count-domains Get counts for total domains -report-count-records Get counts for total records -report-count-tenants Get counts for total tenants -report-tenant-domains Get a list of domains for given tenant -report-tenants-all Get list of tenants and domain count for each -server-create Create Server -server-delete Delete Server -server-get Get Server -server-list List Servers -server-update Update Server -sync-all Sync Everything -sync-domain Sync a single Domain -sync-record Sync a single Record -touch-domain Touch a single Domain - -======================= ====================================================== =============== - -Builtin designate documentation -------------------------------- - -You'll find complete documentation on the shell by running -``designate --help``: - -usage: designate [--version] [-v] [--log-file LOG_FILE] [-q] [-h] [--debug] - [--os-username OS_USERNAME] [--os-user-id OS_USER_ID] - [--os-user-domain-id OS_USER_DOMAIN_ID] - [--os-user-domain-name OS_USER_DOMAIN_NAME] - [--os-password OS_PASSWORD] [--os-tenant-name OS_TENANT_NAME] - [--os-tenant-id OS_TENANT_ID] - [--os-project-name OS_PROJECT_NAME] - [--os-domain-name OS_DOMAIN_NAME] - [--os-domain-id OS_DOMAIN_ID] [--os-project-id OS_PROJECT_ID] - [--os-project-domain-id OS_PROJECT_DOMAIN_ID] - [--os-project-domain-name OS_PROJECT_DOMAIN_NAME] - [--os-auth-url OS_AUTH_URL] [--os-region-name OS_REGION_NAME] - [--os-token OS_TOKEN] [--os-endpoint OS_ENDPOINT] - [--os-endpoint-type OS_ENDPOINT_TYPE] - [--os-service-type OS_SERVICE_TYPE] [--os-cacert OS_CACERT] - [--insecure] [--all-tenants] [--edit-managed] - -Designate Client - -optional arguments: - --version show program's version number and exit - -v, --verbose Increase verbosity of output. Can be repeated. - --log-file LOG_FILE Specify a file to log output. Disabled by default. - -q, --quiet Suppress output except warnings and errors. - -h, --help Show this help message and exit. - --debug Show tracebacks on errors. - --os-username OS_USERNAME - Name used for authentication with the OpenStack - Identity service. Defaults to env[OS_USERNAME]. - --os-user-id OS_USER_ID - User ID used for authentication with the OpenStack - Identity service. Defaults to env[OS_USER_ID]. - --os-user-domain-id OS_USER_DOMAIN_ID - Defaults to env[OS_USER_DOMAIN_ID]. - --os-user-domain-name OS_USER_DOMAIN_NAME - Defaults to env[OS_USER_DOMAIN_NAME]. - --os-password OS_PASSWORD - Password used for authentication with the OpenStack - Identity service. Defaults to env[OS_PASSWORD]. - --os-tenant-name OS_TENANT_NAME - Tenant to request authorization on. Defaults to - env[OS_TENANT_NAME]. - --os-tenant-id OS_TENANT_ID - Tenant to request authorization on. Defaults to - env[OS_TENANT_ID]. - --os-project-name OS_PROJECT_NAME - Project to request authorization on. Defaults to - env[OS_PROJECT_NAME]. - --os-domain-name OS_DOMAIN_NAME - Project to request authorization on. Defaults to - env[OS_DOMAIN_NAME]. - --os-domain-id OS_DOMAIN_ID - Defaults to env[OS_DOMAIN_ID]. - --os-project-id OS_PROJECT_ID - Project to request authorization on. Defaults to - env[OS_PROJECT_ID]. - --os-project-domain-id OS_PROJECT_DOMAIN_ID - Defaults to env[OS_PROJECT_DOMAIN_ID]. - --os-project-domain-name OS_PROJECT_DOMAIN_NAME - Defaults to env[OS_PROJECT_DOMAIN_NAME]. - --os-auth-url OS_AUTH_URL - Specify the Identity endpoint to use for - authentication. Defaults to env[OS_AUTH_URL]. - --os-region-name OS_REGION_NAME - Specify the region to use. Defaults to - env[OS_REGION_NAME]. - --os-token OS_TOKEN Specify an existing token to use instead of retrieving - one via authentication (e.g. with username & - password). Defaults to env[OS_SERVICE_TOKEN]. - --os-endpoint OS_ENDPOINT - Specify an endpoint to use instead of retrieving one - from the service catalog (via authentication). - Defaults to env[OS_DNS_ENDPOINT]. - --os-endpoint-type OS_ENDPOINT_TYPE - Defaults to env[OS_ENDPOINT_TYPE]. - --os-service-type OS_SERVICE_TYPE - Defaults to env[OS_DNS_SERVICE_TYPE], or 'dns'. - --os-cacert OS_CACERT - CA certificate bundle file. Defaults to - env[OS_CACERT]. - --insecure Explicitly allow 'insecure' SSL requests. - --all-tenants Allows to list all domains from all tenants. - --edit-managed Allows to edit records that are marked as managed. - - -Commands: - complete print bash completion command - diagnostics-ping Ping a service on a given host - domain-create Create Domain - domain-delete Delete Domain - domain-get Get Domain - domain-list List Domains - domain-servers-list List Domain Servers - domain-update Update Domain - help print detailed help for another command - quota-get Get Quota - quota-reset Reset Quota - quota-update Update Quota - record-create Create Record - record-delete Delete Record - record-get Get Record - record-list List Records - record-update Update Record - report-count-all Get count totals for all tenants, domains and records - report-count-domains Get counts for total domains - report-count-records Get counts for total records - report-count-tenants Get counts for total tenants - report-tenant-domains Get a list of domains for given tenant - report-tenants-all Get list of tenants and domain count for each - server-create Create Server - server-delete Delete Server - server-get Get Server - server-list List Servers - server-update Update Server - sync-all Sync Everything - sync-domain Sync a single Domain - sync-record Sync a single Record - touch-domain Touch a single Domain diff --git a/lower-constraints.txt b/lower-constraints.txt index a380f86b..2cac8e07 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -61,7 +61,7 @@ python-mimeparse==1.6.0 python-subunit==1.0.0 pytz==2013.6 PyYAML==3.12 -reno==2.5.0 +reno==2.7.0 requests==2.14.2 requests-mock==1.2.0 requestsexceptions==1.2.0 diff --git a/releasenotes/notes/remove-api-v1-4e507128b344082b.yaml b/releasenotes/notes/remove-api-v1-4e507128b344082b.yaml new file mode 100644 index 00000000..a7fa4c69 --- /dev/null +++ b/releasenotes/notes/remove-api-v1-4e507128b344082b.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Removed V1 API support from the client, as it was permanently + removed in the Queens release of Designate. diff --git a/setup.cfg b/setup.cfg index ce28c7c2..e0e837a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,61 +28,9 @@ setup-hooks = [files] packages = designateclient -scripts = - bin/designate [entry_points] -designateclient.v1.controllers = - reports = designateclient.v1.reports:ReportsController - diagnostics = designateclient.v1.diagnostics:DiagnosticsController - domains = designateclient.v1.domains:DomainsController - records = designateclient.v1.records:RecordsController - servers = designateclient.v1.servers:ServersController - quotas = designateclient.v1.quotas:QuotasController - sync = designateclient.v1.sync:SyncController - touch = designateclient.v1.touch:TouchController - -designateclient.cli = - domain-list = designateclient.cli.domains:ListDomainsCommand - domain-get = designateclient.cli.domains:GetDomainCommand - domain-create = designateclient.cli.domains:CreateDomainCommand - domain-update = designateclient.cli.domains:UpdateDomainCommand - domain-delete = designateclient.cli.domains:DeleteDomainCommand - domain-servers-list = designateclient.cli.domains:ListDomainServersCommand - - record-list = designateclient.cli.records:ListRecordsCommand - record-get = designateclient.cli.records:GetRecordCommand - record-create = designateclient.cli.records:CreateRecordCommand - record-update = designateclient.cli.records:UpdateRecordCommand - record-delete = designateclient.cli.records:DeleteRecordCommand - - server-list = designateclient.cli.servers:ListServersCommand - server-get = designateclient.cli.servers:GetServerCommand - server-create = designateclient.cli.servers:CreateServerCommand - server-update = designateclient.cli.servers:UpdateServerCommand - server-delete = designateclient.cli.servers:DeleteServerCommand - - diagnostics-ping = designateclient.cli.diagnostics:PingCommand - - sync-all = designateclient.cli.sync:SyncAllCommand - 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 - report-count-tenants = designateclient.cli.reports:TenantCountCommand - report-tenants-all = designateclient.cli.reports:TenantsCommand - report-tenant-domains = designateclient.cli.reports:TenantCommand - - quota-get = designateclient.cli.quotas:GetQuotaCommand - quota-update = designateclient.cli.quotas:UpdateQuotaCommand - quota-reset = designateclient.cli.quotas:ResetQuotaCommand - designateclient.versions = - 1 = designateclient.v1:Client 2 = designateclient.v2.client:Client openstack.cli.extension = diff --git a/test-requirements.txt b/test-requirements.txt index a467cebb..ea0363e5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,5 +11,5 @@ os-testr>=1.0.0 # Apache-2.0 python-subunit>=1.0.0 # Apache-2.0/BSD requests-mock>=1.2.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 -reno>=2.5.0 # Apache-2.0 +reno>=2.7.0 # Apache-2.0 tempest>=17.1.0 # Apache-2.0