Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgmt, support authenticate(HttpPipeline, AzureProfile) #27873

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import com.azure.resourcemanager.appplatform.implementation.SpringServicesImpl;
import com.azure.resourcemanager.appplatform.models.SpringServices;
import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.arm.Manager;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;

import java.util.Objects;

/** Entry point to Azure App Platform management. */
public final class AppPlatformManager extends Manager<AppPlatformManagementClient> {
// Collections
Expand All @@ -36,17 +38,21 @@ public static Configurable configure() {
* @return the AppPlatformManager
*/
public static AppPlatformManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of AppPlatformManager that exposes app platform resource management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls.
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile to use
* @return the AppPlatformManager
*/
private static AppPlatformManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static AppPlatformManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new AppPlatformManager(httpPipeline, profile);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import com.azure.resourcemanager.dns.DnsZoneManager;
import com.azure.resourcemanager.keyvault.KeyVaultManager;
import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.arm.Manager;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;
import com.azure.resourcemanager.storage.StorageManager;

import java.util.Objects;

/** Entry point to Azure storage resource management. */
public final class AppServiceManager extends Manager<WebSiteManagementClient> {
// Managers
Expand Down Expand Up @@ -61,17 +63,21 @@ public static Configurable configure() {
* @return the StorageManager
*/
public static AppServiceManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of StorageManager that exposes storage resource management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls.
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile to use
* @return the StorageManager
*/
private static AppServiceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static AppServiceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new AppServiceManager(httpPipeline, profile);
}

Expand Down Expand Up @@ -103,15 +109,10 @@ private AppServiceManager(HttpPipeline httpPipeline, AzureProfile profile) {
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.buildClient());
keyVaultManager = AzureConfigurableImpl.configureHttpPipeline(httpPipeline, KeyVaultManager.configure())
.authenticate(null, profile);
storageManager = AzureConfigurableImpl.configureHttpPipeline(httpPipeline, StorageManager.configure())
.authenticate(null, profile);
authorizationManager = AzureConfigurableImpl
.configureHttpPipeline(httpPipeline, AuthorizationManager.configure())
.authenticate(null, profile);
dnsZoneManager = AzureConfigurableImpl.configureHttpPipeline(httpPipeline, DnsZoneManager.configure())
.authenticate(null, profile);
keyVaultManager = KeyVaultManager.authenticate(httpPipeline, profile);
storageManager = StorageManager.authenticate(httpPipeline, profile);
authorizationManager = AuthorizationManager.authenticate(httpPipeline, profile);
dnsZoneManager = DnsZoneManager.authenticate(httpPipeline, profile);
}

/** @return the authorization manager instance. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;

import java.util.Objects;

/** Entry point to Azure Authorization and Graph RBAC management. */
public final class AuthorizationManager implements HasServiceClient<MicrosoftGraphClient> {
private final String tenantId;
Expand Down Expand Up @@ -56,18 +58,22 @@ public final class AuthorizationManager implements HasServiceClient<MicrosoftGra
* @return the AuthorizationManager instance
*/
public static AuthorizationManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of AuthorizationManager that exposes Authorization
* and Graph RBAC management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile used in Active Directory
* @return the AuthorizationManager instance
*/
private static AuthorizationManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static AuthorizationManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new AuthorizationManager(httpPipeline, profile);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;
import com.azure.resourcemanager.cdn.models.CdnProfiles;

import java.util.Objects;

/**
* Entry point to Azure CDN management.
*/
Expand All @@ -40,17 +42,21 @@ public static Configurable configure() {
* @return the CDN Manager
*/
public static CdnManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of CDN Manager that exposes CDN manager management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls.
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile to use
* @return the CDN Manager
*/
private static CdnManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static CdnManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new CdnManager(httpPipeline, profile);
}

Expand All @@ -71,10 +77,7 @@ public interface Configurable extends AzureConfigurable<Configurable> {
/**
* The implementation for Configurable interface.
*/
private static class ConfigurableImpl
extends AzureConfigurableImpl<Configurable>
implements Configurable {

private static class ConfigurableImpl extends AzureConfigurableImpl<Configurable> implements Configurable {
public CdnManager authenticate(TokenCredential credential, AzureProfile profile) {
return CdnManager.authenticate(buildHttpPipeline(credential, profile), profile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
import com.azure.resourcemanager.authorization.AuthorizationManager;
import com.azure.resourcemanager.network.NetworkManager;
import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.arm.Manager;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;
import com.azure.resourcemanager.storage.StorageManager;

import java.util.Objects;

/** Entry point to Azure compute resource management. */
public final class ComputeManager extends Manager<ComputeManagementClient> {
// The service managers
Expand Down Expand Up @@ -97,17 +99,21 @@ public static Configurable configure() {
* @return the ComputeManager
*/
public static ComputeManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of ComputeManager that exposes Compute resource management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls.
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile to use
* @return the ComputeManager
*/
private static ComputeManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static ComputeManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new ComputeManager(httpPipeline, profile);
}

Expand Down Expand Up @@ -140,13 +146,9 @@ private ComputeManager(HttpPipeline httpPipeline, AzureProfile profile) {
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.buildClient());
storageManager = AzureConfigurableImpl.configureHttpPipeline(httpPipeline, StorageManager.configure())
.authenticate(null, profile);
networkManager = AzureConfigurableImpl.configureHttpPipeline(httpPipeline, NetworkManager.configure())
.authenticate(null, profile);
authorizationManager = AzureConfigurableImpl
.configureHttpPipeline(httpPipeline, AuthorizationManager.configure())
.authenticate(null, profile);
storageManager = StorageManager.authenticate(httpPipeline, profile);
networkManager = NetworkManager.authenticate(httpPipeline, profile);
authorizationManager = AuthorizationManager.authenticate(httpPipeline, profile);
}

/** @return the availability set resource management API entry point */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
import com.azure.resourcemanager.containerinstance.models.ContainerGroups;
import com.azure.resourcemanager.network.NetworkManager;
import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.arm.Manager;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;
import com.azure.resourcemanager.storage.StorageManager;

import java.util.Objects;

/** Entry point to Azure container instance management. */
public final class ContainerInstanceManager
extends Manager<ContainerInstanceManagementClient> {
Expand Down Expand Up @@ -45,17 +47,21 @@ public static Configurable configure() {
* @return the ContainerInstanceManager
*/
public static ContainerInstanceManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of ContainerInstanceManager that exposes resource management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls.
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile to use
* @return the ContainerInstanceManager
*/
private static ContainerInstanceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static ContainerInstanceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new ContainerInstanceManager(httpPipeline, profile);
}

Expand Down Expand Up @@ -89,13 +95,9 @@ private ContainerInstanceManager(HttpPipeline httpPipeline, AzureProfile profile
.subscriptionId(profile.getSubscriptionId())
.buildClient());

this.storageManager = AzureConfigurableImpl.configureHttpPipeline(httpPipeline, StorageManager.configure())
.authenticate(null, profile);
this.authorizationManager = AzureConfigurableImpl
.configureHttpPipeline(httpPipeline, AuthorizationManager.configure())
.authenticate(null, profile);
this.networkManager = AzureConfigurableImpl.configureHttpPipeline(httpPipeline, NetworkManager.configure())
.authenticate(null, profile);
this.storageManager = StorageManager.authenticate(httpPipeline, profile);
this.authorizationManager = AuthorizationManager.authenticate(httpPipeline, profile);
this.networkManager = NetworkManager.authenticate(httpPipeline, profile);
}

/** @return the storage manager in container instance manager */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import com.azure.resourcemanager.containerregistry.models.RegistryTaskRuns;
import com.azure.resourcemanager.containerregistry.models.RegistryTasks;
import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.arm.Manager;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;

import java.util.Objects;

/** Entry point to Azure container registry management. */
public final class ContainerRegistryManager
extends Manager<ContainerRegistryManagementClient> {
Expand All @@ -44,17 +46,21 @@ public static Configurable configure() {
* @return the ContainerRegistryManager
*/
public static ContainerRegistryManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of ContainerRegistryManager that exposes Registry resource management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls.
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile to use
* @return the ContainerRegistryManager
*/
private static ContainerRegistryManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static ContainerRegistryManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new ContainerRegistryManager(httpPipeline, profile);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import com.azure.resourcemanager.containerservice.implementation.KubernetesClustersImpl;
import com.azure.resourcemanager.containerservice.models.KubernetesClusters;
import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.arm.Manager;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;

import java.util.Objects;

/** Entry point to Azure Container Service management. */
public final class ContainerServiceManager
extends Manager<ContainerServiceManagementClient> {
Expand All @@ -39,17 +41,21 @@ public static Configurable configure() {
* @return the ContainerServiceManager
*/
public static ContainerServiceManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
}

/**
* Creates an instance of ContainerServiceManager that exposes Service resource management API entry points.
*
* @param httpPipeline the HttpPipeline to be used for API calls.
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the profile to use
* @return the ContainerServiceManager
*/
private static ContainerServiceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
public static ContainerServiceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new ContainerServiceManager(httpPipeline, profile);
}

Expand Down
Loading