Skip to content

Commit 972b97b

Browse files
Pre-GA release followup for Deid (Azure#44893)
* Add custom request matcher to ignore Intellij headers * Customizations * Use TypeSpec fixes * JobName fix - enable samples README * Restore generation * update sample links * links * update OperationState client name * update TypeSpec commit * update changelog * update release date --------- Co-authored-by: Josiah Vinson <[email protected]>
1 parent a20949c commit 972b97b

File tree

20 files changed

+268
-338
lines changed

20 files changed

+268
-338
lines changed

sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md

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

3-
## 1.0.0 (2025-02-17)
3+
## 1.0.0 (2025-04-10)
44

55
### Features Added
66

7-
- Introduced `DeidentificationCustomizationOptions` and `DeidentificationJobCustomizationOptions` models
8-
- Added `SurrogateLocale` field in these models
9-
- Moved `RedactionFormat` field into these models
10-
- Introduced `Overwrite` flag in `TargetStorageLocation` model
7+
- Introduced `DeidentificationCustomizationOptions` and `DeidentificationJobCustomizationOptions` models.
8+
- Added `SurrogateLocale` field in these models.
9+
- Moved `RedactionFormat` field into these models.
10+
- Introduced `Overwrite` flag in `TargetStorageLocation` model.
1111

1212
### Breaking Changes
1313

14+
- Changed the name of model `OperationState` to `OperationStatus`.
15+
- Changed the property `DeidentificationJob.name` to `DeidentificationJob.jobName`, and corresponding parameters in client methods.
16+
- Changed the property `DeidentificationJob.type` to `DeidentificationJob.operationType`.
1417
- Changed method names in `DeidentificationClient` to match functionality:
15-
- Changed the `deidentify` method name to `deidentifyText`
16-
- Changed the `beginCreateJob` method name to `beginDeidentifyDocuments`
17-
- Changed `outputPrefix` behavior to no longer include `jobName` by default
18-
- Changed `Path` field to `Location` in `SourceStorageLocation` and `TargetStorageLocation`
19-
- Deprecated `DocumentDataType`
20-
- Deprecated `Path` and `Location` from `TaggerResult` model
18+
- Changed the `deidentify` method name to `deidentifyText`.
19+
- Changed the `beginCreateJob` method name to `beginDeidentifyDocuments`.
20+
- Changed `outputPrefix` behavior to no longer include `jobName` by default.
21+
- Changed `Path` field to `Location` in `SourceStorageLocation` and `TargetStorageLocation`.
22+
- Deprecated `DocumentDataType`.
23+
- Deprecated `Path` and `Location` from `TaggerResult` model.
2124

2225
## 1.0.0-beta.1 (2024-08-15)
2326

sdk/healthdataaiservices/azure-health-deidentification/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ DeidentificationJob job = new DeidentificationJob(
8787
.setOverwrite(true)
8888
);
8989

90-
job.setOperation(DeidentificationOperationType.REDACT);
90+
job.setOperationType(DeidentificationOperationType.REDACT);
9191

9292
String jobName = Configuration.getGlobalConfiguration().get("DEID_JOB_NAME", "MyJob-" + Instant.now().toEpochMilli());
9393
DeidentificationJob result = deidentificationClient.beginDeidentifyDocuments(jobName, job)
@@ -139,7 +139,7 @@ DeidentificationJob job = new DeidentificationJob(
139139
.setOverwrite(true)
140140
);
141141

142-
job.setOperation(DeidentificationOperationType.REDACT);
142+
job.setOperationType(DeidentificationOperationType.REDACT);
143143

144144
String jobName = Configuration.getGlobalConfiguration().get("DEID_JOB_NAME", "MyJob-" + Instant.now().toEpochMilli());
145145
DeidentificationJob result = deidentificationClient.beginDeidentifyDocuments(jobName, job)
@@ -161,7 +161,7 @@ System.out.println(jobName + " - " + result.getStatus());
161161
```java com.azure.health.deidentification.samples.list_deidentification_jobs
162162
PagedIterable<DeidentificationJob> result = deidentificationClient.listJobs();
163163
for (DeidentificationJob job : result) {
164-
System.out.println(job.getName() + " - " + job.getStatus());
164+
System.out.println(job.getJobName() + " - " + job.getStatus());
165165
}
166166
```
167167

sdk/healthdataaiservices/azure-health-deidentification/customization/src/main/java/ListJobsCustomization.java

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,12 @@
22
// Licensed under the MIT License.
33

44
import com.azure.autorest.customization.*;
5-
import com.github.javaparser.StaticJavaParser;
6-
import com.github.javaparser.ast.Modifier;
7-
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
8-
import com.github.javaparser.ast.body.MethodDeclaration;
9-
import com.github.javaparser.javadoc.JavadocBlockTag;
105
import org.slf4j.Logger;
116

12-
/**
13-
* This customizes the generated Azure Deidentification client. The following changes are made by this customization:
14-
* <li>Mark the listJobs() overload with continuationToken parameter in DeidentificationClient as private.</li>
15-
* <li>Mark the listJobs() overload with continuationToken parameter in DeidentificationAsyncClient as privater.</li>
16-
* <li>Mark the listJobDocuments() overload with continuationToken parameter in DeidentificationClient as private.</li>
17-
* <li>Mark the listJobDocuments() overload with continuationToken parameter in DeidentificationAsyncClient as private.</li>
18-
* <li>Rename the 'name' parameter in listJobDocuments() to 'jobName'.</li>
19-
* <li>Rename the 'name' parameter in the JavaDoc for listJobDocuments() to 'jobName'.</li>
20-
*/
217
public class ListJobsCustomization extends Customization {
228

239
@Override
2410
public void customize(LibraryCustomization libraryCustomization, Logger logger) {
25-
PackageCustomization models = libraryCustomization.getPackage("com.azure.health.deidentification");
26-
27-
ClassCustomization deidentificationClientClass = models.getClass("DeidentificationClient");
28-
customizeClassByMarkingContinuationTokenOverloadsPrivate(deidentificationClientClass);
29-
customizeClassByRenamingJobNameParameter(deidentificationClientClass);
30-
customizeJavadocByRenamingJobNameParameter(deidentificationClientClass);
31-
32-
ClassCustomization deidentificationAsyncClientClass = models.getClass("DeidentificationAsyncClient");
33-
customizeClassByMarkingContinuationTokenOverloadsPrivate(deidentificationAsyncClientClass);
34-
customizeClassByRenamingJobNameParameter(deidentificationAsyncClientClass);
35-
customizeJavadocByRenamingJobNameParameter(deidentificationAsyncClientClass);
36-
}
37-
38-
private static void customizeClassByMarkingContinuationTokenOverloadsPrivate(ClassCustomization classCustomization) {
39-
classCustomization.customizeAst(ast -> {
40-
ClassOrInterfaceDeclaration clazz = ast.getClassByName(classCustomization.getClassName()).get();
41-
42-
clazz.getMethodsBySignature("listJobs", "String").get(0).setModifiers(Modifier.Keyword.PRIVATE);
43-
clazz.getMethodsBySignature("listJobDocuments", "String", "String").get(0).setModifiers(Modifier.Keyword.PRIVATE);
44-
});
4511
}
4612

47-
private static void customizeClassByRenamingJobNameParameter(ClassCustomization classCustomization) {
48-
classCustomization.customizeAst(ast -> {
49-
ClassOrInterfaceDeclaration clazz = ast.getClassByName(classCustomization.getClassName()).get();
50-
51-
clazz.getMethodsByName("listJobDocuments").forEach(method -> {
52-
method.getParameterByName("name").ifPresent(parameter -> parameter.setName("jobName"));
53-
method.getBody().ifPresent(body -> {
54-
String updatedBodySyncOnly = body.asBlockStmt().toString().replace("listJobDocuments(name, requestOptions)", "listJobDocuments(jobName, requestOptions)");
55-
String updatedBody = updatedBodySyncOnly.replace("listJobDocumentsAsync(name, requestOptions)", "listJobDocumentsAsync(jobName, requestOptions)");
56-
method.setBody(StaticJavaParser.parseBlock(updatedBody));
57-
});
58-
});
59-
});
60-
}
61-
62-
private static void customizeJavadocByRenamingJobNameParameter(ClassCustomization classCustomization) {
63-
classCustomization.customizeAst(ast -> {
64-
ClassOrInterfaceDeclaration clazz = ast.getClassByName(classCustomization.getClassName()).get();
65-
66-
MethodDeclaration listJobDocsString = clazz.getMethodsBySignature("listJobDocuments", "String").get(0);
67-
listJobDocsString.getJavadoc().ifPresent(javadoc ->
68-
{
69-
// Remove name parameter
70-
javadoc.getBlockTags().removeIf(javadocBlockTag -> javadocBlockTag.toString().contains("The name of a job."));
71-
// Add jobName parameter at beginning
72-
JavadocBlockTag jobNameParam = new JavadocBlockTag("param", "jobName The name of a job.");
73-
javadoc.getBlockTags().add(0, jobNameParam);
74-
listJobDocsString.setJavadocComment(javadoc);
75-
});
76-
77-
MethodDeclaration listJobDocsStringRequestOptions = clazz.getMethodsBySignature("listJobDocuments", "String", "RequestOptions").get(0);
78-
listJobDocsStringRequestOptions.getJavadoc().ifPresent(javadoc ->
79-
{
80-
// Remove name parameter
81-
javadoc.getBlockTags().removeIf(javadocBlockTag -> javadocBlockTag.toString().contains("The name of a job."));
82-
// Add jobName parameter at beginning
83-
JavadocBlockTag jobNameParam = new JavadocBlockTag("param", "jobName The name of a job.");
84-
javadoc.getBlockTags().add(0, jobNameParam);
85-
listJobDocsStringRequestOptions.setJavadocComment(javadoc);
86-
});
87-
});
88-
}
8913
}

sdk/healthdataaiservices/azure-health-deidentification/src/main/java/com/azure/health/deidentification/DeidentificationAsyncClient.java

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public final class DeidentificationAsyncClient {
101101
* }
102102
* </pre>
103103
*
104-
* @param name The name of a job.
104+
* @param jobName The name of a job.
105105
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
106106
* @throws HttpResponseException thrown if the request is rejected by server.
107107
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -113,8 +113,8 @@ public final class DeidentificationAsyncClient {
113113
*/
114114
@Generated
115115
@ServiceMethod(returns = ReturnType.SINGLE)
116-
public Mono<Response<BinaryData>> getJobWithResponse(String name, RequestOptions requestOptions) {
117-
return this.serviceClient.getJobWithResponseAsync(name, requestOptions);
116+
public Mono<Response<BinaryData>> getJobWithResponse(String jobName, RequestOptions requestOptions) {
117+
return this.serviceClient.getJobWithResponseAsync(jobName, requestOptions);
118118
}
119119

120120
/**
@@ -221,7 +221,7 @@ public Mono<Response<BinaryData>> getJobWithResponse(String name, RequestOptions
221221
* }
222222
* </pre>
223223
*
224-
* @param name The name of a job.
224+
* @param jobName The name of a job.
225225
* @param resource The resource instance.
226226
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
227227
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -232,9 +232,9 @@ public Mono<Response<BinaryData>> getJobWithResponse(String name, RequestOptions
232232
*/
233233
@Generated
234234
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
235-
public PollerFlux<BinaryData, BinaryData> beginDeidentifyDocuments(String name, BinaryData resource,
235+
public PollerFlux<BinaryData, BinaryData> beginDeidentifyDocuments(String jobName, BinaryData resource,
236236
RequestOptions requestOptions) {
237-
return this.serviceClient.beginDeidentifyDocumentsAsync(name, resource, requestOptions);
237+
return this.serviceClient.beginDeidentifyDocumentsAsync(jobName, resource, requestOptions);
238238
}
239239

240240
/**
@@ -425,7 +425,7 @@ public PagedFlux<BinaryData> listJobDocuments(String jobName, RequestOptions req
425425
* }
426426
* </pre>
427427
*
428-
* @param name The name of a job.
428+
* @param jobName The name of a job.
429429
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
430430
* @throws HttpResponseException thrown if the request is rejected by server.
431431
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -436,16 +436,16 @@ public PagedFlux<BinaryData> listJobDocuments(String jobName, RequestOptions req
436436
*/
437437
@Generated
438438
@ServiceMethod(returns = ReturnType.SINGLE)
439-
public Mono<Response<BinaryData>> cancelJobWithResponse(String name, RequestOptions requestOptions) {
440-
return this.serviceClient.cancelJobWithResponseAsync(name, requestOptions);
439+
public Mono<Response<BinaryData>> cancelJobWithResponse(String jobName, RequestOptions requestOptions) {
440+
return this.serviceClient.cancelJobWithResponseAsync(jobName, requestOptions);
441441
}
442442

443443
/**
444444
* Delete a de-identification job.
445445
*
446446
* Removes the record of the job from the service. Does not delete any documents.
447447
*
448-
* @param name The name of a job.
448+
* @param jobName The name of a job.
449449
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
450450
* @throws HttpResponseException thrown if the request is rejected by server.
451451
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -455,8 +455,8 @@ public Mono<Response<BinaryData>> cancelJobWithResponse(String name, RequestOpti
455455
*/
456456
@Generated
457457
@ServiceMethod(returns = ReturnType.SINGLE)
458-
public Mono<Response<Void>> deleteJobWithResponse(String name, RequestOptions requestOptions) {
459-
return this.serviceClient.deleteJobWithResponseAsync(name, requestOptions);
458+
public Mono<Response<Void>> deleteJobWithResponse(String jobName, RequestOptions requestOptions) {
459+
return this.serviceClient.deleteJobWithResponseAsync(jobName, requestOptions);
460460
}
461461

462462
/**
@@ -523,7 +523,7 @@ public Mono<Response<BinaryData>> deidentifyTextWithResponse(BinaryData body, Re
523523
*
524524
* Resource read operation template.
525525
*
526-
* @param name The name of a job.
526+
* @param jobName The name of a job.
527527
* @throws IllegalArgumentException thrown if parameters fail the validation.
528528
* @throws HttpResponseException thrown if the request is rejected by server.
529529
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -536,10 +536,10 @@ public Mono<Response<BinaryData>> deidentifyTextWithResponse(BinaryData body, Re
536536
*/
537537
@Generated
538538
@ServiceMethod(returns = ReturnType.SINGLE)
539-
public Mono<DeidentificationJob> getJob(String name) {
539+
public Mono<DeidentificationJob> getJob(String jobName) {
540540
// Generated convenience method for getJobWithResponse
541541
RequestOptions requestOptions = new RequestOptions();
542-
return getJobWithResponse(name, requestOptions).flatMap(FluxUtil::toMono)
542+
return getJobWithResponse(jobName, requestOptions).flatMap(FluxUtil::toMono)
543543
.map(protocolMethodData -> protocolMethodData.toObject(DeidentificationJob.class));
544544
}
545545

@@ -548,7 +548,7 @@ public Mono<DeidentificationJob> getJob(String name) {
548548
*
549549
* Long-running resource create or replace operation template.
550550
*
551-
* @param name The name of a job.
551+
* @param jobName The name of a job.
552552
* @param resource The resource instance.
553553
* @throws IllegalArgumentException thrown if parameters fail the validation.
554554
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -560,11 +560,11 @@ public Mono<DeidentificationJob> getJob(String name) {
560560
*/
561561
@Generated
562562
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
563-
public PollerFlux<DeidentificationJob, DeidentificationJob> beginDeidentifyDocuments(String name,
563+
public PollerFlux<DeidentificationJob, DeidentificationJob> beginDeidentifyDocuments(String jobName,
564564
DeidentificationJob resource) {
565565
// Generated convenience method for beginDeidentifyDocumentsWithModel
566566
RequestOptions requestOptions = new RequestOptions();
567-
return serviceClient.beginDeidentifyDocumentsWithModelAsync(name, BinaryData.fromObject(resource),
567+
return serviceClient.beginDeidentifyDocumentsWithModelAsync(jobName, BinaryData.fromObject(resource),
568568
requestOptions);
569569
}
570570

@@ -582,7 +582,6 @@ public PollerFlux<DeidentificationJob, DeidentificationJob> beginDeidentifyDocum
582582
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
583583
* @return paged collection of DeidentificationJob items as paginated response with {@link PagedFlux}.
584584
*/
585-
@Generated
586585
@ServiceMethod(returns = ReturnType.COLLECTION)
587586
private PagedFlux<DeidentificationJob> listJobs(String continuationToken) {
588587
// Generated convenience method for listJobs
@@ -644,7 +643,7 @@ public PagedFlux<DeidentificationJob> listJobs() {
644643
*
645644
* Resource list operation template.
646645
*
647-
* @param name The name of a job.
646+
* @param jobName The name of a job.
648647
* @param continuationToken Token to continue a previous query.
649648
* @throws IllegalArgumentException thrown if parameters fail the validation.
650649
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -654,7 +653,6 @@ public PagedFlux<DeidentificationJob> listJobs() {
654653
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
655654
* @return paged collection of DeidentificationDocumentDetails items as paginated response with {@link PagedFlux}.
656655
*/
657-
@Generated
658656
@ServiceMethod(returns = ReturnType.COLLECTION)
659657
private PagedFlux<DeidentificationDocumentDetails> listJobDocuments(String jobName, String continuationToken) {
660658
// Generated convenience method for listJobDocuments
@@ -721,7 +719,7 @@ public PagedFlux<DeidentificationDocumentDetails> listJobDocuments(String jobNam
721719
*
722720
* If the job is already complete, this will have no effect.
723721
*
724-
* @param name The name of a job.
722+
* @param jobName The name of a job.
725723
* @throws IllegalArgumentException thrown if parameters fail the validation.
726724
* @throws HttpResponseException thrown if the request is rejected by server.
727725
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -732,10 +730,10 @@ public PagedFlux<DeidentificationDocumentDetails> listJobDocuments(String jobNam
732730
*/
733731
@Generated
734732
@ServiceMethod(returns = ReturnType.SINGLE)
735-
public Mono<DeidentificationJob> cancelJob(String name) {
733+
public Mono<DeidentificationJob> cancelJob(String jobName) {
736734
// Generated convenience method for cancelJobWithResponse
737735
RequestOptions requestOptions = new RequestOptions();
738-
return cancelJobWithResponse(name, requestOptions).flatMap(FluxUtil::toMono)
736+
return cancelJobWithResponse(jobName, requestOptions).flatMap(FluxUtil::toMono)
739737
.map(protocolMethodData -> protocolMethodData.toObject(DeidentificationJob.class));
740738
}
741739

@@ -744,7 +742,7 @@ public Mono<DeidentificationJob> cancelJob(String name) {
744742
*
745743
* Removes the record of the job from the service. Does not delete any documents.
746744
*
747-
* @param name The name of a job.
745+
* @param jobName The name of a job.
748746
* @throws IllegalArgumentException thrown if parameters fail the validation.
749747
* @throws HttpResponseException thrown if the request is rejected by server.
750748
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -755,10 +753,10 @@ public Mono<DeidentificationJob> cancelJob(String name) {
755753
*/
756754
@Generated
757755
@ServiceMethod(returns = ReturnType.SINGLE)
758-
public Mono<Void> deleteJob(String name) {
756+
public Mono<Void> deleteJob(String jobName) {
759757
// Generated convenience method for deleteJobWithResponse
760758
RequestOptions requestOptions = new RequestOptions();
761-
return deleteJobWithResponse(name, requestOptions).flatMap(FluxUtil::toMono);
759+
return deleteJobWithResponse(jobName, requestOptions).flatMap(FluxUtil::toMono);
762760
}
763761

764762
/**

0 commit comments

Comments
 (0)