Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/20/12 16:52:52 (13 years ago)
Author:
spimming
Message:

#1680:

  • Added property to refer to the corresponding subscription
  • Added new methods to azure management utils
Location:
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/AzureProvider.cs

    r7374 r7386  
    3636      }
    3737      return ServiceManagementOperation.GetSubscriptionInfo(subscriptionId, thumbprint);
     38    }
     39
     40    public HostedService GetHostedService(Subscription subscription, string serviceName) {
     41      if (subscription == null) {
     42        throw new ArgumentNullException("Subscription must not be null.", "subscription");
     43      }
     44      if (serviceName.Length == 0) {
     45        throw new ArgumentException("Servicename is not valid.", "serviceName");
     46      }
     47      return ServiceManagementOperation.GetHostedServiceDetailed(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName);
    3848    }
    3949
     
    119129
    120130    }
     131
     132    public string DeleteHostedService(Subscription subscription, string serviceName) {
     133      if (subscription == null) {
     134        throw new ArgumentNullException("Subscription must not be null.", "subscription");
     135      }
     136      if (serviceName.Length == 0) {
     137        throw new ArgumentException("Servicename is not valid.", "serviceName");
     138      }
     139
     140      return ServiceManagementOperation.DeleteHostedService(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName);
     141    }
     142
     143    public List<HostedService> DiscoverSlaveService(Subscription subscription) {
     144      if (subscription == null) {
     145        throw new ArgumentNullException("Subscription must not be null.", "subscription");
     146      }
     147      return ServiceManagementOperation.DiscoverSlaveService(subscription.SubscriptionID, subscription.CertificateThumbprint);
     148    }
    121149  }
    122150}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/IAzureProvider.cs

    r7374 r7386  
    2626  public interface IAzureProvider {
    2727    Subscription GetSubscriptionInfo(string subscriptionId, string thumbprint);
     28    HostedService GetHostedService(Subscription subscription, string serviceName);
    2829    List<string> ListLocations(Subscription subscription);
    2930    List<HostedService> ListHostedServices(Subscription subscription);
     
    3435    string CreateDeployment(Subscription subscription, string serviceName, string deploymentName, string deploymentSlot, string packageUrl, string configurationUrl, string label);
    3536    string CreateDeployment(Subscription subscription, string serviceName, string deploymentName, string deploymentSlot, string packageUrl, string configurationUrl, string label, int instanceCount);
     37    string DeleteHostedService(Subscription subscription, string serviceName);
     38
     39    List<HostedService> DiscoverSlaveService(Subscription subscription);
    3640  }
    3741}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs

    r7374 r7386  
    117117      service.ServiceName = response.Descendants(wa + "ServiceName").Single().Value;
    118118      service.Url = response.Descendants(wa + "Url").Single().Value;
     119      service.SubscriptionId = subscriptionId;
    119120      return service;
    120121    }
     
    127128      service.ServiceName = response.Descendants(wa + "ServiceName").Single().Value;
    128129      service.Url = response.Descendants(wa + "Url").First().Value;
     130      service.SubscriptionId = subscriptionId;
    129131      if (response.Root.Elements(wa + "HostedServiceProperties").Any()) {
    130132        XElement xHostedServiceProperties = response.Descendants(wa + "HostedServiceProperties").Single();
     
    210212    }
    211213
     214    public static List<HostedService> DiscoverSlaveService(string subscriptionId, string thumbprint) {
     215      List<HostedService> hostedServices = new List<HostedService>();
     216      foreach (HostedService hostedService in ListHostedServices(subscriptionId, thumbprint)) {
     217        HostedService hs = GetHostedServiceDetailed(subscriptionId, thumbprint, hostedService.ServiceName);
     218        foreach (Deployment deployment in hs.Deployments) {
     219          if (ContainsRoleNameInConfiguration(XDocument.Parse(deployment.Configuration), Constants.HLSlaveRoleName)) {
     220            if (!hostedServices.Contains(hs)) {
     221              hostedServices.Add(hs);
     222            }
     223          }
     224        }
     225      }
     226      return hostedServices;
     227    }
     228
     229    public static string DeleteHostedService(string subscriptionId, string thumbprint, string serviceName) {
     230      string uri = String.Format(Constants.URISpecificHostedServiceFormat, subscriptionId, serviceName);
     231      ServiceWebRequest operation = new ServiceWebRequest(thumbprint);
     232      string requestId = operation.Invoke(uri, Constants.HttpMethodDELETE);
     233      return requestId;
     234    }
     235
    212236    #endregion
    213237
Note: See TracChangeset for help on using the changeset viewer.