/// <summary> /// Gets a list of hosted services that contain production deployments for the subscription /// </summary> /// <returns>A list of hosted services</returns> List<CloudService> IQueryCloudService.GetHostedServiceListContainingProductionDeployments() { // create a new service list var services = new List<CloudService>(); // build the hosted service list command here var command = new GetHostedServiceListCommand { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); // enumerate the collection to see whether any of the hosted services command.HostedServices.ForEach(a => { var serviceCommand = new GetHostedServiceContainsDeploymentCommand(a.Name) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; serviceCommand.Execute(); if (serviceCommand.ContainsProductionDeployment) { services.Add(a); } }); // return the new collection instead return services; }
/// <summary> /// Gets a list of hosted services within a particualr subscription /// </summary> /// <returns>A List<CloudService> collection</CloudService></returns> List<CloudService> IQueryCloudService.GetHostedServiceList() { // build the hosted service list command here var command = new GetHostedServiceListCommand { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); return command.HostedServices; }