public void Dispose() { if (null != _storageManagementClient) { _storageManagementClient.Dispose(); } }
public void Dispose() { if (_storageManagementClient != null) { _storageManagementClient.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { _storageMgmtClient.Dispose(); } }
private void Cleanup() { UndoContext.Current.UndoAll(); computeMgmtClient.Dispose(); storageMgmtClient.Dispose(); managementClient.Dispose(); }
public void Dispose() { if (storageClient != null) { storageClient.Dispose(); } if (computeClient != null) { computeClient.Dispose(); } }
/// <summary> /// Performs the tasks needed to remove the dynamically created blob container. /// </summary> /// public async ValueTask DisposeAsync() { if (_disposed) { return; } var resourceGroup = TestEnvironment.EventHubsResourceGroup; var storageAccount = StorageTestEnvironment.StorageAccountName; var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false); var client = new StorageManagementClient(new TokenCredentials(token)) { SubscriptionId = TestEnvironment.EventHubsSubscription }; try { await ResourceManager.CreateRetryPolicy().ExecuteAsync(() => client.BlobContainers.DeleteAsync(resourceGroup, storageAccount, ContainerName)).ConfigureAwait(false); } catch { // This should not be considered a critical failure that results in a test failure. Due // to ARM being temperamental, some management operations may be rejected. Throwing here // does not help to ensure resource cleanup only flags the test itself as a failure. // // If a blob container fails to be deleted, removing of the associated storage account at the end // of the test run will also remove the orphan. } finally { client?.Dispose(); } _disposed = true; }