#region License Information /* HeuristicLab * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Collections.Generic; using HeuristicLab.Clients.Hive.CloudManager.Model; namespace HeuristicLab.Clients.Hive.CloudManager.Azure { public class AzureProvider : IAzureProvider { public Subscription GetSubscriptionInfo(string subscriptionId, string thumbprint) { if (subscriptionId.Length == 0) { throw new ArgumentException("Subscription Id is not valid.", "subscriptionId"); } if (thumbprint.Length == 0) { throw new ArgumentException("Certificate thumbprint is not valid.", "thumbprint"); } return ServiceManagementOperation.GetSubscriptionInfo(subscriptionId, thumbprint); } public List ListLocations(Subscription subscription) { if (subscription == null) { throw new ArgumentNullException("Subscription must not be null.", "subscription"); } return ServiceManagementOperation.ListLocations(subscription.SubscriptionID, subscription.CertificateThumbprint); } public List ListHostedServices(Subscription subscription) { if (subscription == null) { throw new ArgumentNullException("Subscription must not be null.", "subscription"); } return ServiceManagementOperation.ListHostedServices(subscription.SubscriptionID, subscription.CertificateThumbprint); } public List ListAffinityGroups(Subscription subscription) { if (subscription == null) { throw new ArgumentNullException("Subscription must not be null.", "subscription"); } return ServiceManagementOperation.ListAffinityGroups(subscription.SubscriptionID, subscription.CertificateThumbprint); } public string CreateHostedService(Subscription subscription, string serviceName, string label, string description, AffinityGroup affinityGroup) { if (subscription == null) { throw new ArgumentNullException("Subscription must not be null.", "subscription"); } if (serviceName.Length == 0) { throw new ArgumentException("Servicename is not valid.", "serviceName"); } if (label.Length == 0) { throw new ArgumentException("Label is not valid.", "label"); } if (affinityGroup == null) { throw new ArgumentNullException("AffinityGroup must not be null.", "affinityGroup"); } return ServiceManagementOperation.CreateHostedServiceWithAffinityGroup(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, label, description, affinityGroup.Name); } public string CreateHostedService(Subscription subscription, string serviceName, string label, string description, string location) { if (subscription == null) { throw new ArgumentNullException("Subscription must not be null.", "subscription"); } if (serviceName.Length == 0) { throw new ArgumentException("Servicename is not valid.", "serviceName"); } if (label.Length == 0) { throw new ArgumentException("Label is not valid.", "label"); } if (location.Length == 0) { throw new ArgumentException("Location is not valid.", "location"); } return ServiceManagementOperation.CreateHostedServiceWithLocation(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, label, description, location); } public string AddCertificate(Subscription subscription, HostedService service, string certficateFilePath, string certificatePassword) { if (subscription == null) { throw new ArgumentNullException("Subscription must not be null.", "subscription"); } if (service == null) { throw new ArgumentNullException("HostedService must not be null.", "service"); } return ServiceManagementOperation.AddCertificate(subscription.SubscriptionID, subscription.CertificateThumbprint, service.ServiceName, certficateFilePath, certificatePassword); } } }