def restore_sql_pool(cmd, client, resource_group_name, workspace_name, sql_pool_name, destination_name, performance_level=None, restore_point_in_time=None, source_database_deletion_date=None, storage_account_type=None, tags=None, no_wait=False, **kwargs): """ Restores an existing or deleted SQL pool (i.e. create with 'Restore' or 'PointInTimeRestore' create mode.) Custom function makes create mode more convenient. """ if not (restore_point_in_time or source_database_deletion_date): raise CLIError('Either --time or --deleted-time must be specified.') # Set create mode properties is_deleted = source_database_deletion_date is not None create_mode = SynapseSqlCreateMode.Restore if is_deleted else SynapseSqlCreateMode.PointInTimeRestore source_sql_pool_info = client.get(resource_group_name, workspace_name, sql_pool_name) # get the default performance_level if performance_level is None: performance_level = source_sql_pool_info.sku.name # create source database id source_database_id = _construct_database_resource_id( cmd.cli_ctx, resource_group_name, workspace_name, sql_pool_name) sku = Sku(name=performance_level) dest_sql_pool_info = SqlPool(sku=sku, location=source_sql_pool_info.location, create_mode=create_mode, restore_point_in_time=restore_point_in_time, storage_account_type=storage_account_type, source_database_id=source_database_id, tags=tags) return sdk_no_wait(no_wait, client.begin_create, resource_group_name, workspace_name, destination_name, dest_sql_pool_info)
def create_sql_pool(cmd, client, resource_group_name, workspace_name, sql_pool_name, performance_level, tags=None, no_wait=False): workspace_client = cf_synapse_client_workspace_factory(cmd.cli_ctx) workspace_object = workspace_client.get(resource_group_name, workspace_name) location = workspace_object.location sku = Sku(name=performance_level) sql_pool_info = SqlPool(sku=sku, location=location, create_mode=SynapseSqlCreateMode.Default, tags=tags) return sdk_no_wait(no_wait, client.create, resource_group_name, workspace_name, sql_pool_name, sql_pool_info)