Changeset 7354
- Timestamp:
- 01/18/12 09:41:57 (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
r7339 r7354 40 40 public List<string> ListLocations(Subscription subscription) { 41 41 if (subscription == null) { 42 throw new Argument Exception("Subscription must not be null.", "subscription");42 throw new ArgumentNullException("Subscription must not be null.", "subscription"); 43 43 } 44 44 return ServiceManagementOperation.ListLocations(subscription.SubscriptionID, subscription.CertificateThumbprint); … … 47 47 public List<HostedService> ListHostedServices(Subscription subscription) { 48 48 if (subscription == null) { 49 throw new Argument Exception("Subscription must not be null.", "subscription");49 throw new ArgumentNullException("Subscription must not be null.", "subscription"); 50 50 } 51 51 return ServiceManagementOperation.ListHostedServices(subscription.SubscriptionID, subscription.CertificateThumbprint); … … 54 54 public List<AffinityGroup> ListAffinityGroups(Subscription subscription) { 55 55 if (subscription == null) { 56 throw new Argument Exception("Subscription must not be null.", "subscription");56 throw new ArgumentNullException("Subscription must not be null.", "subscription"); 57 57 } 58 58 return ServiceManagementOperation.ListAffinityGroups(subscription.SubscriptionID, subscription.CertificateThumbprint); 59 59 } 60 61 public string CreateHostedService(Subscription subscription, string serviceName, string label, string description, AffinityGroup affinityGroup) { 62 if (subscription == null) { 63 throw new ArgumentNullException("Subscription must not be null.", "subscription"); 64 } 65 if (serviceName.Length == 0) { 66 throw new ArgumentException("Servicename is not valid.", "serviceName"); 67 } 68 if (label.Length == 0) { 69 throw new ArgumentException("Label is not valid.", "label"); 70 } 71 if (affinityGroup == null) { 72 throw new ArgumentNullException("AffinityGroup must not be null.", "affinityGroup"); 73 } 74 75 return ServiceManagementOperation.CreateHostedServiceWithAffinityGroup(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, label, description, affinityGroup.Name); 76 } 77 78 public string CreateHostedService(Subscription subscription, string serviceName, string label, string description, string location) { 79 if (subscription == null) { 80 throw new ArgumentNullException("Subscription must not be null.", "subscription"); 81 } 82 if (serviceName.Length == 0) { 83 throw new ArgumentException("Servicename is not valid.", "serviceName"); 84 } 85 if (label.Length == 0) { 86 throw new ArgumentException("Label is not valid.", "label"); 87 } 88 if (location.Length == 0) { 89 throw new ArgumentException("Location is not valid.", "location"); 90 } 91 92 return ServiceManagementOperation.CreateHostedServiceWithLocation(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, label, description, location); 93 } 94 95 public string AddCertificate(Subscription subscription, HostedService service, string certficateFilePath, string certificatePassword) { 96 if (subscription == null) { 97 throw new ArgumentNullException("Subscription must not be null.", "subscription"); 98 } 99 if (service == null) { 100 throw new ArgumentNullException("HostedService must not be null.", "service"); 101 } 102 return ServiceManagementOperation.AddCertificate(subscription.SubscriptionID, subscription.CertificateThumbprint, service.ServiceName, certficateFilePath, certificatePassword); 103 } 104 60 105 } 61 106 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/IAzureProvider.cs
r7339 r7354 29 29 List<HostedService> ListHostedServices(Subscription subscription); 30 30 List<AffinityGroup> ListAffinityGroups(Subscription subscription); 31 31 string CreateHostedService(Subscription subscription, string serviceName, string label, string description, AffinityGroup affinityGroup); 32 string CreateHostedService(Subscription subscription, string serviceName, string label, string description, string location); 33 string AddCertificate(Subscription subscription, HostedService service, string certficateFilePath, string certificatePassword); 32 34 } 33 35 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs
r7339 r7354 169 169 } 170 170 171 public static string AddCertificate(string subscriptionId, string thumbprint, string serviceName, string certificateFilePath, string password) { 172 string uri = String.Format(Constants.URICertificateFormat, subscriptionId, serviceName); 173 XDocument payload = CreateAddCertificatePayload(certificateFilePath, password); 174 ServiceWebRequest operation = new ServiceWebRequest(thumbprint); 175 string requestId = operation.Invoke(uri, payload); 176 return requestId; 177 } 178 179 public static string CreateHostedServiceWithLocation(string subscriptionId, string thumbprint, string serviceName, string label, string description, string location) { 180 return CreateHostedService(subscriptionId, thumbprint, serviceName, label, description, location, String.Empty); 181 } 182 183 public static string CreateHostedServiceWithAffinityGroup(string subscriptionId, string thumbprint, string serviceName, string label, string description, string affinityGroup) { 184 return CreateHostedService(subscriptionId, thumbprint, serviceName, label, description, String.Empty, affinityGroup); 185 } 186 187 188 171 189 #endregion 172 190 -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs
r7339 r7354 30 30 this.gbNewHostedService = new System.Windows.Forms.GroupBox(); 31 31 this.cmbAffinityGroup = new System.Windows.Forms.ComboBox(); 32 this.cmb Region = new System.Windows.Forms.ComboBox();32 this.cmbLocation = new System.Windows.Forms.ComboBox(); 33 33 this.rbAffinitGroup = new System.Windows.Forms.RadioButton(); 34 34 this.rbRegion = new System.Windows.Forms.RadioButton(); 35 35 this.label6 = new System.Windows.Forms.Label(); 36 36 this.label5 = new System.Windows.Forms.Label(); 37 this.tb URLPrefix= new System.Windows.Forms.TextBox();37 this.tbServiceName = new System.Windows.Forms.TextBox(); 38 38 this.label4 = new System.Windows.Forms.Label(); 39 this.tb ServiceName= new System.Windows.Forms.TextBox();39 this.tbLabel = new System.Windows.Forms.TextBox(); 40 40 this.label3 = new System.Windows.Forms.Label(); 41 41 this.cbNewHostedService = new System.Windows.Forms.CheckBox(); 42 42 this.label7 = new System.Windows.Forms.Label(); 43 43 this.panelDeploymentOptions = new System.Windows.Forms.Panel(); 44 this.rbDeployToProduction = new System.Windows.Forms.RadioButton(); 44 45 this.rbDeployToStaging = new System.Windows.Forms.RadioButton(); 45 this.rbDeployToProduction = new System.Windows.Forms.RadioButton();46 46 this.btnAddCertificate = new System.Windows.Forms.Button(); 47 47 this.label9 = new System.Windows.Forms.Label(); … … 94 94 // 95 95 this.gbNewHostedService.Controls.Add(this.cmbAffinityGroup); 96 this.gbNewHostedService.Controls.Add(this.cmb Region);96 this.gbNewHostedService.Controls.Add(this.cmbLocation); 97 97 this.gbNewHostedService.Controls.Add(this.rbAffinitGroup); 98 98 this.gbNewHostedService.Controls.Add(this.rbRegion); 99 99 this.gbNewHostedService.Controls.Add(this.label6); 100 100 this.gbNewHostedService.Controls.Add(this.label5); 101 this.gbNewHostedService.Controls.Add(this.tb URLPrefix);101 this.gbNewHostedService.Controls.Add(this.tbServiceName); 102 102 this.gbNewHostedService.Controls.Add(this.label4); 103 this.gbNewHostedService.Controls.Add(this.tb ServiceName);103 this.gbNewHostedService.Controls.Add(this.tbLabel); 104 104 this.gbNewHostedService.Controls.Add(this.label3); 105 105 this.gbNewHostedService.Location = new System.Drawing.Point(15, 115); … … 118 118 this.cmbAffinityGroup.TabIndex = 9; 119 119 // 120 // cmb Region121 // 122 this.cmb Region.FormattingEnabled = true;123 this.cmb Region.Location = new System.Drawing.Point(29, 110);124 this.cmb Region.Name = "cmbRegion";125 this.cmb Region.Size = new System.Drawing.Size(200, 21);126 this.cmb Region.TabIndex = 8;120 // cmbLocation 121 // 122 this.cmbLocation.FormattingEnabled = true; 123 this.cmbLocation.Location = new System.Drawing.Point(29, 110); 124 this.cmbLocation.Name = "cmbLocation"; 125 this.cmbLocation.Size = new System.Drawing.Size(200, 21); 126 this.cmbLocation.TabIndex = 8; 127 127 // 128 128 // rbAffinitGroup … … 164 164 this.label5.Text = ".cloudapp.net"; 165 165 // 166 // tb URLPrefix167 // 168 this.tb URLPrefix.Location = new System.Drawing.Point(9, 71);169 this.tb URLPrefix.Name = "tbURLPrefix";170 this.tb URLPrefix.Size = new System.Drawing.Size(377, 20);171 this.tb URLPrefix.TabIndex = 3;166 // tbServiceName 167 // 168 this.tbServiceName.Location = new System.Drawing.Point(9, 71); 169 this.tbServiceName.Name = "tbServiceName"; 170 this.tbServiceName.Size = new System.Drawing.Size(377, 20); 171 this.tbServiceName.TabIndex = 3; 172 172 // 173 173 // label4 … … 180 180 this.label4.Text = "Enter a URL prefix for your service"; 181 181 // 182 // tb ServiceName183 // 184 this.tb ServiceName.Location = new System.Drawing.Point(9, 32);185 this.tb ServiceName.Name = "tbServiceName";186 this.tb ServiceName.Size = new System.Drawing.Size(453, 20);187 this.tb ServiceName.TabIndex = 1;182 // tbLabel 183 // 184 this.tbLabel.Location = new System.Drawing.Point(9, 32); 185 this.tbLabel.Name = "tbLabel"; 186 this.tbLabel.Size = new System.Drawing.Size(453, 20); 187 this.tbLabel.TabIndex = 1; 188 188 // 189 189 // label3 … … 225 225 this.panelDeploymentOptions.TabIndex = 10; 226 226 // 227 // rbDeployToStaging228 //229 this.rbDeployToStaging.AutoSize = true;230 this.rbDeployToStaging.Location = new System.Drawing.Point(0, 4);231 this.rbDeployToStaging.Name = "rbDeployToStaging";232 this.rbDeployToStaging.Size = new System.Drawing.Size(168, 17);233 this.rbDeployToStaging.TabIndex = 0;234 this.rbDeployToStaging.TabStop = true;235 this.rbDeployToStaging.Text = "Deploy to staging environment";236 this.rbDeployToStaging.UseVisualStyleBackColor = true;237 //238 227 // rbDeployToProduction 239 228 // … … 246 235 this.rbDeployToProduction.Text = "Deyploy to production environment"; 247 236 this.rbDeployToProduction.UseVisualStyleBackColor = true; 237 // 238 // rbDeployToStaging 239 // 240 this.rbDeployToStaging.AutoSize = true; 241 this.rbDeployToStaging.Checked = true; 242 this.rbDeployToStaging.Location = new System.Drawing.Point(0, 4); 243 this.rbDeployToStaging.Name = "rbDeployToStaging"; 244 this.rbDeployToStaging.Size = new System.Drawing.Size(168, 17); 245 this.rbDeployToStaging.TabIndex = 0; 246 this.rbDeployToStaging.TabStop = true; 247 this.rbDeployToStaging.Text = "Deploy to staging environment"; 248 this.rbDeployToStaging.UseVisualStyleBackColor = true; 248 249 // 249 250 // btnAddCertificate … … 360 361 private System.Windows.Forms.GroupBox gbNewHostedService; 361 362 private System.Windows.Forms.ComboBox cmbAffinityGroup; 362 private System.Windows.Forms.ComboBox cmb Region;363 private System.Windows.Forms.ComboBox cmbLocation; 363 364 private System.Windows.Forms.RadioButton rbAffinitGroup; 364 365 private System.Windows.Forms.RadioButton rbRegion; 365 366 private System.Windows.Forms.Label label6; 366 367 private System.Windows.Forms.Label label5; 367 private System.Windows.Forms.TextBox tb URLPrefix;368 private System.Windows.Forms.TextBox tbServiceName; 368 369 private System.Windows.Forms.Label label4; 369 private System.Windows.Forms.TextBox tb ServiceName;370 private System.Windows.Forms.TextBox tbLabel; 370 371 private System.Windows.Forms.Label label3; 371 372 private System.Windows.Forms.CheckBox cbNewHostedService; -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs
r7339 r7354 14 14 private BindingList<AffinityGroup> affinityGroups; 15 15 16 private BackgroundWorker worker = new BackgroundWorker(); 16 private BackgroundWorker worker; 17 18 private bool isInitializing; 19 private bool bwCompleted; 20 private bool closePending; 17 21 18 22 public AddAzureServiceDialog(IItemList<Subscription> subs) { 19 23 InitializeComponent(); 24 isInitializing = true; 20 25 21 26 this.subscriptions = new BindingList<Subscription>(subs); 27 this.hostedServices = new BindingList<HostedService>(); 28 this.locations = new BindingList<string>(); 29 this.affinityGroups = new BindingList<AffinityGroup>(); 22 30 31 SetLookupBinding(cmbLocation, locations, "", ""); 32 SetLookupBinding(cmbAffinityGroup, affinityGroups, "Label", "Name"); 33 SetLookupBinding(cmbChooseHostedService, hostedServices, "ServiceName", "ServiceName"); 23 34 SetLookupBinding(cmbChooseSubscription, subscriptions, "SubscriptionName", "SubscriptionID"); 24 SetLookupBinding(cmbChooseHostedService, hostedServices, "ServiceName", "ServiceName");25 SetLookupBinding(cmbRegion, locations, "", "");26 SetLookupBinding(cmbAffinityGroup, affinityGroups, "Label", "Name");27 35 28 36 if (!cbNewHostedService.Checked) { … … 30 38 } 31 39 40 worker = new BackgroundWorker(); 32 41 worker.DoWork += new DoWorkEventHandler(UpdateTask); 33 42 worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted); 43 44 45 isInitializing = false; 46 cmbChooseSubscription_SelectedValueChanged(this, EventArgs.Empty); 47 } 48 49 protected override void OnFormClosing(FormClosingEventArgs e) { 50 if (!bwCompleted) { 51 worker.CancelAsync(); 52 this.Enabled = false; 53 e.Cancel = true; 54 closePending = true; 55 } 34 56 } 35 57 … … 61 83 } 62 84 85 private void UpdateBindingList<T>(BindingList<T> bindinglist, List<T> list) { 86 if (list != null) { 87 bindinglist.Clear(); 88 foreach (T item in list) 89 bindinglist.Add(item); 90 } 91 } 92 63 93 private void cbNewHostedService_CheckedChanged(object sender, EventArgs e) { 64 94 if (cbNewHostedService.Checked) { … … 81 111 82 112 private void cmbChooseSubscription_SelectedValueChanged(object sender, EventArgs e) { 83 Subscription item = (Subscription)cmbChooseSubscription.SelectedItem; 84 if (item != null) { 85 progressBar.Visible = true; 86 worker.RunWorkerAsync(item); 113 if (!isInitializing) { 114 Subscription item = (Subscription)cmbChooseSubscription.SelectedItem; 115 if (item != null) { 116 progressBar.Visible = true; 117 worker.RunWorkerAsync(item); 118 } 87 119 } 88 120 } … … 101 133 private void btnOk_Click(object sender, EventArgs e) { 102 134 if (cmbChooseSubscription.SelectedItem != null) { 103 // TODO 135 if (cbNewHostedService.Checked) { 136 if (rbRegion.Checked) { 137 string serviceName = tbServiceName.Text; 138 string label = tbLabel.Text; 139 string location = (string)cmbLocation.SelectedItem; 140 Subscription sub = (Subscription)cmbChooseSubscription.SelectedItem; 141 CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, serviceName, label, "Hosted service for hive slave", location); 142 } else { 143 // rbAffinitGroup.Checked 144 } 145 } 146 104 147 } 105 148 } … … 113 156 this.Invoke((MethodInvoker)delegate { lblCores.Text = item.CurrentCoreCount + " / " + item.MaxCoreCount; }); 114 157 115 SetBindingList<HostedService>(ref hostedServices, CloudManagerClient.Instance.AzureProvider.ListHostedServices(item)); 116 SetBindingList<string>(ref locations, CloudManagerClient.Instance.AzureProvider.ListLocations(item)); 117 SetBindingList<AffinityGroup>(ref affinityGroups, CloudManagerClient.Instance.AzureProvider.ListAffinityGroups(item)); 158 List<HostedService> services = CloudManagerClient.Instance.AzureProvider.ListHostedServices(item); 159 List<string> locs = CloudManagerClient.Instance.AzureProvider.ListLocations(item); 160 List<AffinityGroup> groups = CloudManagerClient.Instance.AzureProvider.ListAffinityGroups(item); 161 162 this.Invoke((MethodInvoker)delegate { UpdateBindingList<HostedService>(hostedServices, services); }); 163 this.Invoke((MethodInvoker)delegate { UpdateBindingList<string>(locations, locs); }); 164 this.Invoke((MethodInvoker)delegate { UpdateBindingList<AffinityGroup>(affinityGroups, groups); }); 118 165 119 166 SetAllControlsEnabled(this, true); … … 126 173 private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 127 174 this.Invoke((MethodInvoker)delegate { progressBar.Visible = false; }); 175 bwCompleted = true; 176 if (closePending) { 177 this.Close(); 178 } 128 179 } 129 180 }
Note: See TracChangeset
for help on using the changeset viewer.