Skip to content
Closed
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
4 changes: 3 additions & 1 deletion sdk/hdinsight/azure-resourcemanager-hdinsight/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.6 (Unreleased)
## 1.0.0-beta.1 (2022-10-10)

- Azure Resource Manager HDInsight client library for Java. This package contains Microsoft Azure SDK for HDInsight Management SDK. HDInsight Management Client. Package tag package-2021-06. 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
2 changes: 1 addition & 1 deletion sdk/hdinsight/azure-resourcemanager-hdinsight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-hdinsight</artifactId>
<version>1.0.0-beta.5</version>
<version>1.0.0-beta.6</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
25 changes: 25 additions & 0 deletions sdk/hdinsight/azure-resourcemanager-hdinsight/SAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
- [ListUsages](#locations_listusages)
- [ValidateClusterCreateRequest](#locations_validateclustercreaterequest)

## Operations

- [List](#operations_list)

## PrivateEndpointConnections

- [CreateOrUpdate](#privateendpointconnections_createorupdate)
Expand Down Expand Up @@ -2524,6 +2528,27 @@ public final class LocationsValidateClusterCreateRequestSamples {
}
```

### Operations_List

```java
import com.azure.core.util.Context;

/** Samples for Operations List. */
public final class OperationsListSamples {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/ListHDInsightOperations.json
*/
/**
* Sample code: Lists all of the available operations.
*
* @param manager Entry point to HDInsightManager.
*/
public static void listsAllOfTheAvailableOperations(com.azure.resourcemanager.hdinsight.HDInsightManager manager) {
manager.operations().list(Context.NONE);
}
}
```

### PrivateEndpointConnections_CreateOrUpdate

```java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
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;
Expand Down Expand Up @@ -49,6 +52,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/** Entry point to HDInsightManager. HDInsight Management Client. */
public final class HDInsightManager {
Expand Down Expand Up @@ -101,6 +105,19 @@ public static HDInsightManager authenticate(TokenCredential credential, AzurePro
return configure().authenticate(credential, profile);
}

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

/**
* Gets a Configurable instance that can be used to create HDInsightManager with optional configuration.
*
Expand All @@ -112,13 +129,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 @@ -179,16 +197,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 @@ -210,7 +243,7 @@ public HDInsightManager authenticate(TokenCredential credential, AzureProfile pr
.append("-")
.append("com.azure.resourcemanager.hdinsight")
.append("/")
.append("1.0.0-beta.5");
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand All @@ -228,16 +261,34 @@ public HDInsightManager authenticate(TokenCredential credential, AzureProfile pr
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 All @@ -249,55 +300,83 @@ public HDInsightManager authenticate(TokenCredential credential, AzureProfile pr
}
}

/** @return Resource collection API of Clusters. */
/**
* Gets the resource collection API of Clusters. It manages Cluster.
*
* @return Resource collection API of Clusters.
*/
public Clusters clusters() {
if (this.clusters == null) {
this.clusters = new ClustersImpl(clientObject.getClusters(), this);
}
return clusters;
}

/** @return Resource collection API of Applications. */
/**
* Gets the resource collection API of Applications. It manages Application.
*
* @return Resource collection API of Applications.
*/
public Applications applications() {
if (this.applications == null) {
this.applications = new ApplicationsImpl(clientObject.getApplications(), this);
}
return applications;
}

/** @return Resource collection API of Locations. */
/**
* Gets the resource collection API of Locations.
*
* @return Resource collection API of Locations.
*/
public Locations locations() {
if (this.locations == null) {
this.locations = new LocationsImpl(clientObject.getLocations(), this);
}
return locations;
}

/** @return Resource collection API of Configurations. */
/**
* Gets the resource collection API of Configurations.
*
* @return Resource collection API of Configurations.
*/
public Configurations configurations() {
if (this.configurations == null) {
this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this);
}
return configurations;
}

/** @return Resource collection API of Extensions. */
/**
* Gets the resource collection API of Extensions.
*
* @return Resource collection API of Extensions.
*/
public Extensions extensions() {
if (this.extensions == null) {
this.extensions = new ExtensionsImpl(clientObject.getExtensions(), this);
}
return extensions;
}

/** @return Resource collection API of ScriptActions. */
/**
* Gets the resource collection API of ScriptActions.
*
* @return Resource collection API of ScriptActions.
*/
public ScriptActions scriptActions() {
if (this.scriptActions == null) {
this.scriptActions = new ScriptActionsImpl(clientObject.getScriptActions(), this);
}
return scriptActions;
}

/** @return Resource collection API of ScriptExecutionHistories. */
/**
* Gets the resource collection API of ScriptExecutionHistories.
*
* @return Resource collection API of ScriptExecutionHistories.
*/
public ScriptExecutionHistories scriptExecutionHistories() {
if (this.scriptExecutionHistories == null) {
this.scriptExecutionHistories =
Expand All @@ -306,23 +385,35 @@ public ScriptExecutionHistories scriptExecutionHistories() {
return scriptExecutionHistories;
}

/** @return Resource collection API of Operations. */
/**
* Gets the resource collection API of Operations.
*
* @return Resource collection API of Operations.
*/
public Operations operations() {
if (this.operations == null) {
this.operations = new OperationsImpl(clientObject.getOperations(), this);
}
return operations;
}

/** @return Resource collection API of VirtualMachines. */
/**
* Gets the resource collection API of VirtualMachines.
*
* @return Resource collection API of VirtualMachines.
*/
public VirtualMachines virtualMachines() {
if (this.virtualMachines == null) {
this.virtualMachines = new VirtualMachinesImpl(clientObject.getVirtualMachines(), this);
}
return virtualMachines;
}

/** @return Resource collection API of PrivateEndpointConnections. */
/**
* Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection.
*
* @return Resource collection API of PrivateEndpointConnections.
*/
public PrivateEndpointConnections privateEndpointConnections() {
if (this.privateEndpointConnections == null) {
this.privateEndpointConnections =
Expand All @@ -331,7 +422,11 @@ public PrivateEndpointConnections privateEndpointConnections() {
return privateEndpointConnections;
}

/** @return Resource collection API of PrivateLinkResources. */
/**
* Gets the resource collection API of PrivateLinkResources.
*
* @return Resource collection API of PrivateLinkResources.
*/
public PrivateLinkResources privateLinkResources() {
if (this.privateLinkResources == null) {
this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this);
Expand Down
Loading