Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch: Add Support for Options Bags and Certificates to Dataplane SDK #44722

Merged
merged 24 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
63d012a
Remove all handwritten Options Bag methods
skapur12 Mar 19, 2025
31c019b
Delete more handwritten options classes
skapur12 Mar 19, 2025
3977f38
Delete the rest of the generated models
skapur12 Mar 19, 2025
52cedd3
Delete the rest of the generated files
skapur12 Mar 19, 2025
622221f
Update tsp location hash
skapur12 Mar 19, 2025
2fd30ef
Regenerate SDK from new TypeSpec
skapur12 Mar 19, 2025
1ff0383
Add back handwritten fromException method
skapur12 Mar 19, 2025
5b02bfa
Fix errors in generated sample and test files
skapur12 Mar 19, 2025
08e6834
Regenerate to fix formatting
skapur12 Mar 20, 2025
4abc5bc
Add createTasks method to both clients
skapur12 Mar 20, 2025
6c0490f
Fix errors in unit tests
skapur12 Mar 20, 2025
5af7c9a
Fix getNodeFileProperties method in both clients
skapur12 Mar 20, 2025
25c3fa8
Fix getTaskFileProperties method in both clients
skapur12 Mar 20, 2025
f1cf1b1
Add AzureNamedKeyCredential to client builder
skapur12 Mar 20, 2025
500a08f
Add cspell overrides for generated sample files
skapur12 Mar 20, 2025
bb1f715
Add cspell suppressions
skapur12 Mar 21, 2025
628f0a5
Update TypeSpec commit hash
skapur12 Mar 21, 2025
a5c6b10
Delete unnecessary generated samples and tests
skapur12 Mar 21, 2025
4ae38e5
Regenerate SDK from latest TypeSpec
skapur12 Mar 21, 2025
87073eb
Remove cspell exceptions
skapur12 Mar 21, 2025
29129be
Update Javadocs
skapur12 Mar 22, 2025
05d4d79
Fix Readme
skapur12 Mar 22, 2025
09a1ef2
Add changelog
skapur12 Mar 24, 2025
0894eee
Fix changelog version
skapur12 Mar 24, 2025
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
10 changes: 7 additions & 3 deletions sdk/batch/azure-compute-batch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Release History

## 1.0.0-beta.4 (Unreleased)
## 1.0.0-beta.4 (2025-03-24)

### Features Added

- Re-added support for certificates:
- Added `createCertificate(BatchCertificate certificate)`, `listCertificates()`, `cancelCertificateDeletion(String thumbprintAlgorithm, String thumbprint)`, `deleteCertificate(String thumbprintAlgorithm, String thumbprint)`, and `getCertificate(String thumbprintAlgorithm, String thumbprint)` methods to `BatchClient` and `BatchAsyncClient`.

### Breaking Changes

### Bugs Fixed
- Renamed `GetApplicationOptions` to `GetBatchApplicationOptions` (the name of the class of optional parameters for the `getApplication(String applicationId)` method).

### Other Changes
- For several methods in `BatchClient` and `BatchAsyncClient` with an optional parameter group, the `requestConditions` parameter was moved out of the optional parameter group and is now a separate parameter.
- Affected methods: `deletePool`, `poolExists`, `getPool`, `updatePool`, `enablePoolAutoScale`, `resizePool`, `stopPoolResize`, `removeNodes`, `deleteJob`, `getJob`, `updateJob`, `replaceJob`, `disableJob`, `enableJob`, `terminateJob`, `jobScheduleExists`, `deleteJobSchedule`, `getJobSchedule`, `updateJobSchedule`, `replaceJobSchedule`, `disableJobSchedule`, `enableJobSchedule`, `terminateJobSchedule`, `deleteTask`, `getTask`, `replaceTask`, `terminateTask`, and `reactivateTask`.

## 1.0.0-beta.3 (2024-10-31)

Expand Down
9 changes: 3 additions & 6 deletions sdk/batch/azure-compute-batch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,14 @@ batchClient.createTask(jobId, taskToCreate);

Error handling

When a call to the batch service fails the response from that call will contain a BatchError object in the body of the response. In the AZURE-COMPUTE-BATCH SDK when an api method is called and a failure from the server occurs the sdk will throw a HttpResponseException exception. You can use the helper method BatchError.fromException() to extract out the BatchError object.
When a call to the batch service fails the response from that call will contain a BatchError object in the body of the response. In the AZURE-COMPUTE-BATCH SDK when an api method is called and a failure from the server occurs the sdk will throw a HttpResponseException exception. You can use the helper method BatchError.fromException() to extract out the BatchError object.

```java
try(

try {
BatchPool pool = batchClient.getPool("poolthatdoesnotexist");

} catch (HttpResponseException err) {

BatchError batchError = BatchError.fromException(err);
Assertions.assertEquals("PoolNotFound", error.getCode());
Assertions.assertEquals("PoolNotFound", batchError.getCode());
}
```

Expand Down
38,181 changes: 12,019 additions & 26,162 deletions sdk/batch/azure-compute-batch/src/main/java/com/azure/compute/batch/BatchAsyncClient.java

Large diffs are not rendered by default.

36,650 changes: 11,320 additions & 25,330 deletions sdk/batch/azure-compute-batch/src/main/java/com/azure/compute/batch/BatchClient.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.azure.core.credential.AzureNamedKeyCredential;
import com.azure.core.credential.TokenCredential;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpHeaderName;
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
Expand Down Expand Up @@ -281,6 +280,13 @@ private BatchClientImpl buildInnerClient() {
return client;
}

@Generated
private void validateClient() {
// This method is invoked from 'buildInnerClient'/'buildClient' method.
// Developer can customize this method, to validate that the necessary conditions are met for the new client.
Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");
}

private HttpPipeline createHttpPipeline() {
Configuration buildConfiguration
= (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
Expand All @@ -293,10 +299,8 @@ private HttpPipeline createHttpPipeline() {
policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
policies.add(new RequestIdPolicy("client-request-id"));
policies.add(new AddHeadersFromContextPolicy());
HttpHeaders headers = new HttpHeaders();
localClientOptions.getHeaders()
.forEach(header -> headers.set(HttpHeaderName.fromString(header.getName()), header.getValue()));
if (headers.getSize() > 0) {
HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions);
if (headers != null) {
policies.add(new AddHeadersPolicy(headers));
}
this.pipelinePolicies.stream()
Expand All @@ -314,7 +318,7 @@ private HttpPipeline createHttpPipeline() {
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.forEach(p -> policies.add(p));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
policies.add(new HttpLoggingPolicy(localHttpLogOptions));
HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0]))
.httpClient(httpClient)
.clientOptions(localClientOptions)
Expand Down Expand Up @@ -343,11 +347,4 @@ public BatchClient buildClient() {
}

private static final ClientLogger LOGGER = new ClientLogger(BatchClientBuilder.class);

@Generated
private void validateClient() {
// This method is invoked from 'buildInnerClient'/'buildClient' method.
// Developer can customize this method, to validate that the necessary conditions are met for the new client.
Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");
}
}
Loading