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 all commits
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": "3125d386c56599dd364534988ebc7cac35d79de58bb6e89af04bc48569da9522",
"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: 0 additions & 2 deletions src/rdbms/azext_rdbms/mysql/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from .server_properties_for_create import ServerPropertiesForCreate
from .server_properties_for_default_create import ServerPropertiesForDefaultCreate
from .server_properties_for_restore import ServerPropertiesForRestore
from .server_properties_for_geo_restore import ServerPropertiesForGeoRestore
from .sku import Sku
from .server import Server
from .server_for_create import ServerForCreate
Expand Down Expand Up @@ -53,7 +52,6 @@
'ServerPropertiesForCreate',
'ServerPropertiesForDefaultCreate',
'ServerPropertiesForRestore',
'ServerPropertiesForGeoRestore',
'Sku',
'Server',
'ServerForCreate',
Expand Down
16 changes: 9 additions & 7 deletions src/rdbms/azext_rdbms/mysql/models/log_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class LogFile(ProxyResource):
:type log_file_name: str
:param size_in_kb: Size of the log file.
:type size_in_kb: long
:param created_time: Creation timestamp of the log file.
:type created_time: datetime
:param last_modified_time: Last modified timestamp of the log file.
:type last_modified_time: datetime
:ivar created_time: Creation timestamp of the log file.
:vartype created_time: datetime
:ivar last_modified_time: Last modified timestamp of the log file.
:vartype last_modified_time: datetime
:param log_file_type: Type of the log file.
:type log_file_type: str
:param url: The url to download the log file from.
Expand All @@ -42,6 +42,8 @@ class LogFile(ProxyResource):
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'created_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}

_attribute_map = {
Expand All @@ -56,11 +58,11 @@ class LogFile(ProxyResource):
'url': {'key': 'properties.url', 'type': 'str'},
}

def __init__(self, log_file_name=None, size_in_kb=None, created_time=None, last_modified_time=None, log_file_type=None, url=None):
def __init__(self, log_file_name=None, size_in_kb=None, log_file_type=None, url=None):
super(LogFile, self).__init__()
self.log_file_name = log_file_name
self.size_in_kb = size_in_kb
self.created_time = created_time
self.last_modified_time = last_modified_time
self.created_time = None
self.last_modified_time = None
self.log_file_type = log_file_type
self.url = url
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ServerPropertiesForCreate(Model):

You probably want to use the sub-classes and not this class directly. Known
sub-classes are: ServerPropertiesForDefaultCreate,
ServerPropertiesForRestore, ServerPropertiesForGeoRestore
ServerPropertiesForRestore

:param version: Server version. Possible values include: '5.6', '5.7'
:type version: str or ~azure.mgmt.rdbms.mysql.models.ServerVersion
Expand All @@ -43,7 +43,7 @@ class ServerPropertiesForCreate(Model):
}

_subtype_map = {
'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore', 'GeoRestore': 'ServerPropertiesForGeoRestore'}
'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore'}
}

def __init__(self, version=None, ssl_enforcement=None, storage_profile=None):
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CheckNameAvailabilityOperations(object):
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An objec model deserializer.
:param deserializer: An object model deserializer.
:ivar api_version: The API version to use for the request. Constant value: "2017-12-01-preview".
"""

Expand Down Expand Up @@ -58,7 +58,7 @@ def execute(
name_availability_request = models.NameAvailabilityRequest(name=name, type=type)

# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability'
url = self.execute.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
Expand Down Expand Up @@ -101,3 +101,4 @@ def execute(
return client_raw_response

return deserialized
execute.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability'}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ConfigurationsOperations(object):
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An objec model deserializer.
:param deserializer: An object model deserializer.
:ivar api_version: The API version to use for the request. Constant value: "2017-12-01-preview".
"""

Expand All @@ -45,7 +45,7 @@ def _create_or_update_initial(
parameters = models.Configuration(value=value, source=source)

# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}'
url = self.create_or_update.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
Expand Down Expand Up @@ -166,6 +166,7 @@ def get_long_running_output(response):
return AzureOperationPoller(
long_running_send, get_long_running_output,
get_long_running_status, long_running_operation_timeout)
create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}'}

def get(
self, resource_group_name, server_name, configuration_name, custom_headers=None, raw=False, **operation_config):
Expand All @@ -190,7 +191,7 @@ def get(
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}'
url = self.get.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
Expand Down Expand Up @@ -232,6 +233,7 @@ def get(
return client_raw_response

return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}'}

def list_by_server(
self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config):
Expand All @@ -257,7 +259,7 @@ def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations'
url = self.list_by_server.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
Expand Down Expand Up @@ -304,3 +306,4 @@ def internal_paging(next_link=None, raw=False):
return client_raw_response

return deserialized
list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations'}
Loading