msRestAzureEnv.js 9.4 KB

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