Skip to content

Commit 296f1fa

Browse files
authored
Batch: Add Support for Options Bags and Certificates to Dataplane SDK (Azure#44722)
* Remove all handwritten Options Bag methods * Delete more handwritten options classes * Delete the rest of the generated models * Delete the rest of the generated files * Update tsp location hash * Regenerate SDK from new TypeSpec * Add back handwritten fromException method * Fix errors in generated sample and test files * Regenerate to fix formatting * Add createTasks method to both clients * Fix errors in unit tests * Fix getNodeFileProperties method in both clients * Fix getTaskFileProperties method in both clients * Add AzureNamedKeyCredential to client builder * Add cspell overrides for generated sample files * Add cspell suppressions * Update TypeSpec commit hash * Delete unnecessary generated samples and tests * Regenerate SDK from latest TypeSpec * Remove cspell exceptions * Update Javadocs * Fix Readme * Add changelog * Fix changelog version
1 parent 24edb14 commit 296f1fa

File tree

142 files changed

+33274
-127621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+33274
-127621
lines changed

sdk/batch/azure-compute-batch/CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# Release History
22

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

55
### Features Added
66

7+
- Re-added support for certificates:
8+
- 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`.
9+
710
### Breaking Changes
811

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

11-
### Other Changes
14+
- 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.
15+
- 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`.
1216

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

sdk/batch/azure-compute-batch/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,14 @@ batchClient.createTask(jobId, taskToCreate);
161161

162162
Error handling
163163

164-
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.
164+
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.
165165

166166
```java
167-
try(
168-
167+
try {
169168
BatchPool pool = batchClient.getPool("poolthatdoesnotexist");
170-
171169
} catch (HttpResponseException err) {
172-
173170
BatchError batchError = BatchError.fromException(err);
174-
Assertions.assertEquals("PoolNotFound", error.getCode());
171+
Assertions.assertEquals("PoolNotFound", batchError.getCode());
175172
}
176173
```
177174

sdk/batch/azure-compute-batch/src/main/java/com/azure/compute/batch/BatchAsyncClient.java

Lines changed: 12019 additions & 26162 deletions
Large diffs are not rendered by default.

sdk/batch/azure-compute-batch/src/main/java/com/azure/compute/batch/BatchClient.java

Lines changed: 11320 additions & 25330 deletions
Large diffs are not rendered by default.

sdk/batch/azure-compute-batch/src/main/java/com/azure/compute/batch/BatchClientBuilder.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import com.azure.core.credential.AzureNamedKeyCredential;
1515
import com.azure.core.credential.TokenCredential;
1616
import com.azure.core.http.HttpClient;
17-
import com.azure.core.http.HttpHeaderName;
1817
import com.azure.core.http.HttpHeaders;
1918
import com.azure.core.http.HttpPipeline;
2019
import com.azure.core.http.HttpPipelineBuilder;
@@ -281,6 +280,13 @@ private BatchClientImpl buildInnerClient() {
281280
return client;
282281
}
283282

283+
@Generated
284+
private void validateClient() {
285+
// This method is invoked from 'buildInnerClient'/'buildClient' method.
286+
// Developer can customize this method, to validate that the necessary conditions are met for the new client.
287+
Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");
288+
}
289+
284290
private HttpPipeline createHttpPipeline() {
285291
Configuration buildConfiguration
286292
= (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
@@ -293,10 +299,8 @@ private HttpPipeline createHttpPipeline() {
293299
policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
294300
policies.add(new RequestIdPolicy("client-request-id"));
295301
policies.add(new AddHeadersFromContextPolicy());
296-
HttpHeaders headers = new HttpHeaders();
297-
localClientOptions.getHeaders()
298-
.forEach(header -> headers.set(HttpHeaderName.fromString(header.getName()), header.getValue()));
299-
if (headers.getSize() > 0) {
302+
HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions);
303+
if (headers != null) {
300304
policies.add(new AddHeadersPolicy(headers));
301305
}
302306
this.pipelinePolicies.stream()
@@ -314,7 +318,7 @@ private HttpPipeline createHttpPipeline() {
314318
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
315319
.forEach(p -> policies.add(p));
316320
HttpPolicyProviders.addAfterRetryPolicies(policies);
317-
policies.add(new HttpLoggingPolicy(httpLogOptions));
321+
policies.add(new HttpLoggingPolicy(localHttpLogOptions));
318322
HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0]))
319323
.httpClient(httpClient)
320324
.clientOptions(localClientOptions)
@@ -343,11 +347,4 @@ public BatchClient buildClient() {
343347
}
344348

345349
private static final ClientLogger LOGGER = new ClientLogger(BatchClientBuilder.class);
346-
347-
@Generated
348-
private void validateClient() {
349-
// This method is invoked from 'buildInnerClient'/'buildClient' method.
350-
// Developer can customize this method, to validate that the necessary conditions are met for the new client.
351-
Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");
352-
}
353350
}

0 commit comments

Comments
 (0)