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
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.1 (2022-05-31)

- Azure Resource Manager CustomLocations client library for Java. This package contains Microsoft Azure SDK for CustomLocations Management SDK. The customLocations Rest API spec. Package tag package-2021-08-15. 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
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-extendedlocation</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
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 All @@ -29,6 +32,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/** Entry point to CustomLocationsManager. The customLocations Rest API spec. */
public final class CustomLocationsManager {
Expand Down Expand Up @@ -61,6 +65,19 @@ public static CustomLocationsManager authenticate(TokenCredential credential, Az
return configure().authenticate(credential, profile);
}

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

/**
* Gets a Configurable instance that can be used to create CustomLocationsManager with optional configuration.
*
Expand All @@ -72,13 +89,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 @@ -139,16 +157,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 Down Expand Up @@ -188,16 +221,34 @@ public CustomLocationsManager authenticate(TokenCredential credential, AzureProf
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 @@ -209,7 +260,11 @@ public CustomLocationsManager authenticate(TokenCredential credential, AzureProf
}
}

/** @return Resource collection API of CustomLocations. */
/**
* Gets the resource collection API of CustomLocations. It manages CustomLocation.
*
* @return Resource collection API of CustomLocations.
*/
public CustomLocations customLocations() {
if (this.customLocations == null) {
this.customLocations = new CustomLocationsImpl(clientObject.getCustomLocations(), this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface CustomLocationsClient {
*
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return lists of Custom Locations operations.
* @return lists of Custom Locations operations as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<CustomLocationOperationInner> listOperations();
Expand All @@ -35,7 +35,7 @@ public interface CustomLocationsClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return lists of Custom Locations operations.
* @return lists of Custom Locations operations as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<CustomLocationOperationInner> listOperations(Context context);
Expand All @@ -46,7 +46,8 @@ public interface CustomLocationsClient {
*
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of Custom Locations in the specified subscription.
* @return a list of Custom Locations in the specified subscription as paginated response with {@link
* PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<CustomLocationInner> list();
Expand All @@ -59,7 +60,8 @@ public interface CustomLocationsClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of Custom Locations in the specified subscription.
* @return a list of Custom Locations in the specified subscription as paginated response with {@link
* PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<CustomLocationInner> list(Context context);
Expand All @@ -72,7 +74,8 @@ public interface CustomLocationsClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of Custom Locations in the specified subscription and resource group.
* @return a list of Custom Locations in the specified subscription and resource group as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<CustomLocationInner> listByResourceGroup(String resourceGroupName);
Expand All @@ -86,7 +89,8 @@ public interface CustomLocationsClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of Custom Locations in the specified subscription and resource group.
* @return a list of Custom Locations in the specified subscription and resource group as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<CustomLocationInner> listByResourceGroup(String resourceGroupName, Context context);
Expand All @@ -113,7 +117,7 @@ public interface CustomLocationsClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the details of the customLocation with a specified resource group and name.
* @return the details of the customLocation with a specified resource group and name along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<CustomLocationInner> getByResourceGroupWithResponse(
Expand All @@ -128,9 +132,9 @@ Response<CustomLocationInner> getByResourceGroupWithResponse(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return custom Locations definition.
* @return the {@link SyncPoller} for polling of custom Locations definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<CustomLocationInner>, CustomLocationInner> beginCreateOrUpdate(
String resourceGroupName, String resourceName, CustomLocationInner parameters);

Expand All @@ -144,9 +148,9 @@ SyncPoller<PollResult<CustomLocationInner>, CustomLocationInner> beginCreateOrUp
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return custom Locations definition.
* @return the {@link SyncPoller} for polling of custom Locations definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<CustomLocationInner>, CustomLocationInner> beginCreateOrUpdate(
String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context);

Expand Down Expand Up @@ -188,9 +192,9 @@ CustomLocationInner createOrUpdate(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String resourceName);

/**
Expand All @@ -202,9 +206,9 @@ CustomLocationInner createOrUpdate(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String resourceName, Context context);

/**
Expand Down Expand Up @@ -256,7 +260,7 @@ CustomLocationInner createOrUpdate(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return custom Locations definition.
* @return custom Locations definition along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<CustomLocationInner> updateWithResponse(
Expand All @@ -270,7 +274,7 @@ Response<CustomLocationInner> updateWithResponse(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of the Enabled Resource Types.
* @return the list of the Enabled Resource Types as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<EnabledResourceTypeInner> listEnabledResourceTypes(String resourceGroupName, String resourceName);
Expand All @@ -284,7 +288,7 @@ Response<CustomLocationInner> updateWithResponse(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of the Enabled Resource Types.
* @return the list of the Enabled Resource Types as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<EnabledResourceTypeInner> listEnabledResourceTypes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.extendedlocation.models.CustomLocationPropertiesAuthentication;
import com.azure.resourcemanager.extendedlocation.models.HostType;
import com.azure.resourcemanager.extendedlocation.models.Identity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Custom Locations definition. */
@Fluent
public final class CustomLocationInner extends Resource {
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationInner.class);

/*
* Identity for the resource.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
package com.azure.resourcemanager.extendedlocation.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Custom Locations operation. */
@Fluent
public final class CustomLocationOperationInner {
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationOperationInner.class);

/*
* Describes the properties of a Custom Locations Operation Value Display.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
package com.azure.resourcemanager.extendedlocation.fluent.models;

import com.azure.core.annotation.Immutable;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Describes the properties of a Custom Locations Operation Value Display. */
@Immutable
public final class CustomLocationOperationValueDisplay {
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationOperationValueDisplay.class);

/*
* The description of the operation.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
package com.azure.resourcemanager.extendedlocation.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.extendedlocation.models.CustomLocationPropertiesAuthentication;
import com.azure.resourcemanager.extendedlocation.models.HostType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Properties for a custom location. */
@Fluent
public final class CustomLocationProperties {
@JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationProperties.class);

/*
* This is optional input that contains the authentication that should be
* used to generate the namespace.
Expand Down
Loading