Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove georestore command. #89

Merged
merged 4 commits into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@
],
"rdbms": [
{
"filename": "rdbms-0.0.2-py2.py3-none-any.whl",
"sha256Digest": "f7c347df4766e593e953862dfa1f08e938fb8054821b3b507f99f7e4306b4b21",
"downloadUrl": "https://prodrdbmsclipackages.blob.core.windows.net/cliextensions/rdbms-0.0.2-py2.py3-none-any.whl",
"filename": "rdbms-0.0.3-py2.py3-none-any.whl",
"sha256Digest": "6b0c16930b06c743829171e5aeec0da0f4804886bb9998dee73d28ba89e700d9",
"downloadUrl": "https://prodrdbmsclipackages.blob.core.windows.net/cliextensions/rdbms-0.0.3-py2.py3-none-any.whl",
"metadata": {
"classifiers": [
"Development Status :: 4 - Beta",
Expand Down Expand Up @@ -544,7 +544,7 @@
"metadata_version": "2.0",
"name": "rdbms",
"summary": "An Azure CLI Extension to manage Azure MySQL and Azure PostgreSQL resources",
"version": "0.0.2"
"version": "0.0.3"
}
}
],
Expand Down
12 changes: 0 additions & 12 deletions src/rdbms/azext_rdbms/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ def add_helps(command_group, server_type):
-s "/subscriptions/${{SubID}}/resourceGroups/${{ResourceGroup}}/providers/Microsoft.DBfor{1}/servers/testsvr2" \\
--restore-point-in-time "2017-06-15T13:10:00Z"
""".format(command_group, server_type)
helps['{} server georestore'.format(command_group)] = """
type: command
short-summary: Restore a server from geo-replicated backup.
examples:
- name: Geo-Restore 'testsvr' as 'testsvrgeor'.
text: az {0} server georestore -g testgroup -n testsvrgeor --source-server testsvr -l northeurope --sku-name GP_Gen4_2
- name: Geo-Restore 'testsvr2' to 'testsvrnew', where 'testsvrnew' is in a different resource group than the backup.
text: |
az {0} server georestore -g testgroup -n testsvrgeor \\
-s "/subscriptions/${{SubID}}/resourceGroups/${{ResourceGroup}}/providers/Microsoft.DBfor{1}/servers/testsvrgeor" \\
-l northeurope --sku-name GP_Gen4_2
""".format(command_group, server_type)
helps['{} server update'.format(command_group)] = """
type: command
short-summary: Update a server.
Expand Down
15 changes: 0 additions & 15 deletions src/rdbms/azext_rdbms/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,6 @@ def _complex_params(command_group, engine):
c.argument('source_server_id', options_list=['--source-server', '-s'], help='The name or ID of the source server to restore from.')
c.argument('restore_point_in_time', help='The point in time to restore from (ISO8601 format), e.g., 2017-04-26T02:10:00+08:00')

with self.argument_context('{} server georestore'. format(command_group)) as c:
c.expand('sku', engine.models.Sku)
c.ignore('size', 'family', 'capacity', 'tier')

c.expand('storage_profile', engine.models.StorageProfile)
c.ignore('storage_mb')

c.expand('properties', engine.models.ServerPropertiesForGeoRestore)
c.ignore('version', 'ssl_enforcement')

c.expand('parameters', engine.models.ServerForCreate)
c.ignore('tags')

c.argument('source_server_id', options_list=['--source-server', '-s'], help='The name or ID of the source server to restore from.')

with self.argument_context('{} server configuration set'.format(command_group)) as c:
c.argument('value', help='Value of the configuration. If not provided, configuration value will be set to default.', validator=configuration_value_validator)
c.ignore('source')
Expand Down
2 changes: 0 additions & 2 deletions src/rdbms/azext_rdbms/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def load_command_table(self, _):
with self.command_group('mysql server', mysql_servers_sdk, client_factory=cf_mysql_servers) as g:
g.command('create', 'create')
g.custom_command('restore', '_server_restore', no_wait_param='no_wait')
g.custom_command('georestore', '_server_georestore', no_wait_param='no_wait')
g.command('delete', 'delete', confirmation=True)
g.command('show', 'get')
g.custom_command('list', '_server_list_custom_func')
Expand All @@ -99,7 +98,6 @@ def load_command_table(self, _):
with self.command_group('postgres server', postgres_servers_sdk, client_factory=cf_postgres_servers) as g:
g.command('create', 'create')
g.custom_command('restore', '_server_restore', no_wait_param='no_wait')
g.custom_command('georestore', '_server_georestore', no_wait_param='no_wait')
g.command('delete', 'delete', confirmation=True)
g.command('show', 'get')
g.custom_command('list', '_server_list_custom_func')
Expand Down
30 changes: 0 additions & 30 deletions src/rdbms/azext_rdbms/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,36 +44,6 @@ def _server_restore(cmd, client, resource_group_name, server_name, parameters, n
return client.create(resource_group_name, server_name, parameters, raw=no_wait)


# need to replace source sever name with source server id, so customer server restore function
# The parameter list should be the same as that in factory to use the ParametersContext
# auguments and validators
def _server_georestore(cmd, client, resource_group_name, server_name, parameters, no_wait=False, **kwargs):
source_server = kwargs['source_server_id']

if not is_valid_resource_id(source_server):
if len(source_server.split('/')) == 1:
provider = 'Microsoft.DBForMySQL' if isinstance(client, ServersOperations) else 'Microsoft.DBforPostgreSQL'
source_server = resource_id(subscription=get_subscription_id(cmd.cli_ctx),
resource_group=resource_group_name,
namespace=provider,
type='servers',
name=source_server)
else:
raise ValueError('The provided source-server {} is invalid.'.format(source_server))

parameters.properties.source_server_id = source_server

id_parts = parse_resource_id(source_server)
try:
source_server_object = client.get(id_parts['resource_group'], id_parts['name'])
if parameters.sku.name is None:
parameters.sku.name = source_server_object.sku.name
except Exception as e:
raise ValueError('Unable to get source server: {}.'.format(str(e)))

return client.create(resource_group_name, server_name, parameters, raw=no_wait)


def _server_update_custom_func(instance,
capacity=None,
storage_mb=None,
Expand Down
2 changes: 1 addition & 1 deletion src/rdbms/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = "0.0.2"
VERSION = "0.0.3"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down