Skip to content

Commit

Permalink
[Automation] Generate Fluent Lite from quota#package-2021-03-15-previ…
Browse files Browse the repository at this point in the history
…ew (#25322)
  • Loading branch information
azure-sdk authored Nov 11, 2021
1 parent b05b6ce commit 4ce15ee
Show file tree
Hide file tree
Showing 19 changed files with 149 additions and 253 deletions.
25 changes: 21 additions & 4 deletions sdk/quota/azure-resourcemanager-quota/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.2 (2021-11-11)

### Features Added
- Azure Resource Manager quota client library for Java. This package contains Microsoft Azure SDK for quota Management SDK. Microsoft Azure Quota Resource Provider. Package tag package-2021-03-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Breaking Changes

### Bugs Fixed
* `models.Operations` was removed

* `models.LimitValue` was removed

#### `QuotaManager` was modified

* `operations()` was removed

#### `models.LimitObject` was modified

* `withLimitObjectType(models.LimitType)` was removed
* `limitObjectType()` was removed

### Features Added

* `models.QuotaOperations` was added

#### `QuotaManager` was modified

### Other Changes
* `quotaOperations()` was added

## 1.0.0-beta.1 (2021-09-13)

Expand Down
2 changes: 1 addition & 1 deletion sdk/quota/azure-resourcemanager-quota/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-quota</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
68 changes: 33 additions & 35 deletions sdk/quota/azure-resourcemanager-quota/SAMPLE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Code snippets and samples


## Operation

- [List](#operation_list)

## Quota

- [CreateOrUpdate](#quota_createorupdate)
- [Get](#quota_get)
- [List](#quota_list)
- [Update](#quota_update)

## QuotaOperation

- [List](#quotaoperation_list)

## QuotaRequestStatus

- [Get](#quotarequeststatus_get)
Expand All @@ -21,32 +21,10 @@

- [Get](#usages_get)
- [List](#usages_list)
### Operation_List

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

/** Samples for Operation List. */
public final class OperationListSamples {
/*
* x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/GetOperations.json
*/
/**
* Sample code: GetOperations.
*
* @param manager Entry point to QuotaManager.
*/
public static void getOperations(com.azure.resourcemanager.quota.QuotaManager manager) {
manager.operations().list(Context.NONE);
}
}
```

### Quota_CreateOrUpdate

```java
import com.azure.resourcemanager.quota.models.LimitType;
import com.azure.resourcemanager.quota.models.LimitValue;
import com.azure.resourcemanager.quota.models.LimitObject;
import com.azure.resourcemanager.quota.models.QuotaProperties;
import com.azure.resourcemanager.quota.models.ResourceName;

Expand All @@ -69,7 +47,7 @@ public final class QuotaCreateOrUpdateSamples {
"subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.MachineLearningServices/locations/eastus")
.withProperties(
new QuotaProperties()
.withLimit(new LimitValue().withValue(10).withLimitObjectType(LimitType.LIMIT_VALUE))
.withLimit(new LimitObject().withValue(10))
.withName(new ResourceName().withValue("TotalLowPriorityCores"))
.withResourceType("lowPriority"))
.create();
Expand All @@ -92,7 +70,7 @@ public final class QuotaCreateOrUpdateSamples {
"subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus")
.withProperties(
new QuotaProperties()
.withLimit(new LimitValue().withValue(10).withLimitObjectType(LimitType.LIMIT_VALUE))
.withLimit(new LimitObject().withValue(10))
.withName(new ResourceName().withValue("StandardSkuPublicIpAddresses"))
.withResourceType("PublicIpAddresses"))
.create();
Expand All @@ -114,7 +92,7 @@ public final class QuotaCreateOrUpdateSamples {
"subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus")
.withProperties(
new QuotaProperties()
.withLimit(new LimitValue().withValue(10).withLimitObjectType(LimitType.LIMIT_VALUE))
.withLimit(new LimitObject().withValue(10))
.withName(new ResourceName().withValue("standardFSv2Family")))
.create();
}
Expand All @@ -135,7 +113,7 @@ public final class QuotaCreateOrUpdateSamples {
"subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus")
.withProperties(
new QuotaProperties()
.withLimit(new LimitValue().withValue(10).withLimitObjectType(LimitType.LIMIT_VALUE))
.withLimit(new LimitObject().withValue(10))
.withName(new ResourceName().withValue("MinPublicIpInterNetworkPrefixLength"))
.withResourceType("MinPublicIpInterNetworkPrefixLength"))
.create();
Expand Down Expand Up @@ -249,8 +227,7 @@ public final class QuotaListSamples {
```java
import com.azure.core.util.Context;
import com.azure.resourcemanager.quota.models.CurrentQuotaLimitBase;
import com.azure.resourcemanager.quota.models.LimitType;
import com.azure.resourcemanager.quota.models.LimitValue;
import com.azure.resourcemanager.quota.models.LimitObject;
import com.azure.resourcemanager.quota.models.QuotaProperties;
import com.azure.resourcemanager.quota.models.ResourceName;

Expand All @@ -277,7 +254,7 @@ public final class QuotaUpdateSamples {
.update()
.withProperties(
new QuotaProperties()
.withLimit(new LimitValue().withValue(10).withLimitObjectType(LimitType.LIMIT_VALUE))
.withLimit(new LimitObject().withValue(10))
.withName(new ResourceName().withValue("standardFSv2Family")))
.apply();
}
Expand All @@ -303,14 +280,35 @@ public final class QuotaUpdateSamples {
.update()
.withProperties(
new QuotaProperties()
.withLimit(new LimitValue().withValue(10).withLimitObjectType(LimitType.LIMIT_VALUE))
.withLimit(new LimitObject().withValue(10))
.withName(new ResourceName().withValue("MinPublicIpInterNetworkPrefixLength"))
.withResourceType("MinPublicIpInterNetworkPrefixLength"))
.apply();
}
}
```

### QuotaOperation_List

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

/** Samples for QuotaOperation List. */
public final class QuotaOperationListSamples {
/*
* x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/GetOperations.json
*/
/**
* Sample code: GetOperations.
*
* @param manager Entry point to QuotaManager.
*/
public static void getOperations(com.azure.resourcemanager.quota.QuotaManager manager) {
manager.quotaOperations().list(Context.NONE);
}
}
```

### QuotaRequestStatus_Get

```java
Expand Down
13 changes: 4 additions & 9 deletions sdk/quota/azure-resourcemanager-quota/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
<jacoco.skip>true</jacoco.skip>
<codesnippet.skip>false</codesnippet.skip>
<javadocDoclet></javadocDoclet>
<javadocDocletOptions></javadocDocletOptions>
</properties>
<dependencies>
<dependency>
Expand All @@ -54,14 +57,6 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version> <!-- {x-version-update;org.jacoco:jacoco-maven-plugin;external_dependency} -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.revapi</groupId>
<artifactId>revapi-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
Expand All @@ -22,11 +23,11 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.quota.fluent.AzureQuotaExtensionApi;
import com.azure.resourcemanager.quota.implementation.AzureQuotaExtensionApiBuilder;
import com.azure.resourcemanager.quota.implementation.OperationsImpl;
import com.azure.resourcemanager.quota.implementation.QuotaOperationsImpl;
import com.azure.resourcemanager.quota.implementation.QuotaRequestStatusImpl;
import com.azure.resourcemanager.quota.implementation.QuotasImpl;
import com.azure.resourcemanager.quota.implementation.UsagesImpl;
import com.azure.resourcemanager.quota.models.Operations;
import com.azure.resourcemanager.quota.models.QuotaOperations;
import com.azure.resourcemanager.quota.models.QuotaRequestStatus;
import com.azure.resourcemanager.quota.models.Quotas;
import com.azure.resourcemanager.quota.models.Usages;
Expand All @@ -35,6 +36,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/** Entry point to QuotaManager. Microsoft Azure Quota Resource Provider. */
public final class QuotaManager {
Expand All @@ -44,7 +46,7 @@ public final class QuotaManager {

private QuotaRequestStatus quotaRequestStatus;

private Operations operations;
private QuotaOperations quotaOperations;

private final AzureQuotaExtensionApi clientObject;

Expand Down Expand Up @@ -181,7 +183,7 @@ public QuotaManager authenticate(TokenCredential credential, AzureProfile profil
.append("-")
.append("com.azure.resourcemanager.quota")
.append("/")
.append("1.0.0-beta.1");
.append("1.0.0-beta.2");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand All @@ -204,11 +206,24 @@ public QuotaManager authenticate(TokenCredential credential, AzureProfile profil
List<HttpPipelinePolicy> policies = new ArrayList<>();
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
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 @@ -244,12 +259,12 @@ public QuotaRequestStatus quotaRequestStatus() {
return quotaRequestStatus;
}

/** @return Resource collection API of Operations. */
public Operations operations() {
if (this.operations == null) {
this.operations = new OperationsImpl(clientObject.getOperations(), this);
/** @return Resource collection API of QuotaOperations. */
public QuotaOperations quotaOperations() {
if (this.quotaOperations == null) {
this.quotaOperations = new QuotaOperationsImpl(clientObject.getQuotaOperations(), this);
}
return operations;
return quotaOperations;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public interface AzureQuotaExtensionApi {
QuotaRequestStatusClient getQuotaRequestStatus();

/**
* Gets the OperationsClient object to access its operations.
* Gets the QuotaOperationsClient object to access its operations.
*
* @return the OperationsClient object.
* @return the QuotaOperationsClient object.
*/
OperationsClient getOperations();
QuotaOperationsClient getQuotaOperations();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import com.azure.core.util.Context;
import com.azure.resourcemanager.quota.fluent.models.OperationResponseInner;

/** An instance of this class provides access to all the operations defined in OperationsClient. */
public interface OperationsClient {
/** An instance of this class provides access to all the operations defined in QuotaOperationsClient. */
public interface QuotaOperationsClient {
/**
* List all the operations supported by the Microsoft.Quota resource provider.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public interface QuotasClient {
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return quota limit.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<CurrentQuotaLimitBaseInner>, CurrentQuotaLimitBaseInner> beginCreateOrUpdate(
String resourceName, String scope, CurrentQuotaLimitBaseInner createQuotaRequest);

Expand All @@ -97,7 +97,7 @@ SyncPoller<PollResult<CurrentQuotaLimitBaseInner>, CurrentQuotaLimitBaseInner> b
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return quota limit.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<CurrentQuotaLimitBaseInner>, CurrentQuotaLimitBaseInner> beginCreateOrUpdate(
String resourceName, String scope, CurrentQuotaLimitBaseInner createQuotaRequest, Context context);

Expand Down Expand Up @@ -170,7 +170,7 @@ CurrentQuotaLimitBaseInner createOrUpdate(
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return quota limit.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<CurrentQuotaLimitBaseInner>, CurrentQuotaLimitBaseInner> beginUpdate(
String resourceName, String scope, CurrentQuotaLimitBaseInner createQuotaRequest);

Expand All @@ -195,7 +195,7 @@ SyncPoller<PollResult<CurrentQuotaLimitBaseInner>, CurrentQuotaLimitBaseInner> b
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return quota limit.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<CurrentQuotaLimitBaseInner>, CurrentQuotaLimitBaseInner> beginUpdate(
String resourceName, String scope, CurrentQuotaLimitBaseInner createQuotaRequest, Context context);

Expand Down
Loading

0 comments on commit 4ce15ee

Please sign in to comment.