package com.microsoft.azure.management.appservice.implementation;
import com.microsoft.azure.AzureEnvironment;
import com.microsoft.azure.AzureResponseBuilder;
import com.microsoft.azure.credentials.AzureTokenCredentials;
import com.microsoft.azure.management.apigeneration.Beta;
import com.microsoft.azure.management.appservice.AppServiceCertificateOrders;
import com.microsoft.azure.management.appservice.AppServiceCertificates;
import com.microsoft.azure.management.appservice.AppServiceDomains;
import com.microsoft.azure.management.appservice.AppServicePlans;
import com.microsoft.azure.management.appservice.FunctionApps;
import com.microsoft.azure.management.appservice.WebApps;
import com.microsoft.azure.management.dns.implementation.DnsZoneManager;
import com.microsoft.azure.management.graphrbac.implementation.GraphRbacManager;
import com.microsoft.azure.management.keyvault.implementation.KeyVaultManager;
import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable;
import com.microsoft.azure.management.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.microsoft.azure.management.resources.fluentcore.arm.implementation.Manager;
import com.microsoft.azure.management.resources.fluentcore.utils.ProviderRegistrationInterceptor;
import com.microsoft.azure.management.resources.fluentcore.utils.ResourceManagerThrottlingInterceptor;
import com.microsoft.azure.management.storage.implementation.StorageManager;
import com.microsoft.azure.serializer.AzureJacksonAdapter;
import com.microsoft.rest.RestClient;
@Beta
public final class AppServiceManager extends Manager<AppServiceManager, WebSiteManagementClientImpl> {
private final GraphRbacManager rbacManager;
private final KeyVaultManager keyVaultManager;
private final StorageManager storageManager;
private final DnsZoneManager dnsZoneManager;
private WebApps webApps;
private AppServicePlans appServicePlans;
private AppServiceCertificateOrders appServiceCertificateOrders;
private AppServiceCertificates appServiceCertificates;
private AppServiceDomains appServiceDomains;
private FunctionApps functionApps;
private RestClient restClient;
public static Configurable configure() {
return new AppServiceManager.ConfigurableImpl();
}
public static AppServiceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
return new AppServiceManager(new RestClient.Builder()
.withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
.withCredentials(credentials)
.withSerializerAdapter(new AzureJacksonAdapter())
.withResponseBuilderFactory(new AzureResponseBuilder.Factory())
.withInterceptor(new ProviderRegistrationInterceptor(credentials))
.withInterceptor(new ResourceManagerThrottlingInterceptor())
.build(), credentials.domain(), subscriptionId);
}
public static AppServiceManager authenticate(RestClient restClient, String tenantId, String subscriptionId) {
return new AppServiceManager(restClient, tenantId, subscriptionId);
}
public interface Configurable extends AzureConfigurable<Configurable> {
AppServiceManager authenticate(AzureTokenCredentials credentials, String subscriptionId);
}
private static final class ConfigurableImpl extends AzureConfigurableImpl<Configurable> implements Configurable {
public AppServiceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
return AppServiceManager.authenticate(buildRestClient(credentials), credentials.domain(), subscriptionId);
}
}
private AppServiceManager(RestClient restClient, String tenantId, String subscriptionId) {
super(
restClient,
subscriptionId,
new WebSiteManagementClientImpl(restClient).withSubscriptionId(subscriptionId));
keyVaultManager = KeyVaultManager.authenticate(restClient, tenantId, subscriptionId);
storageManager = StorageManager.authenticate(restClient, subscriptionId);
rbacManager = GraphRbacManager.authenticate(restClient, tenantId);
dnsZoneManager = DnsZoneManager.authenticate(restClient, subscriptionId);
this.restClient = restClient;
}
GraphRbacManager rbacManager() {
return rbacManager;
}
KeyVaultManager keyVaultManager() {
return keyVaultManager;
}
DnsZoneManager dnsZoneManager() {
return dnsZoneManager;
}
StorageManager storageManager() {
return storageManager;
}
RestClient restClient() {
return restClient;
}
public WebApps webApps() {
if (webApps == null) {
webApps = new WebAppsImpl(this);
}
return webApps;
}
public AppServicePlans appServicePlans() {
if (appServicePlans == null) {
appServicePlans = new AppServicePlansImpl(this);
}
return appServicePlans;
}
public AppServiceCertificateOrders certificateOrders() {
if (appServiceCertificateOrders == null) {
appServiceCertificateOrders = new AppServiceCertificateOrdersImpl(this);
}
return appServiceCertificateOrders;
}
public AppServiceCertificates certificates() {
if (appServiceCertificates == null) {
appServiceCertificates = new AppServiceCertificatesImpl(this);
}
return appServiceCertificates;
}
public AppServiceDomains domains() {
if (appServiceDomains == null) {
appServiceDomains = new AppServiceDomainsImpl(this);
}
return appServiceDomains;
}
public FunctionApps functionApps() {
if (functionApps == null) {
functionApps = new FunctionAppsImpl(this);
}
return functionApps;
}
}