Skip to content

Commit

Permalink
[Automation] Generate Fluent Lite from batch#package-2024-02 (#39424)
Browse files Browse the repository at this point in the history
* [Automation] Generate Fluent Lite from batch#package-2024-02

* fix mgmt live test

* imports

---------

Co-authored-by: XiaofeiCao <xiaofeicao@microsoft.com>
  • Loading branch information
azure-sdk and XiaofeiCao authored Mar 27, 2024
1 parent e6e6f21 commit 00db29e
Show file tree
Hide file tree
Showing 127 changed files with 2,009 additions and 567 deletions.
28 changes: 24 additions & 4 deletions sdk/batch/azure-resourcemanager-batch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
# Release History

## 1.1.0-beta.4 (Unreleased)
## 1.1.0-beta.4 (2024-03-27)

- Azure Resource Manager Batch client library for Java. This package contains Microsoft Azure SDK for Batch Management SDK. Batch Client. Package tag package-2024-02. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

### Breaking Changes
* `models.UpgradePolicy` was added

* `models.RollingUpgradePolicy` was added

* `models.UpgradeMode` was added

* `models.AutomaticOSUpgradePolicy` was added

#### `models.SupportedSku` was modified

* `batchSupportEndOfLife()` was added

### Bugs Fixed
#### `models.Pool$Definition` was modified

* `withUpgradePolicy(models.UpgradePolicy)` was added

#### `models.Pool` was modified

* `upgradePolicy()` was added

#### `models.Pool$Update` was modified

### Other Changes
* `withUpgradePolicy(models.UpgradePolicy)` was added

## 1.1.0-beta.3 (2023-12-22)

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

Azure Resource Manager Batch client library for Java.

