package com.microsoft.azure;
import com.microsoft.rest.protocol.Environment;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public final class AzureEnvironment implements Environment {
private final Map<String, String> endpoints;
public AzureEnvironment(Map<String, String> endpoints) {
this.endpoints = endpoints;
}
public static final AzureEnvironment AZURE = new AzureEnvironment(new HashMap<String, String>() {{
put("portalUrl", "http://go.microsoft.com/fwlink/?LinkId=254433");
put("publishingProfileUrl", "http://go.microsoft.com/fwlink/?LinkId=254432");
put("managementEndpointUrl", "https://management.core.windows.net/");
put("resourceManagerEndpointUrl", "https://management.azure.com/");
put("sqlManagementEndpointUrl", "https://management.core.windows.net:8443/");
put("sqlServerHostnameSuffix", ".database.windows.net");
put("galleryEndpointUrl", "https://gallery.azure.com/");
put("activeDirectoryEndpointUrl", "https://login.microsoftonline.com/");
put("activeDirectoryResourceId", "https://management.core.windows.net/");
put("activeDirectoryGraphResourceId", "https://graph.windows.net/");
put("dataLakeEndpointResourceId", "https://datalake.azure.net/");
put("activeDirectoryGraphApiVersion", "2013-04-05");
put("storageEndpointSuffix", ".core.windows.net");
put("keyVaultDnsSuffix", ".vault.azure.net");
put("azureDataLakeStoreFileSystemEndpointSuffix", "azuredatalakestore.net");
put("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix", "azuredatalakeanalytics.net");
put("azureLogAnalyticsResourceId", "https://api.loganalytics.io/");
put("azureApplicationInsightsResourceId", "https://api.applicationinsights.io/");
}});
public static final AzureEnvironment AZURE_CHINA = new AzureEnvironment(new HashMap<String, String>() {{
put("portalUrl", "http://go.microsoft.com/fwlink/?LinkId=301902");
put("publishingProfileUrl", "http://go.microsoft.com/fwlink/?LinkID=301774");
put("managementEndpointUrl", "https://management.core.chinacloudapi.cn/");
put("resourceManagerEndpointUrl", "https://management.chinacloudapi.cn/");
put("sqlManagementEndpointUrl", "https://management.core.chinacloudapi.cn:8443/");
put("sqlServerHostnameSuffix", ".database.chinacloudapi.cn");
put("galleryEndpointUrl", "https://gallery.chinacloudapi.cn/");
put("activeDirectoryEndpointUrl", "https://login.chinacloudapi.cn/");
put("activeDirectoryResourceId", "https://management.core.chinacloudapi.cn/");
put("activeDirectoryGraphResourceId", "https://graph.chinacloudapi.cn/");
put("dataLakeEndpointResourceId", "N/A");
put("activeDirectoryGraphApiVersion", "2013-04-05");
put("storageEndpointSuffix", ".core.chinacloudapi.cn");
put("keyVaultDnsSuffix", ".vault.azure.cn");
put("azureDataLakeStoreFileSystemEndpointSuffix", "N/A");
put("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix", "N/A");
put("azureLogAnalyticsResourceId", "N/A");
put("azureApplicationInsightsResourceId", "N/A");
}});
public static final AzureEnvironment AZURE_US_GOVERNMENT = new AzureEnvironment(new HashMap<String, String>() {{
put("portalUrl", "https://manage.windowsazure.us");
put("publishingProfileUrl", "https://manage.windowsazure.us/publishsettings/index");
put("managementEndpointUrl", "https://management.core.usgovcloudapi.net/");
put("resourceManagerEndpointUrl", "https://management.usgovcloudapi.net/");
put("sqlManagementEndpointUrl", "https://management.core.usgovcloudapi.net:8443/");
put("sqlServerHostnameSuffix", ".database.usgovcloudapi.net");
put("galleryEndpointUrl", "https://gallery.usgovcloudapi.net/");
put("activeDirectoryEndpointUrl", "https://login.microsoftonline.us/");
put("activeDirectoryResourceId", "https://management.core.usgovcloudapi.net/");
put("activeDirectoryGraphResourceId", "https://graph.windows.net/");
put("dataLakeEndpointResourceId", "N/A");
put("activeDirectoryGraphApiVersion", "2013-04-05");
put("storageEndpointSuffix", ".core.usgovcloudapi.net");
put("keyVaultDnsSuffix", ".vault.usgovcloudapi.net");
put("azureDataLakeStoreFileSystemEndpointSuffix", "N/A");
put("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix", "N/A");
put("azureLogAnalyticsResourceId", "https://api.loganalytics.us/");
put("azureApplicationInsightsResourceId", "N/A");
}});
public static final AzureEnvironment AZURE_GERMANY = new AzureEnvironment(new HashMap<String, String>() {{
put("portalUrl", "http://portal.microsoftazure.de/");
put("publishingProfileUrl", "https://manage.microsoftazure.de/publishsettings/index");
put("managementEndpointUrl", "https://management.core.cloudapi.de/");
put("resourceManagerEndpointUrl", "https://management.microsoftazure.de/");
put("sqlManagementEndpointUrl", "https://management.core.cloudapi.de:8443/");
put("sqlServerHostnameSuffix", ".database.cloudapi.de");
put("galleryEndpointUrl", "https://gallery.cloudapi.de/");
put("activeDirectoryEndpointUrl", "https://login.microsoftonline.de/");
put("activeDirectoryResourceId", "https://management.core.cloudapi.de/");
put("activeDirectoryGraphResourceId", "https://graph.cloudapi.de/");
put("dataLakeEndpointResourceId", "N/A");
put("activeDirectoryGraphApiVersion", "2013-04-05");
put("storageEndpointSuffix", ".core.cloudapi.de");
put("keyVaultDnsSuffix", ".vault.microsoftazure.de");
put("azureDataLakeStoreFileSystemEndpointSuffix", "N/A");
put("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix", "N/A");
put("azureLogAnalyticsResourceId", "N/A");
put("azureApplicationInsightsResourceId", "N/A");
}});
public Map<String, String> endpoints() {
return endpoints;
}
public static AzureEnvironment[] knownEnvironments() {
List<AzureEnvironment> environments = Arrays.asList(AZURE, AZURE_CHINA, AZURE_GERMANY, AZURE_US_GOVERNMENT);
return environments.toArray(new AzureEnvironment[environments.size()]);
}
public String portal() {
return endpoints.get("portalUrl");
}
public String publishingProfile() {
return endpoints.get("publishingProfileUrl");
}
public String managementEndpoint() {
return endpoints.get("managementEndpointUrl");
}
public String resourceManagerEndpoint() {
return endpoints.get("resourceManagerEndpointUrl");
}
public String sqlManagementEndpoint() {
return endpoints.get("sqlManagementEndpointUrl");
}
public String sqlServerHostnameSuffix() {
return endpoints.get("sqlServerHostnameSuffix");
}
public String activeDirectoryEndpoint() {
return endpoints.get("activeDirectoryEndpointUrl").replaceAll("/$", "") + "/";
}
public String activeDirectoryResourceId() {
return endpoints.get("activeDirectoryResourceId");
}
public String galleryEndpoint() {
return endpoints.get("galleryEndpointUrl");
}
public String graphEndpoint() {
return endpoints.get("activeDirectoryGraphResourceId");
}
public String dataLakeEndpointResourceId() {
return endpoints.get("dataLakeEndpointResourceId");
}
public String activeDirectoryGraphApiVersion() {
return endpoints.get("activeDirectoryGraphApiVersion");
}
public String storageEndpointSuffix() {
return endpoints.get("storageEndpointSuffix");
}
public String keyVaultDnsSuffix() {
return endpoints.get("keyVaultDnsSuffix");
}
public String azureDataLakeStoreFileSystemEndpointSuffix() {
return endpoints.get("azureDataLakeStoreFileSystemEndpointSuffix");
}
public String azureDataLakeAnalyticsCatalogAndJobEndpointSuffix() {
return endpoints.get("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix");
}
public String logAnalyticsEndpoint() {
return endpoints.get("azureLogAnalyticsResourceId");
}
public String applicationInsightsEndpoint() {
return endpoints.get("azureApplicationInsightsResourceId");
}
public enum Endpoint implements Environment.Endpoint {
MANAGEMENT("managementEndpointUrl"),
RESOURCE_MANAGER("resourceManagerEndpointUrl"),
SQL("sqlManagementEndpointUrl"),
GALLERY("galleryEndpointUrl"),
ACTIVE_DIRECTORY("activeDirectoryEndpointUrl"),
GRAPH("activeDirectoryGraphResourceId"),
KEYVAULT("keyVaultDnsSuffix"),
DATA_LAKE_STORE("azureDataLakeStoreFileSystemEndpointSuffix"),
DATA_LAKE_ANALYTICS("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix"),
LOG_ANALYTICS("azureLogAnalyticsResourceId"),
APPLICATION_INSIGHTS("azureApplicationInsightsResourceId");
private String field;
Endpoint(String value) {
this.field = value;
}
@Override
public String identifier() {
return field;
}
@Override
public String toString() {
return field;
}
}
public String url(Environment.Endpoint endpoint) {
return endpoints.get(endpoint.identifier());
}
}