public async Task <IEnumerable <Site> > ExecuteRaw(ICloudOdsOperationContext context) { var instance = await _getCloudOdsHostedInstanceQuery.Execute(context.Instance); var websites = await _armClient.GetWebsiteListAsync(_activeDirectoryClientInfo.SubscriptionId, instance?.SystemName); return(websites.Where(w => w.IsInEnvironment(CloudOdsEnvironment.Production) && (context.TargetRole == null || w.IsInRole(context.TargetRole)))); }
public async Task Execute(ICloudOdsOperationContext context) { var cloudOdsWebsites = await _getAzureCloudOdsHostedComponentsQuery.Execute(context); var instance = await _getCloudOdsHostedInstanceQuery.Execute(context.Instance); foreach (var cloudOdsWebsite in cloudOdsWebsites) { await _armClient.RestartAppService(_activeDirectoryClientInfo.SubscriptionId, instance.SystemName, cloudOdsWebsite.SystemName); } }
public async Task Execute(CloudOdsApiOperationContext context, CloudOdsApiWebsiteSettings newSettings) { var website = (await _getAzureCloudOdsHostedComponentsQuery.Execute(context)).Single(); var azureSettings = await _getAzureCloudOdsComponentApiWebsiteSettingsQuery.ExecuteRaw(context); foreach (var setting in newSettings.AsDictionary()) { azureSettings.Properties[setting.Key] = setting.Value; } var instance = await _getCloudOdsHostedInstanceQuery.Execute(context.Instance); await _armClient.SaveWebsiteSettingsAsync(_azureActiveDirectoryClientInfo.SubscriptionId, instance?.SystemName, website.SystemName, azureSettings); }
public async Task<StringDictionary> ExecuteRaw(CloudOdsApiOperationContext context) { if (context == null) throw new ArgumentNullException(nameof(context)); if (context.TargetEnvironment == null) throw new InvalidOperationException("You must provide a TargetEnvironment for this operation"); var website = Enumerable.Single<CloudOdsWebsite>((await _getAzureCloudOdsHostedComponentsQuery.Execute(context))); var instance = await _getCloudOdsHostedInstanceQuery.Execute(context.Instance); var settings = await _armClient.GetWebsiteSettingsAsync(_azureActiveDirectoryClientInfo.SubscriptionId, instance?.SystemName, website.SystemName); return settings; }
public async Task <AzureWebsitePerformanceLevel> Execute(ICloudOdsOperationContext context) { var websites = await _getAzureCloudOdsHostedComponentsQuery.ExecuteRaw(context); if (websites != null && websites.Any()) { var productionApiWebsite = websites.First(); var serverFarmId = productionApiWebsite.ServerFarmId; var instance = await _getCloudOdsHostedInstanceQuery.Execute(context.Instance); var website = await _armClient.GetServerFarmByIdAsync(_activeDirectoryClientInfo.SubscriptionId, instance?.SystemName, serverFarmId); return(new AzureWebsitePerformanceLevel(website.Sku.Tier, website.Sku.Size)); } return(null); }
public async Task <CloudOdsInstance> Execute(string instanceName) { var instance = await _getAzureCloudOdsHostedInstanceQuery.Execute(instanceName); return(instance == null ? null : MapAzureCloudOdsInstanceToCloudOdsInstance(instance)); }