protected override async Task OnExecuteAsync(CommandLineApplication app) { ValidateParameters(); if (string.IsNullOrEmpty(SubscriptionId) || string.IsNullOrEmpty(ResourceName)) { ReportError(new ArgumentException("Missing subscriptionId or resource name")); } var signalrInstanceTbl = new SignalRInstanceTable(SignalRConstants.SignalRInstanceTableName, AzureStorageAccount.GetStorageTable(ConnectionString)); await Helper.SearchEntity(signalrInstanceTbl, SubscriptionId, ResourceName); }
protected override async Task OnExecuteAsync(CommandLineApplication app) { if (string.IsNullOrEmpty(SubscriptionId) || string.IsNullOrEmpty(ResourceName)) { ReportError(new ArgumentException("Missing subscriptionId or resource name")); } var keyvaultAddress = $"https://{KeyVaultName}.vault.azure.net/"; var azureHelper = new AzureHelper(TenantId); var strAccountProvider = new StorageAccountProvider(azureHelper, keyvaultAddress); var storageAccount = await strAccountProvider.GetRPTableReader(SignalRConstants.SignalRInstanceStorageAccount); var signalrInstanceTbl = new SignalRInstanceTable(SignalRConstants.SignalRInstanceTableName, storageAccount.CreateCloudTableClient()); await Helper.SearchEntity(signalrInstanceTbl, SubscriptionId, ResourceName); }
public static async Task SearchEntity(SignalRInstanceTable signalrInstanceTbl, string subscriptionId, string resourceName) { var entity = await signalrInstanceTbl.SearchEntity(t => { var signalrEntity = t; if (string.Equals(signalrEntity.UserSubscriptionId, subscriptionId) && string.Equals(signalrEntity.ResourceName, resourceName)) { return(true); } return(false); }); if (entity != null) { var signalrEntity = entity; Console.WriteLine($"{signalrEntity.ResourceName}: status: {signalrEntity.Status}, isStopped: {signalrEntity.IsStopped}, isSuspended: {signalrEntity.IsSuspended}"); } else { Console.WriteLine($"{resourceName} does not exist"); } }