1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Net;
|
---|
24 | using System.Xml.Linq;
|
---|
25 | namespace HeuristicLab.Clients.Hive.CloudManager.Azure {
|
---|
26 | public static class Constants {
|
---|
27 | #region HeuristicLab
|
---|
28 |
|
---|
29 | public const string HLSlaveRoleName = "HeuristicLab.Clients.Hive.Slave.AzureClient";
|
---|
30 |
|
---|
31 | #endregion
|
---|
32 |
|
---|
33 | #region Service Management Versioning
|
---|
34 | // see: http://msdn.microsoft.com/en-us/library/windowsazure/gg592580.aspx
|
---|
35 |
|
---|
36 | public const string APIVersionDefault = APIVersion20111001;
|
---|
37 | public const string APIVersion20111001 = "2011-10-01";
|
---|
38 | public const string APIVersion20110225 = "2011-02-25";
|
---|
39 | public const string APIVersion20110818 = "2011-08-18";
|
---|
40 |
|
---|
41 | #endregion
|
---|
42 |
|
---|
43 | #region Namespaces
|
---|
44 |
|
---|
45 | public static XNamespace NSWindowsAzure { get { return "http://schemas.microsoft.com/windowsazure"; } }
|
---|
46 | public static XNamespace NSSchemaMicrosoft { get { return "http://schemas.microsoft.com/"; } }
|
---|
47 | public static XNamespace NSServiceConfiguration { get { return "http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"; } }
|
---|
48 |
|
---|
49 | #endregion
|
---|
50 |
|
---|
51 | #region Web Request
|
---|
52 |
|
---|
53 | public const string HeaderRequestId = "x-ms-request-id";
|
---|
54 | public const string HeaderVersionName = "x-ms-version";
|
---|
55 | public const string ContentTypeAppXml = "application/xml";
|
---|
56 |
|
---|
57 | public const string HttpMethodPOST = "POST";
|
---|
58 | public const string HttpMethodGET = "GET";
|
---|
59 | public const string HttpMethodDELETE = "DELETE";
|
---|
60 |
|
---|
61 | #endregion
|
---|
62 |
|
---|
63 | #region Service Management URIs
|
---|
64 | // see: http://msdn.microsoft.com/en-us/library/ee460786.aspx
|
---|
65 |
|
---|
66 | public const string URISubscriptionFormat = "https://management.core.windows.net/{0}";
|
---|
67 | public const string URIHostedServiceFormat = "https://management.core.windows.net/{0}/services/hostedservices";
|
---|
68 | public const string URISpecificHostedServiceFormat = "https://management.core.windows.net/{0}/services/hostedservices/{1}";
|
---|
69 | public const string URIStorageServiceFormat = "https://management.core.windows.net/{0}/services/storageservices";
|
---|
70 | public const string URISpecificStorageServiceFormat = "https://management.core.windows.net/{0}/services/storageservices/{1}";
|
---|
71 | public const string URIStorageServiceKeys = "https://management.core.windows.net/{0}/services/storageservices/{1}/keys";
|
---|
72 | public const string URILocationsFormat = "https://management.core.windows.net/{0}/locations";
|
---|
73 | public const string URIAffinityGroupFormat = "https://management.core.windows.net/{0}/affinitygroups";
|
---|
74 | public const string URICertificateFormat = "https://management.core.windows.net/{0}/services/hostedservices/{1}/certificates";
|
---|
75 | public const string URIDeploymentFormat = "https://management.core.windows.net/{0}/services/hostedservices/{1}/deploymentslots/{2}";
|
---|
76 | public const string URISpecificDeploymentFormat = "https://management.core.windows.net/{0}/services/hostedservices/{1}/deployments/{2}";
|
---|
77 | public const string URIDeploymentConfigurationFormat = "https://management.core.windows.net/{0}/services/hostedservices/{1}/deploymentslots/{2}/?comp=config";
|
---|
78 | public const string URISpecificDeploymentConfigurationFormat = "https://management.core.windows.net/{0}/services/hostedservices/{1}/deployments/{2}/?comp=config";
|
---|
79 | public const string URIChangeDeploymentStatusFormat = "https://management.core.windows.net/{0}/services/hostedservices/{1}/deployments/{2}/?comp=status";
|
---|
80 | public const string URIGetOperationStatusFormat = "https://management.core.windows.net/{0}/operations/{1}";
|
---|
81 |
|
---|
82 | #endregion
|
---|
83 |
|
---|
84 | #region Connection Strings
|
---|
85 |
|
---|
86 | public const string StorageServiceConnectionFormat = "AccountName={0};AccountKey={1};DefaultEndpointsProtocol=https";
|
---|
87 |
|
---|
88 | #endregion
|
---|
89 |
|
---|
90 | #region Deployment
|
---|
91 |
|
---|
92 | public const string DeploymentSlotStaging = "staging";
|
---|
93 | public const string DeploymentSlotProduction = "production";
|
---|
94 | public const string DeploymentPackageUrl = "https://hivestorage.blob.core.windows.net/hiveslave/HeuristicLab.Clients.Hive.Slave.Azure.cspkg";
|
---|
95 | public const string DeploymentConfigurationUrl = "https://hivestorage.blob.core.windows.net/hiveslave/ServiceConfiguration.Cloud.cscfg";
|
---|
96 |
|
---|
97 | public const string DeploymentLabel = "HeuristicLab.Hive.Slave";
|
---|
98 | public const string DeploymentRoleName = "HeuristicLab.Clients.Hive.Slave.AzureClient";
|
---|
99 |
|
---|
100 | public const string DeploymentConfigurationPath = "PackageFiles/ServiceConfiguration.Cloud.cscfg";
|
---|
101 | public const string DeploymentPackagePathSmall = "PackageFiles/HeuristicLab.Clients.Hive.Slave.Azure.Small.cspkg";
|
---|
102 | public const string DeploymentPackagePathMedium = "PackageFiles/HeuristicLab.Clients.Hive.Slave.Azure.Medium.cspkg";
|
---|
103 | public const string DeploymentPackagePathLarge = "PackageFiles/HeuristicLab.Clients.Hive.Slave.Azure.Large.cspkg";
|
---|
104 | public const string DeploymentPackagePathExtraLarge = "PackageFiles/HeuristicLab.Clients.Hive.Slave.Azure.ExtraLarge.cspkg";
|
---|
105 |
|
---|
106 | #endregion
|
---|
107 |
|
---|
108 | #region Enums
|
---|
109 |
|
---|
110 | public enum InstanceSize {
|
---|
111 | ExtraSmall = 0,
|
---|
112 | Small = 1,
|
---|
113 | Medium = 2,
|
---|
114 | Large = 4,
|
---|
115 | ExtraLarge = 8
|
---|
116 | }
|
---|
117 |
|
---|
118 | public enum OperationStatus {
|
---|
119 | InProgress,
|
---|
120 | Failed,
|
---|
121 | Succeeded,
|
---|
122 | TimedOut
|
---|
123 | }
|
---|
124 |
|
---|
125 | #endregion
|
---|
126 |
|
---|
127 | #region Structs
|
---|
128 |
|
---|
129 | public struct OperationResult {
|
---|
130 | public Constants.OperationStatus Status { get; set; }
|
---|
131 | public HttpStatusCode StatusCode { get; set; }
|
---|
132 | public TimeSpan RunningTime { get; set; }
|
---|
133 | public string Code { get; set; }
|
---|
134 | public string Message { get; set; }
|
---|
135 | }
|
---|
136 |
|
---|
137 | #endregion
|
---|
138 | }
|
---|
139 | }
|
---|