public virtual PSStorageInsight CreatePSStorageInsight(CreatePSStorageInsightParameters parameters) { PSStorageInsight storageInsight = null; Action createStorageInsight = () => { storageInsight = new PSStorageInsight( CreateOrUpdateStorageInsight( parameters.ResourceGroupName, parameters.WorkspaceName, parameters.Name, parameters.StorageAccountResourceId, parameters.StorageAccountKey, parameters.Tables, parameters.Containers), parameters.ResourceGroupName, parameters.WorkspaceName); }; if (parameters.Force) { // If user decides to overwrite anyway, then there is no need to check if the data factory exists or not. createStorageInsight(); } else { bool storageInsightExists = CheckStorageInsightExists(parameters.ResourceGroupName, parameters.WorkspaceName, parameters.Name); parameters.ConfirmAction( !storageInsightExists, // prompt only if the storageInsight exists string.Format( CultureInfo.InvariantCulture, Resources.StorageInsightExists, parameters.Name, parameters.WorkspaceName), string.Format( CultureInfo.InvariantCulture, Resources.StorageInsightCreating, parameters.Name, parameters.WorkspaceName), parameters.Name, createStorageInsight); } return storageInsight; }
public virtual PSStorageInsight CreatePSStorageInsight(CreatePSStorageInsightParameters parameters) { PSStorageInsight storageInsight = null; Action createStorageInsight = () => { storageInsight = new PSStorageInsight( CreateOrUpdateStorageInsight( parameters.ResourceGroupName, parameters.WorkspaceName, parameters.Name, parameters.StorageAccountResourceId, parameters.StorageAccountKey, parameters.Tables, parameters.Containers), parameters.ResourceGroupName, parameters.WorkspaceName); }; parameters.ConfirmAction( parameters.Force, string.Format( CultureInfo.InvariantCulture, Resources.StorageInsightExists, parameters.Name, parameters.WorkspaceName), string.Format( CultureInfo.InvariantCulture, Resources.StorageInsightCreating, parameters.Name, parameters.WorkspaceName), parameters.Name, createStorageInsight, () => CheckStorageInsightExists(parameters.ResourceGroupName, parameters.WorkspaceName, parameters.Name)); return storageInsight; }