Changeset 7374
- Timestamp:
- 01/19/12 17:45:21 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/AzureProvider.cs
r7354 r7374 103 103 } 104 104 105 public string CreateDeployment(Subscription subscription, string serviceName, string deploymentName, string deploymentSlot, string packageUrl, string configurationUrl, string label) { 106 return CreateDeployment(subscription, serviceName, deploymentName, deploymentSlot, packageUrl, configurationUrl, label, 1); 107 } 108 109 public string CreateDeployment(Subscription subscription, string serviceName, string deploymentName, string deploymentSlot, string packageUrl, string configurationUrl, string label, int instanceCount) { 110 if (subscription == null) { 111 throw new ArgumentNullException("Subscription must not be null.", "subscription"); 112 } 113 if (instanceCount <= 0) { 114 throw new ArgumentException("Instance count must be greater than zero.", "instanceCount"); 115 } 116 117 string configuration = ServiceManagementOperation.DownloadBlobAsString(new Uri(Constants.DeploymentConfigurationUrl)); 118 return ServiceManagementOperation.CreateDeployment(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, deploymentName, deploymentSlot, packageUrl, configuration, label, instanceCount); 119 120 } 105 121 } 106 122 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/Constants.cs
r7366 r7374 35 35 public const string APIVersion20111001 = "2011-10-01"; 36 36 public const string APIVersion20110225 = "2011-02-25"; 37 public const string APIVersion20110818 = "2011-08-18"; 37 38 38 39 #endregion … … 80 81 public const string DeploymentSlotProduction = "production"; 81 82 public const string DeploymentPackageUrl = "https://hivestorage.blob.core.windows.net/hiveslave/HeuristicLab.Clients.Hive.Slave.Azure.cspkg"; 82 public const string DeploymentConfigurationUrl = "files/ServiceConfiguration.Cloud.cscfg"; 83 public const string DeploymentConfigurationUrl = "https://hivestorage.blob.core.windows.net/hiveslave/ServiceConfiguration.Cloud.cscfg"; 84 public const string DeploymentConfigurationPath = "files/ServiceConfiguration.Cloud.cscfg"; 83 85 public const string DeploymentLabel = "HeuristicLab.Hive.Slave"; 84 86 -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/IAzureProvider.cs
r7354 r7374 32 32 string CreateHostedService(Subscription subscription, string serviceName, string label, string description, string location); 33 33 string AddCertificate(Subscription subscription, HostedService service, string certficateFilePath, string certificatePassword); 34 string CreateDeployment(Subscription subscription, string serviceName, string deploymentName, string deploymentSlot, string packageUrl, string configurationUrl, string label); 35 string CreateDeployment(Subscription subscription, string serviceName, string deploymentName, string deploymentSlot, string packageUrl, string configurationUrl, string label, int instanceCount); 34 36 } 35 37 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs
r7354 r7374 24 24 using System.IO; 25 25 using System.Linq; 26 using System.Net; 26 27 using System.Xml.Linq; 27 28 using HeuristicLab.Clients.Hive.CloudManager.Model; … … 185 186 } 186 187 187 188 public static string CreateDeployment(string subscriptionId, string thumbprint, string serviceName, string deploymentName, string deploymentSlot, string packageUrl, string configuration, string label, int instanceCount) { 189 string uri = String.Format(Constants.URIDeploymentFormat, subscriptionId, serviceName, deploymentSlot); 190 XElement xConfig = XElement.Parse(configuration); 191 SetInstanceCount(xConfig, Constants.HLSlaveRoleName, instanceCount); 192 193 XDocument payload = CreateDeploymentPayload(deploymentName, packageUrl, xConfig, label); 194 ServiceWebRequest operation = new ServiceWebRequest(thumbprint); 195 string requestId = operation.Invoke(uri, payload); 196 return requestId; 197 } 198 199 public static string DownloadBlobAsString(Uri uri) { 200 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); 201 request.Headers.Add(Constants.HeaderVersionName, Constants.APIVersion20110818); 202 request.Method = Constants.HttpMethodGET; 203 request.ContentType = Constants.ContentTypeAppXml; 204 string result = string.Empty; 205 WebResponse response = request.GetResponse(); 206 using (StreamReader reader = new StreamReader(response.GetResponseStream())) { 207 result = reader.ReadToEnd(); 208 } 209 return result; 210 } 188 211 189 212 #endregion -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs
r7366 r7374 3 3 using System.ComponentModel; 4 4 using System.Windows.Forms; 5 using HeuristicLab.Clients.Hive.CloudManager.Azure; 5 6 using HeuristicLab.Clients.Hive.CloudManager.Model; 6 7 using HeuristicLab.Core; … … 41 42 SetGroupBoxControlsEnabled(gbNewHostedService, cbNewHostedService.Checked); 42 43 } 44 45 certificateFile = string.Empty; 46 certificatePassword = string.Empty; 43 47 44 48 workerUpdate = new BackgroundWorker(); … … 224 228 int instanceCount = parameters.Item7; 225 229 226 // STEP 1 - Create Hosted Service230 // STEP 1 - Create Hosted Service 227 231 if (newHostedServiceChecked) { 228 232 if (regionChecked) { … … 232 236 } 233 237 } 238 239 // STEP 2 - Add Certificate 240 if (certFile != string.Empty) { 241 CloudManagerClient.Instance.AzureProvider.AddCertificate(sub, hostedService, certFile, certPw); 242 } 243 244 // STEP 3 - Create Deployment 245 CloudManagerClient.Instance.AzureProvider.CreateDeployment(sub, hostedService.ServiceName, Guid.NewGuid().ToString(), Constants.DeploymentSlotStaging, Constants.DeploymentPackageUrl, Constants.DeploymentConfigurationUrl, Constants.DeploymentLabel, instanceCount); 234 246 235 247 }
Note: See TracChangeset
for help on using the changeset viewer.