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.3 (Unreleased)
## 1.0.0-beta.1 (2022-09-29)

- Azure Resource Manager PolicyInsights client library for Java. This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2022-09. 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 @@ -2,7 +2,7 @@

Azure Resource Manager PolicyInsights client library for Java.

This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-10. 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 PolicyInsights Management SDK. Package tag package-2022-09. 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-policyinsights</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
228 changes: 194 additions & 34 deletions sdk/policyinsights/azure-resourcemanager-policyinsights/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 PolicyInsights Management</name>
<description>This package contains Microsoft Azure SDK for PolicyInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-10.</description>
<description>This package contains Microsoft Azure SDK for PolicyInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2022-09.</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 @@ -10,11 +10,13 @@
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 @@ -91,6 +93,19 @@ public static PolicyInsightsManager authenticate(TokenCredential credential, Azu
return configure().authenticate(credential, profile);
}

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

/**
* Gets a Configurable instance that can be used to create PolicyInsightsManager with optional configuration.
*
Expand All @@ -102,13 +117,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 @@ -169,16 +185,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 @@ -200,7 +231,7 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi
.append("-")
.append("com.azure.resourcemanager.policyinsights")
.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 @@ -218,10 +249,15 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi
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(
Expand Down Expand Up @@ -252,7 +288,11 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi
}
}

/** @return Resource collection API of PolicyTrackedResources. */
/**
* Gets the resource collection API of PolicyTrackedResources.
*
* @return Resource collection API of PolicyTrackedResources.
*/
public PolicyTrackedResources policyTrackedResources() {
if (this.policyTrackedResources == null) {
this.policyTrackedResources =
Expand All @@ -261,55 +301,83 @@ public PolicyTrackedResources policyTrackedResources() {
return policyTrackedResources;
}

/** @return Resource collection API of Remediations. */
/**
* Gets the resource collection API of Remediations. It manages Remediation.
*
* @return Resource collection API of Remediations.
*/
public Remediations remediations() {
if (this.remediations == null) {
this.remediations = new RemediationsImpl(clientObject.getRemediations(), this);
}
return remediations;
}

/** @return Resource collection API of PolicyEvents. */
/**
* Gets the resource collection API of PolicyEvents.
*
* @return Resource collection API of PolicyEvents.
*/
public PolicyEvents policyEvents() {
if (this.policyEvents == null) {
this.policyEvents = new PolicyEventsImpl(clientObject.getPolicyEvents(), this);
}
return policyEvents;
}

/** @return Resource collection API of PolicyStates. */
/**
* Gets the resource collection API of PolicyStates.
*
* @return Resource collection API of PolicyStates.
*/
public PolicyStates policyStates() {
if (this.policyStates == null) {
this.policyStates = new PolicyStatesImpl(clientObject.getPolicyStates(), this);
}
return policyStates;
}

/** @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 PolicyMetadatas. */
/**
* Gets the resource collection API of PolicyMetadatas.
*
* @return Resource collection API of PolicyMetadatas.
*/
public PolicyMetadatas policyMetadatas() {
if (this.policyMetadatas == null) {
this.policyMetadatas = new PolicyMetadatasImpl(clientObject.getPolicyMetadatas(), this);
}
return policyMetadatas;
}

/** @return Resource collection API of PolicyRestrictions. */
/**
* Gets the resource collection API of PolicyRestrictions.
*
* @return Resource collection API of PolicyRestrictions.
*/
public PolicyRestrictions policyRestrictions() {
if (this.policyRestrictions == null) {
this.policyRestrictions = new PolicyRestrictionsImpl(clientObject.getPolicyRestrictions(), this);
}
return policyRestrictions;
}

/** @return Resource collection API of Attestations. */
/**
* Gets the resource collection API of Attestations. It manages Attestation.
*
* @return Resource collection API of Attestations.
*/
public Attestations attestations() {
if (this.attestations == null) {
this.attestations = new AttestationsImpl(clientObject.getAttestations(), this);
Expand Down
Loading