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

[AutoPR azure-resourcemanager-azurearcdata] Active Directory connector automatic mode properties #13801

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.3 (Unreleased)
## 1.0.0-beta.1 (2022-04-07)

- Azure Resource Manager AzureArcData client library for Java. This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-preview-2022-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

Expand Down
4 changes: 2 additions & 2 deletions sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Azure Resource Manager AzureArcData client library for Java.

This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-2021-08-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-preview-2022-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## We'd love to hear your feedback

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-azurearcdata</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
385 changes: 361 additions & 24 deletions sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for AzureArcData Management</name>
<description>This package contains Microsoft Azure SDK for AzureArcData Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-2021-08-01.</description>
<description>This package contains Microsoft Azure SDK for AzureArcData Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-preview-2022-03.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,41 @@
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
import com.azure.core.http.policy.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.util.Configuration;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.azurearcdata.fluent.AzureArcDataManagementClient;
import com.azure.resourcemanager.azurearcdata.implementation.ActiveDirectoryConnectorsImpl;
import com.azure.resourcemanager.azurearcdata.implementation.AzureArcDataManagementClientBuilder;
import com.azure.resourcemanager.azurearcdata.implementation.DataControllersImpl;
import com.azure.resourcemanager.azurearcdata.implementation.OperationsImpl;
import com.azure.resourcemanager.azurearcdata.implementation.PostgresInstancesImpl;
import com.azure.resourcemanager.azurearcdata.implementation.SqlManagedInstancesImpl;
import com.azure.resourcemanager.azurearcdata.implementation.SqlServerInstancesImpl;
import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectors;
import com.azure.resourcemanager.azurearcdata.models.DataControllers;
import com.azure.resourcemanager.azurearcdata.models.Operations;
import com.azure.resourcemanager.azurearcdata.models.PostgresInstances;
import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstances;
import com.azure.resourcemanager.azurearcdata.models.SqlServerInstances;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* Entry point to AzureArcDataManager. The AzureArcData management API provides a RESTful set of web APIs to manage
Expand All @@ -49,6 +57,10 @@ public final class AzureArcDataManager {

private DataControllers dataControllers;

private ActiveDirectoryConnectors activeDirectoryConnectors;

private PostgresInstances postgresInstances;

private final AzureArcDataManagementClient clientObject;

private AzureArcDataManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
Expand Down Expand Up @@ -76,6 +88,19 @@ public static AzureArcDataManager authenticate(TokenCredential credential, Azure
return configure().authenticate(credential, profile);
}

/**
* Creates an instance of AzureArcData service API entry point.
*
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the Azure profile for client.
* @return the AzureArcData service API instance.
*/
public static AzureArcDataManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new AzureArcDataManager(httpPipeline, profile, null);
}

/**
* Gets a Configurable instance that can be used to create AzureArcDataManager with optional configuration.
*
Expand All @@ -87,13 +112,14 @@ public static Configurable configure() {

/** The Configurable allowing configurations to be set. */
public static final class Configurable {
private final ClientLogger logger = new ClientLogger(Configurable.class);
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);

private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
private final List<String> scopes = new ArrayList<>();
private RetryPolicy retryPolicy;
private RetryOptions retryOptions;
private Duration defaultPollInterval;

private Configurable() {
Expand Down Expand Up @@ -154,16 +180,31 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
return this;
}

/**
* Sets the retry options for the HTTP pipeline retry policy.
*
* <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
*
* @param retryOptions the retry options for the HTTP pipeline retry policy.
* @return the configurable object itself.
*/
public Configurable withRetryOptions(RetryOptions retryOptions) {
this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
return this;
}

/**
* Sets the default poll interval, used when service does not provide "Retry-After" header.
*
* @param defaultPollInterval the default poll interval.
* @return the configurable object itself.
*/
public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null.");
this.defaultPollInterval =
Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
if (this.defaultPollInterval.isNegative()) {
throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative"));
throw LOGGER
.logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
}
return this;
}
Expand All @@ -185,7 +226,7 @@ public AzureArcDataManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.azurearcdata")
.append("/")
.append("1.0.0-beta.2");
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand All @@ -203,16 +244,34 @@ public AzureArcDataManager authenticate(TokenCredential credential, AzureProfile
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
}
if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
if (retryOptions != null) {
retryPolicy = new RetryPolicy(retryOptions);
} else {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
}
List<HttpPipelinePolicy> policies = new ArrayList<>();
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new AddHeadersFromContextPolicy());
policies.add(new RequestIdPolicy());
policies
.addAll(
this
.policies
.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies);
policies
.addAll(
this
.policies
.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline =
Expand Down Expand Up @@ -256,6 +315,23 @@ public DataControllers dataControllers() {
return dataControllers;
}

/** @return Resource collection API of ActiveDirectoryConnectors. */
public ActiveDirectoryConnectors activeDirectoryConnectors() {
if (this.activeDirectoryConnectors == null) {
this.activeDirectoryConnectors =
new ActiveDirectoryConnectorsImpl(clientObject.getActiveDirectoryConnectors(), this);
}
return activeDirectoryConnectors;
}

/** @return Resource collection API of PostgresInstances. */
public PostgresInstances postgresInstances() {
if (this.postgresInstances == null) {
this.postgresInstances = new PostgresInstancesImpl(clientObject.getPostgresInstances(), this);
}
return postgresInstances;
}

/**
* @return Wrapped service client AzureArcDataManagementClient providing direct access to the underlying
* auto-generated API implementation, based on Azure REST API.
Expand Down
Loading