This package contains Microsoft Azure SDK for Batch Management SDK. Batch Client. Package tag package-2023-11. 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 Batch Management SDK. Batch Client. Package tag package-2024-02. 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-batch</artifactId>
<version>1.1.0-beta.3</version>
<version>1.1.0-beta.4</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
829 changes: 652 additions & 177 deletions sdk/batch/azure-resourcemanager-batch/SAMPLE.md

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions sdk/batch/azure-resourcemanager-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for Batch Management</name>
<description>This package contains Microsoft Azure SDK for Batch Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Batch Client. Package tag package-2023-11.</description>
<description>This package contains Microsoft Azure SDK for Batch Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Batch Client. Package tag package-2024-02.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down Expand Up @@ -88,8 +88,6 @@
<version>4.11.0</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
<scope>test</scope>
</dependency>
<!-- bytebuddy dependencies are required for mockito 4.11.0 to work with Java 21. Mockito 4.11.0 is the last release -->
<!-- of Mockito supporting Java 8 as a baseline. -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public BatchManager authenticate(TokenCredential credential, AzureProfile profil

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.batch").append("/")
.append("1.1.0-beta.3");
.append("1.1.0-beta.4");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (").append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ").append(Configuration.getGlobalConfiguration().get("os.name")).append("; ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.StartTask;
import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.UserAccount;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
Expand Down Expand Up @@ -684,6 +685,29 @@ public NodeCommunicationMode currentNodeCommunicationMode() {
return this.innerProperties() == null ? null : this.innerProperties().currentNodeCommunicationMode();
}

/**
* Get the upgradePolicy property: Describes an upgrade policy - automatic, manual, or rolling.
*
* @return the upgradePolicy value.
*/
public UpgradePolicy upgradePolicy() {
return this.innerProperties() == null ? null : this.innerProperties().upgradePolicy();
}

/**
* Set the upgradePolicy property: Describes an upgrade policy - automatic, manual, or rolling.
*
* @param upgradePolicy the upgradePolicy value to set.
* @return the PoolInner object itself.
*/
public PoolInner withUpgradePolicy(UpgradePolicy upgradePolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new PoolProperties();
}
this.innerProperties().withUpgradePolicy(upgradePolicy);
return this;
}

/**
* Get the resourceTags property: The user-defined tags to be associated with the Azure Batch Pool. When specified,
* these tags are propagated to the backing Azure resources associated with the pool. This property can only be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.StartTask;
import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.UserAccount;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down Expand Up @@ -256,6 +257,12 @@ public final class PoolProperties {
@JsonProperty(value = "currentNodeCommunicationMode", access = JsonProperty.Access.WRITE_ONLY)
private NodeCommunicationMode currentNodeCommunicationMode;

/*
* Describes an upgrade policy - automatic, manual, or rolling.
*/
@JsonProperty(value = "upgradePolicy")
private UpgradePolicy upgradePolicy;

/*
* The user-defined tags to be associated with the Azure Batch Pool. When specified, these tags are propagated to
* the backing Azure resources associated with the pool. This property can only be specified when the Batch account
Expand Down Expand Up @@ -812,6 +819,26 @@ public NodeCommunicationMode currentNodeCommunicationMode() {
return this.currentNodeCommunicationMode;
}

/**
* Get the upgradePolicy property: Describes an upgrade policy - automatic, manual, or rolling.
*
* @return the upgradePolicy value.
*/
public UpgradePolicy upgradePolicy() {
return this.upgradePolicy;
}

/**
* Set the upgradePolicy property: Describes an upgrade policy - automatic, manual, or rolling.
*
* @param upgradePolicy the upgradePolicy value to set.
* @return the PoolProperties object itself.
*/
public PoolProperties withUpgradePolicy(UpgradePolicy upgradePolicy) {
this.upgradePolicy = upgradePolicy;
return this;
}

/**
* Get the resourceTags property: The user-defined tags to be associated with the Azure Batch Pool. When specified,
* these tags are propagated to the backing Azure resources associated with the pool. This property can only be
Expand Down Expand Up @@ -878,5 +905,8 @@ public void validate() {
if (mountConfiguration() != null) {
mountConfiguration().forEach(e -> e.validate());
}
if (upgradePolicy() != null) {
upgradePolicy().validate();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.azure.core.annotation.Immutable;
import com.azure.resourcemanager.batch.models.SkuCapability;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/**
Expand All @@ -32,6 +33,12 @@ public final class SupportedSkuInner {
@JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY)
private List<SkuCapability> capabilities;

/*
* The time when Azure Batch service will retire this SKU.
*/
@JsonProperty(value = "batchSupportEndOfLife", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime batchSupportEndOfLife;

/**
* Creates an instance of SupportedSkuInner class.
*/
Expand Down Expand Up @@ -65,6 +72,15 @@ public List<SkuCapability> capabilities() {
return this.capabilities;
}

/**
* Get the batchSupportEndOfLife property: The time when Azure Batch service will retire this SKU.
*
* @return the batchSupportEndOfLife value.
*/
public OffsetDateTime batchSupportEndOfLife() {
return this.batchSupportEndOfLife;
}

/**
* Validates the instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public Application apply(Context context) {
ApplicationImpl(ApplicationInner innerObject, com.azure.resourcemanager.batch.BatchManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.accountName = Utils.getValueFromIdByName(innerObject.id(), "batchAccounts");
this.applicationName = Utils.getValueFromIdByName(innerObject.id(), "applications");
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "batchAccounts");
this.applicationName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "applications");
}

public Application refresh() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,33 @@ public PagedIterable<ApplicationPackage> list(String resourceGroupName, String a
String applicationName) {
PagedIterable<ApplicationPackageInner> inner
= this.serviceClient().list(resourceGroupName, accountName, applicationName);
return Utils.mapPage(inner, inner1 -> new ApplicationPackageImpl(inner1, this.manager()));
return ResourceManagerUtils.mapPage(inner, inner1 -> new ApplicationPackageImpl(inner1, this.manager()));
}

public PagedIterable<ApplicationPackage> list(String resourceGroupName, String accountName, String applicationName,
Integer maxresults, Context context) {
PagedIterable<ApplicationPackageInner> inner
= this.serviceClient().list(resourceGroupName, accountName, applicationName, maxresults, context);
return Utils.mapPage(inner, inner1 -> new ApplicationPackageImpl(inner1, this.manager()));
return ResourceManagerUtils.mapPage(inner, inner1 -> new ApplicationPackageImpl(inner1, this.manager()));
}

public ApplicationPackage getById(String id) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "batchAccounts");
String accountName = ResourceManagerUtils.getValueFromIdByName(id, "batchAccounts");
if (accountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id)));
}
String applicationName = Utils.getValueFromIdByName(id, "applications");
String applicationName = ResourceManagerUtils.getValueFromIdByName(id, "applications");
if (applicationName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id)));
}
String versionName = Utils.getValueFromIdByName(id, "versions");
String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions");
if (versionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id)));
Expand All @@ -124,22 +124,22 @@ public ApplicationPackage getById(String id) {
}

public Response<ApplicationPackage> getByIdWithResponse(String id, Context context) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "batchAccounts");
String accountName = ResourceManagerUtils.getValueFromIdByName(id, "batchAccounts");
if (accountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id)));
}
String applicationName = Utils.getValueFromIdByName(id, "applications");
String applicationName = ResourceManagerUtils.getValueFromIdByName(id, "applications");
if (applicationName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id)));
}
String versionName = Utils.getValueFromIdByName(id, "versions");
String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions");
if (versionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id)));
Expand All @@ -148,22 +148,22 @@ public Response<ApplicationPackage> getByIdWithResponse(String id, Context conte
}

public void deleteById(String id) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "batchAccounts");
String accountName = ResourceManagerUtils.getValueFromIdByName(id, "batchAccounts");
if (accountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id)));
}
String applicationName = Utils.getValueFromIdByName(id, "applications");
String applicationName = ResourceManagerUtils.getValueFromIdByName(id, "applications");
if (applicationName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id)));
}
String versionName = Utils.getValueFromIdByName(id, "versions");
String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions");
if (versionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id)));
Expand All @@ -172,22 +172,22 @@ public void deleteById(String id) {
}

public Response<Void> deleteByIdWithResponse(String id, Context context) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "batchAccounts");
String accountName = ResourceManagerUtils.getValueFromIdByName(id, "batchAccounts");
if (accountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id)));
}
String applicationName = Utils.getValueFromIdByName(id, "applications");
String applicationName = ResourceManagerUtils.getValueFromIdByName(id, "applications");
if (applicationName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id)));
}
String versionName = Utils.getValueFromIdByName(id, "versions");
String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions");
if (versionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id)));
Expand Down
Loading

0 comments on commit 00db29e

Please sign in to comment.