| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- // Copyright (c) Microsoft Corporation. All rights reserved.
- // Licensed under the MIT License. See License.txt in the project root for license information.
- export interface EnvironmentParameters {
- /**
- * The Environment name.
- */
- readonly name: string;
- /**
- * The management portal URL.
- */
- readonly portalUrl: string;
- /**
- * The management service endpoint.
- */
- readonly managementEndpointUrl: string;
- /**
- * The resource management endpoint.
- */
- readonly resourceManagerEndpointUrl: string;
- /**
- * The Active Directory login endpoint.
- */
- readonly activeDirectoryEndpointUrl: string;
- /**
- * The resource ID to obtain AD tokens for (token audience).
- */
- readonly activeDirectoryResourceId: string;
- /**
- * The publish settings file URL.
- */
- readonly publishingProfileUrl?: string;
- /**
- * The sql server management endpoint for mobile commands.
- */
- readonly sqlManagementEndpointUrl?: string;
- /**
- * The dns suffix for sql servers.
- */
- readonly sqlServerHostnameSuffix?: string;
- /**
- * The template gallery endpoint.
- */
- readonly galleryEndpointUrl?: string;
- /**
- * The Active Directory resource ID.
- */
- readonly activeDirectoryGraphResourceId?: string;
- /**
- * The batch resource ID.
- */
- readonly batchResourceId?: string;
- /**
- * The Active Directory api version.
- */
- readonly activeDirectoryGraphApiVersion?: string;
- /**
- * The endpoint suffix for storage accounts.
- */
- readonly storageEndpointSuffix?: string;
- /**
- * The keyvault service dns suffix.
- */
- readonly keyVaultDnsSuffix?: string;
- /**
- * The data lake store filesystem service dns suffix.
- */
- readonly azureDataLakeStoreFileSystemEndpointSuffix?: string;
- /**
- * The data lake analytics job and catalog service dns suffix.
- */
- readonly azureDataLakeAnalyticsCatalogAndJobEndpointSuffix?: string;
- /**
- * Determines whether the authentication endpoint should be validated with Azure AD. Default value is true.
- */
- readonly validateAuthority?: boolean;
- }
- export class Environment {
- /**
- * The Environment name.
- */
- readonly name: string;
- /**
- * The management portal URL.
- */
- readonly portalUrl: string;
- /**
- * The management service endpoint.
- */
- readonly managementEndpointUrl: string;
- /**
- * The resource management endpoint.
- */
- readonly resourceManagerEndpointUrl: string;
- /**
- * The Active Directory login endpoint.
- */
- readonly activeDirectoryEndpointUrl: string;
- /**
- * The resource ID to obtain AD tokens for (token audience).
- */
- readonly activeDirectoryResourceId: string;
- /**
- * The publish settings file URL.
- */
- readonly publishingProfileUrl?: string;
- /**
- * The sql server management endpoint for mobile commands.
- */
- readonly sqlManagementEndpointUrl?: string;
- /**
- * The dns suffix for sql servers.
- */
- readonly sqlServerHostnameSuffix?: string;
- /**
- * The template gallery endpoint.
- */
- readonly galleryEndpointUrl?: string;
- /**
- * The batch resource ID.
- */
- readonly batchResourceId?: string;
- /**
- * The Active Directory resource ID.
- */
- readonly activeDirectoryGraphResourceId?: string;
- /**
- * The Active Directory api version.
- */
- readonly activeDirectoryGraphApiVersion?: string;
- /**
- * The endpoint suffix for storage accounts.
- */
- readonly storageEndpointSuffix?: string;
- /**
- * The keyvault service dns suffix.
- */
- readonly keyVaultDnsSuffix?: string;
- /**
- * The data lake store filesystem service dns suffix.
- */
- readonly azureDataLakeStoreFileSystemEndpointSuffix?: string;
- /**
- * The data lake analytics job and catalog service dns suffix.
- */
- readonly azureDataLakeAnalyticsCatalogAndJobEndpointSuffix?: string;
- /**
- * Determines whether the authentication endpoint should be validated with Azure AD. Default value is true.
- */
- readonly validateAuthority: boolean = true;
- constructor(parameters: EnvironmentParameters) {
- if (!parameters || typeof parameters !== "object") {
- throw new Error("'parameters' is a required parameter and must be of type 'object'.");
- }
- // Validate required parameters
- const requiredParams = ["name", "portalUrl", "managementEndpointUrl", "resourceManagerEndpointUrl",
- "activeDirectoryEndpointUrl", "activeDirectoryResourceId"];
- requiredParams.forEach(function (param) {
- if (!(<any>parameters)[param] || typeof (<any>parameters)[param].valueOf() !== "string") {
- throw new Error(`Please provide "${param}" for the environment and it must be of type "string".`);
- }
- });
- this.name = parameters.name;
- this.portalUrl = parameters.portalUrl;
- this.managementEndpointUrl = parameters.managementEndpointUrl;
- this.resourceManagerEndpointUrl = parameters.resourceManagerEndpointUrl;
- this.activeDirectoryEndpointUrl = parameters.activeDirectoryEndpointUrl;
- this.activeDirectoryResourceId = parameters.activeDirectoryResourceId;
- if (this.activeDirectoryGraphApiVersion) {
- this.activeDirectoryGraphApiVersion = parameters.activeDirectoryGraphApiVersion;
- }
- if (this.activeDirectoryGraphResourceId) {
- this.activeDirectoryGraphResourceId = parameters.activeDirectoryGraphResourceId;
- }
- if (this.azureDataLakeAnalyticsCatalogAndJobEndpointSuffix) {
- this.azureDataLakeAnalyticsCatalogAndJobEndpointSuffix = parameters.azureDataLakeAnalyticsCatalogAndJobEndpointSuffix;
- }
- if (this.azureDataLakeStoreFileSystemEndpointSuffix) {
- this.azureDataLakeStoreFileSystemEndpointSuffix = parameters.azureDataLakeStoreFileSystemEndpointSuffix;
- }
- if (this.batchResourceId) {
- this.batchResourceId = parameters.batchResourceId;
- }
- if (this.galleryEndpointUrl) {
- this.galleryEndpointUrl = parameters.galleryEndpointUrl;
- }
- if (this.keyVaultDnsSuffix) {
- this.keyVaultDnsSuffix = parameters.keyVaultDnsSuffix;
- }
- if (this.publishingProfileUrl) {
- this.publishingProfileUrl = parameters.publishingProfileUrl;
- }
- if (this.sqlManagementEndpointUrl) {
- this.sqlManagementEndpointUrl = parameters.sqlManagementEndpointUrl;
- }
- if (this.sqlServerHostnameSuffix) {
- this.sqlServerHostnameSuffix = parameters.sqlServerHostnameSuffix;
- }
- if (this.storageEndpointSuffix) {
- this.storageEndpointSuffix = parameters.storageEndpointSuffix;
- }
- }
- static add(parameters: EnvironmentParameters): void {
- const envContainer: { [name: string]: Environment } = {};
- const envObj = new Environment(parameters);
- envContainer[parameters.name] = envObj;
- Object.assign(Environment, envContainer);
- return;
- }
- static get(name: string): Environment {
- if (!name) {
- throw new TypeError("name cannot be null or undefined and must be of type string.");
- }
- return (Environment as any)[name];
- }
- static readonly AzureCloud = {
- name: "AzureCloud",
- portalUrl: "https://portal.azure.com",
- publishingProfileUrl: "https://go.microsoft.com/fwlink/?LinkId=254432",
- managementEndpointUrl: "https://management.core.windows.net",
- resourceManagerEndpointUrl: "https://management.azure.com/",
- sqlManagementEndpointUrl: "https://management.core.windows.net:8443/",
- sqlServerHostnameSuffix: ".database.windows.net",
- galleryEndpointUrl: "https://gallery.azure.com/",
- activeDirectoryEndpointUrl: "https://login.microsoftonline.com/",
- activeDirectoryResourceId: "https://management.core.windows.net/",
- activeDirectoryGraphResourceId: "https://graph.windows.net/",
- batchResourceId: "https://batch.core.windows.net/",
- activeDirectoryGraphApiVersion: "2013-04-05",
- storageEndpointSuffix: ".core.windows.net",
- keyVaultDnsSuffix: ".vault.azure.net",
- azureDataLakeStoreFileSystemEndpointSuffix: "azuredatalakestore.net",
- azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "azuredatalakeanalytics.net",
- validateAuthority: true
- };
- static readonly ChinaCloud = {
- name: "AzureChinaCloud",
- portalUrl: "https://portal.azure.cn",
- publishingProfileUrl: "https://go.microsoft.com/fwlink/?LinkID=301774",
- managementEndpointUrl: "https://management.core.chinacloudapi.cn",
- resourceManagerEndpointUrl: "https://management.chinacloudapi.cn",
- sqlManagementEndpointUrl: "https://management.core.chinacloudapi.cn:8443/",
- sqlServerHostnameSuffix: ".database.chinacloudapi.cn",
- galleryEndpointUrl: "https://gallery.chinacloudapi.cn/",
- activeDirectoryEndpointUrl: "https://login.chinacloudapi.cn/",
- activeDirectoryResourceId: "https://management.core.chinacloudapi.cn/",
- activeDirectoryGraphResourceId: "https://graph.chinacloudapi.cn/",
- activeDirectoryGraphApiVersion: "2013-04-05",
- batchResourceId: "https://batch.chinacloudapi.cn/",
- storageEndpointSuffix: ".core.chinacloudapi.cn",
- keyVaultDnsSuffix: ".vault.azure.cn",
- // TODO: add dns suffixes for the china cloud for datalake store and datalake analytics once they are defined.
- azureDataLakeStoreFileSystemEndpointSuffix: "N/A",
- azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "N/A",
- validateAuthority: true
- };
- static readonly USGovernment = {
- name: "AzureUSGovernment",
- portalUrl: "https://portal.azure.us",
- publishingProfileUrl: "https://manage.windowsazure.us/publishsettings/index",
- managementEndpointUrl: "https://management.core.usgovcloudapi.net",
- resourceManagerEndpointUrl: "https://management.usgovcloudapi.net",
- sqlManagementEndpointUrl: "https://management.core.usgovcloudapi.net:8443/",
- sqlServerHostnameSuffix: ".database.usgovcloudapi.net",
- galleryEndpointUrl: "https://gallery.usgovcloudapi.net/",
- activeDirectoryEndpointUrl: "https://login.microsoftonline.us/",
- activeDirectoryResourceId: "https://management.core.usgovcloudapi.net/",
- activeDirectoryGraphResourceId: "https://graph.windows.net/",
- batchResourceId: "https://batch.core.usgovcloudapi.net/",
- activeDirectoryGraphApiVersion: "2013-04-05",
- storageEndpointSuffix: ".core.usgovcloudapi.net",
- keyVaultDnsSuffix: ".vault.usgovcloudapi.net",
- azureDataLakeStoreFileSystemEndpointSuffix: "N/A",
- azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "N/A",
- validateAuthority: true
- };
- static readonly GermanCloud = {
- name: "AzureGermanCloud",
- portalUrl: "https://portal.microsoftazure.de/",
- publishingProfileUrl: "https://manage.microsoftazure.de/publishsettings/index",
- managementEndpointUrl: "https://management.core.cloudapi.de",
- resourceManagerEndpointUrl: "https://management.microsoftazure.de",
- sqlManagementEndpointUrl: "https://management.core.cloudapi.de:8443/",
- sqlServerHostnameSuffix: ".database.cloudapi.de",
- galleryEndpointUrl: "https://gallery.cloudapi.de/",
- activeDirectoryEndpointUrl: "https://login.microsoftonline.de/",
- activeDirectoryResourceId: "https://management.core.cloudapi.de/",
- activeDirectoryGraphResourceId: "https://graph.cloudapi.de/",
- batchResourceId: "https://batch.microsoftazure.de/",
- activeDirectoryGraphApiVersion: "2013-04-05",
- storageEndpointSuffix: ".core.cloudapi.de",
- keyVaultDnsSuffix: ".vault.microsoftazure.de",
- azureDataLakeStoreFileSystemEndpointSuffix: "N/A",
- azureDataLakeAnalyticsCatalogAndJobEndpointSuffix: "N/A",
- validateAuthority: true
- };
- }
|