azureEnvironment.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License. See License.txt in the project root for license information.
  3. var Environment = /** @class */ (function () {
  4. function Environment(parameters) {
  5. /**
  6. * Determines whether the authentication endpoint should be validated with Azure AD. Default value is true.
  7. */
  8. this.validateAuthority = true;
  9. if (!parameters || typeof parameters !== "object") {
  10. throw new Error("'parameters' is a required parameter and must be of type 'object'.");
  11. }
  12. // Validate required parameters
  13. var requiredParams = ["name", "portalUrl", "managementEndpointUrl", "resourceManagerEndpointUrl",
  14. "activeDirectoryEndpointUrl", "activeDirectoryResourceId"];
  15. requiredParams.forEach(function (param) {
  16. if (!parameters[param] || typeof parameters[param].valueOf() !== "string") {
  17. throw new Error("Please provide \"" + param + "\" for the environment and it must be of type \"string\".");
  18. }
  19. });
  20. this.name = parameters.name;
  21. this.portalUrl = parameters.portalUrl;
  22. this.managementEndpointUrl = parameters.managementEndpointUrl;
  23. this.resourceManagerEndpointUrl = parameters.resourceManagerEndpointUrl;
  24. this.activeDirectoryEndpointUrl = parameters.activeDirectoryEndpointUrl;
  25. this.activeDirectoryResourceId = parameters.activeDirectoryResourceId;
  26. if (this.activeDirectoryGraphApiVersion) {
  27. this.activeDirectoryGraphApiVersion = parameters.activeDirectoryGraphApiVersion;
  28. }
  29. if (this.activeDirectoryGraphResourceId) {
  30. this.activeDirectoryGraphResourceId = parameters.activeDirectoryGraphResourceId;
  31. }
  32. if (this.azureDataLakeAnalyticsCatalogAndJobEndpointSuffix) {
  33. this.azureDataLakeAnalyticsCatalogAndJobEndpointSuffix = parameters.azureDataLakeAnalyticsCatalogAndJobEndpointSuffix;
  34. }
  35. if (this.azureDataLakeStoreFileSystemEndpointSuffix) {
  36. this.azureDataLakeStoreFileSystemEndpointSuffix = parameters.azureDataLakeStoreFileSystemEndpointSuffix;
  37. }
  38. if (this.batchResourceId) {
  39. this.batchResourceId = parameters.batchResourceId;
  40. }
  41. if (this.galleryEndpointUrl) {
  42. this.galleryEndpointUrl = parameters.galleryEndpointUrl;
  43. }
  44. if (this.keyVaultDnsSuffix) {
  45. this.keyVaultDnsSuffix = parameters.keyVaultDnsSuffix;
  46. }
  47. if (this.publishingProfileUrl) {
  48. this.publishingProfileUrl = parameters.publishingProfileUrl;
  49. }
  50. if (this.sqlManagementEndpointUrl) {
  51. this.sqlManagementEndpointUrl = parameters.sqlManagementEndpointUrl;
  52. }
  53. if (this.sqlServerHostnameSuffix) {
  54. this.sqlServerHostnameSuffix = parameters.sqlServerHostnameSuffix;
  55. }
  56. if (this.storageEndpointSuffix) {
  57. this.storageEndpointSuffix = parameters.storageEndpointSuffix;
  58. }
  59. }
  60. Environment.add = function (parameters) {
  61. var envContainer = {};
  62. var envObj = new Environment(parameters);
  63. envContainer[parameters.name] = envObj;
  64. Object.assign(Environment, envContainer);
  65. return;
  66. };
  67. Environment.get = function (name) {
  68. if (!name) {
  69. throw new TypeError("name cannot be null or undefined and must be of type string.");
  70. }
  71. return Environment[name];
  72. };
  73. Environment.AzureCloud = {
  74. name: "AzureCloud",
  75. portalUrl: "https://portal.azure.com",
  76. publishingProfileUrl: "https://go.microsoft.com/fwlink/?LinkId=254432",
  77. managementEndpointUrl: "https://management.core.windows.net",
  78. resourceManagerEndpointUrl: "https://management.azure.com/",
  79. sqlManagementEndpointUrl: "https://management.core.windows.net:8443/",
  80. sqlServerHostnameSuffix: ".database.windows.net",
  81. galleryEndpointUrl: "https://gallery.azure.com/",
  82. activeDirectoryEndpointUrl: "https://login.microsoftonline.com/",
  83. activeDirectoryResourceId: "https://management.core.windows.net/",
  84. activeDirectoryGraphResourceId: "https://graph.windows.net/",
  85. batchResourceId: "https://batch.core.windows.net/",
  86. activeDirectoryGraphApiVersion: "2013-04-05",
  87. storageEndpointSuffix: ".core.windows.net",
  88. keyVaultDnsSuffix: ".vault.azure.net",
  89. azureDataLakeStoreFileSystemEndpointSuffix: "azuredatalakestore.net",
  90. azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "azuredatalakeanalytics.net",
  91. validateAuthority: true
  92. };
  93. Environment.ChinaCloud = {
  94. name: "AzureChinaCloud",
  95. portalUrl: "https://portal.azure.cn",
  96. publishingProfileUrl: "https://go.microsoft.com/fwlink/?LinkID=301774",
  97. managementEndpointUrl: "https://management.core.chinacloudapi.cn",
  98. resourceManagerEndpointUrl: "https://management.chinacloudapi.cn",
  99. sqlManagementEndpointUrl: "https://management.core.chinacloudapi.cn:8443/",
  100. sqlServerHostnameSuffix: ".database.chinacloudapi.cn",
  101. galleryEndpointUrl: "https://gallery.chinacloudapi.cn/",
  102. activeDirectoryEndpointUrl: "https://login.chinacloudapi.cn/",
  103. activeDirectoryResourceId: "https://management.core.chinacloudapi.cn/",
  104. activeDirectoryGraphResourceId: "https://graph.chinacloudapi.cn/",
  105. activeDirectoryGraphApiVersion: "2013-04-05",
  106. batchResourceId: "https://batch.chinacloudapi.cn/",
  107. storageEndpointSuffix: ".core.chinacloudapi.cn",
  108. keyVaultDnsSuffix: ".vault.azure.cn",
  109. // TODO: add dns suffixes for the china cloud for datalake store and datalake analytics once they are defined.
  110. azureDataLakeStoreFileSystemEndpointSuffix: "N/A",
  111. azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "N/A",
  112. validateAuthority: true
  113. };
  114. Environment.USGovernment = {
  115. name: "AzureUSGovernment",
  116. portalUrl: "https://portal.azure.us",
  117. publishingProfileUrl: "https://manage.windowsazure.us/publishsettings/index",
  118. managementEndpointUrl: "https://management.core.usgovcloudapi.net",
  119. resourceManagerEndpointUrl: "https://management.usgovcloudapi.net",
  120. sqlManagementEndpointUrl: "https://management.core.usgovcloudapi.net:8443/",
  121. sqlServerHostnameSuffix: ".database.usgovcloudapi.net",
  122. galleryEndpointUrl: "https://gallery.usgovcloudapi.net/",
  123. activeDirectoryEndpointUrl: "https://login.microsoftonline.us/",
  124. activeDirectoryResourceId: "https://management.core.usgovcloudapi.net/",
  125. activeDirectoryGraphResourceId: "https://graph.windows.net/",
  126. batchResourceId: "https://batch.core.usgovcloudapi.net/",
  127. activeDirectoryGraphApiVersion: "2013-04-05",
  128. storageEndpointSuffix: ".core.usgovcloudapi.net",
  129. keyVaultDnsSuffix: ".vault.usgovcloudapi.net",
  130. azureDataLakeStoreFileSystemEndpointSuffix: "N/A",
  131. azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "N/A",
  132. validateAuthority: true
  133. };
  134. Environment.GermanCloud = {
  135. name: "AzureGermanCloud",
  136. portalUrl: "https://portal.microsoftazure.de/",
  137. publishingProfileUrl: "https://manage.microsoftazure.de/publishsettings/index",
  138. managementEndpointUrl: "https://management.core.cloudapi.de",
  139. resourceManagerEndpointUrl: "https://management.microsoftazure.de",
  140. sqlManagementEndpointUrl: "https://management.core.cloudapi.de:8443/",
  141. sqlServerHostnameSuffix: ".database.cloudapi.de",
  142. galleryEndpointUrl: "https://gallery.cloudapi.de/",
  143. activeDirectoryEndpointUrl: "https://login.microsoftonline.de/",
  144. activeDirectoryResourceId: "https://management.core.cloudapi.de/",
  145. activeDirectoryGraphResourceId: "https://graph.cloudapi.de/",
  146. batchResourceId: "https://batch.microsoftazure.de/",
  147. activeDirectoryGraphApiVersion: "2013-04-05",
  148. storageEndpointSuffix: ".core.cloudapi.de",
  149. keyVaultDnsSuffix: ".vault.microsoftazure.de",
  150. azureDataLakeStoreFileSystemEndpointSuffix: "N/A",
  151. azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "N/A",
  152. validateAuthority: true
  153. };
  154. return Environment;
  155. }());
  156. export { Environment };
  157. //# sourceMappingURL=azureEnvironment.js.map