Skip to content

Commit a53fb21

Browse files
authored
Use new javadoc tool to inject code snippets (Azure#25640)
* Use new javadoc codesnippet tool * Update readme samples
1 parent 3742a40 commit a53fb21

File tree

18 files changed

+96
-64
lines changed

18 files changed

+96
-64
lines changed

sdk/agrifood/azure-verticals-agrifood-farming/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below
5858
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET.
5959

6060
##### Example
61-
<!-- embedme ./src/samples/java/com/azure/verticals/agrifood/farming/ReadmeSamples.java#L20-L23 -->
62-
```java
61+
```java readme-sample-createFarmersBaseClient
6362
FarmersBaseClient client = new FarmBeatsClientBuilder()
6463
.endpoint("https://<farmbeats resource name>.farmbeats-dogfood.azure.net")
6564
.credential(new DefaultAzureCredentialBuilder().build())

sdk/agrifood/azure-verticals-agrifood-farming/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
<javaModulesSurefireArgLine>
3636
--add-exports com.azure.core/com.azure.core.implementation.jackson=ALL-UNNAMED
3737
</javaModulesSurefireArgLine>
38+
<codesnippet.skip>false</codesnippet.skip>
39+
<javadocDoclet></javadocDoclet>
40+
<javadocDocletOptions></javadocDocletOptions>
3841
</properties>
3942

4043
<dependencies>

sdk/agrifood/azure-verticals-agrifood-farming/src/samples/java/com.azure.verticals.agrifood.farming/ReadmeSamples.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@
66
import com.azure.identity.DefaultAzureCredentialBuilder;
77

88
/**
9-
* WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS
10-
* ARE USED TO EXTRACT APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING
11-
* LINE NUMBERS OF EXISTING CODE SAMPLES.
12-
*
139
* Code samples for the README.md
1410
*/
1511
public class ReadmeSamples {
1612
/**
1713
* Sample for creating low level client.
1814
*/
1915
public void createClient() {
16+
// BEGIN: readme-sample-createFarmersBaseClient
2017
FarmersBaseClient client = new FarmBeatsClientBuilder()
2118
.endpoint("https://<farmbeats resource name>.farmbeats-dogfood.azure.net")
2219
.credential(new DefaultAzureCredentialBuilder().build())
2320
.buildFarmersBaseClient();
21+
// END: readme-sample-createFarmersBaseClient
2422
}
2523
}

sdk/anomalydetector/azure-ai-anomalydetector/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ You will also need to [register a new AAD application][register_aad_app] and [gr
6060
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET.
6161

6262
##### Async client
63-
<!-- embedme ./src/samples/java/com/azure/ai/anomalydetector/ReadmeSamples.java#L29-L43 -->
64-
```java
63+
```java readme-sample-createAnomalyDetectorAsyncClient
6564
String endpoint = "<anomaly-detector-resource-endpoint>";
6665
HttpHeaders headers = new HttpHeaders()
6766
.put("Accept", ContentType.APPLICATION_JSON);
@@ -80,8 +79,7 @@ AnomalyDetectorAsyncClient anomalyDetectorAsyncClient = new AnomalyDetectorClien
8079
```
8180

8281
##### Sync client
83-
<!-- embedme ./src/samples/java/com/azure/ai/anomalydetector/ReadmeSamples.java#L50-L64 -->
84-
```java
82+
```java readme-sample-createAnomalyDetectorClient
8583
String endpoint = "<anomaly-detector-resource-endpoint>";
8684
HttpHeaders headers = new HttpHeaders()
8785
.put("Accept", ContentType.APPLICATION_JSON);

sdk/anomalydetector/azure-ai-anomalydetector/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
<properties>
3333
<!-- Anomaly detector temporarily skipping code coverage until tests are added -->
3434
<jacoco.skip>true</jacoco.skip>
35+
<codesnippet.skip>false</codesnippet.skip>
36+
<javadocDoclet></javadocDoclet>
37+
<javadocDocletOptions></javadocDocletOptions>
3538
</properties>
3639

3740
<dependencies>

sdk/anomalydetector/azure-ai-anomalydetector/src/samples/java/com/azure/ai/anomalydetector/ReadmeSamples.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
import com.azure.identity.DefaultAzureCredentialBuilder;
1515

1616
/**
17-
* WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS
18-
* ARE USED TO EXTRACT APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING
19-
* LINE NUMBERS OF EXISTING CODE SAMPLES.
20-
*
2117
* Code samples for the README.md
2218
*/
2319
public class ReadmeSamples {
@@ -26,6 +22,7 @@ public class ReadmeSamples {
2622
* Sample for creating async client.
2723
*/
2824
public void createAsyncClient() {
25+
// BEGIN: readme-sample-createAnomalyDetectorAsyncClient
2926
String endpoint = "<anomaly-detector-resource-endpoint>";
3027
HttpHeaders headers = new HttpHeaders()
3128
.put("Accept", ContentType.APPLICATION_JSON);
@@ -41,12 +38,14 @@ public void createAsyncClient() {
4138
.pipeline(httpPipeline)
4239
.endpoint(endpoint)
4340
.buildAsyncClient();
41+
// END: readme-sample-createAnomalyDetectorAsyncClient
4442
}
4543

4644
/**
4745
* Sample for creating sync client.
4846
*/
4947
public void createClient() {
48+
// BEGIN: readme-sample-createAnomalyDetectorClient
5049
String endpoint = "<anomaly-detector-resource-endpoint>";
5150
HttpHeaders headers = new HttpHeaders()
5251
.put("Accept", ContentType.APPLICATION_JSON);
@@ -62,5 +61,6 @@ public void createClient() {
6261
.pipeline(httpPipeline)
6362
.endpoint(endpoint)
6463
.buildClient();
64+
// END: readme-sample-createAnomalyDetectorClient
6565
}
6666
}

sdk/purview/azure-analytics-purview-administration/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ Set the values of the client ID, tenant ID, and client secret of the AAD applica
5757

5858
##### Example
5959

60-
<!-- embedme ./src/samples/java/com/azure/analytics/purview/administration/ReadmeSamples.java#L10-L13 -->
61-
```java
60+
```java readme-sample-createAccountsClient
6261
AccountsClient client = new PurviewAccountClientBuilder()
6362
.endpoint(System.getenv("ACCOUNT_ENDPOINT"))
6463
.credential(new DefaultAzureCredentialBuilder().build())
@@ -69,8 +68,7 @@ AccountsClient client = new PurviewAccountClientBuilder()
6968

7069
## Examples
7170

72-
<!-- embedme ./src/samples/java/com/azure/analytics/purview/administration/GetAccount.java#L11-L15 -->
73-
```java
71+
```java readme-sample-getAccountProperties
7472
AccountsClient client = new PurviewAccountClientBuilder()
7573
.endpoint(System.getenv("ACCOUNT_ENDPOINT"))
7674
.credential(new DefaultAzureCredentialBuilder().build())

sdk/purview/azure-analytics-purview-administration/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131

3232
<properties>
3333
<jacoco.skip>true</jacoco.skip>
34+
<codesnippet.skip>false</codesnippet.skip>
35+
<javadocDoclet></javadocDoclet>
36+
<javadocDocletOptions></javadocDocletOptions>
3437
</properties>
3538

3639
<dependencies>

sdk/purview/azure-analytics-purview-administration/src/samples/java/com/azure/analytics/purview/administration/ReadmeSamples.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,34 @@
44
package com.azure.analytics.purview.administration;
55

66
import com.azure.identity.DefaultAzureCredentialBuilder;
7+
import com.azure.core.util.BinaryData;
78

9+
/**
10+
* Samples to include in README.md
11+
*/
812
public class ReadmeSamples {
9-
public static void main(String[] args) {
13+
/**
14+
* Sample to demonstrate creating Purview Accounts client.
15+
*/
16+
public void createClient() {
17+
// BEGIN: readme-sample-createAccountsClient
1018
AccountsClient client = new PurviewAccountClientBuilder()
1119
.endpoint(System.getenv("ACCOUNT_ENDPOINT"))
1220
.credential(new DefaultAzureCredentialBuilder().build())
1321
.buildAccountsClient();
22+
// END: readme-sample-createAccountsClient
23+
}
24+
25+
/**
26+
* Sample to demonstrate getting the properties of an account.
27+
*/
28+
public void getAccounts() {
29+
// BEGIN: readme-sample-getAccountProperties
30+
AccountsClient client = new PurviewAccountClientBuilder()
31+
.endpoint(System.getenv("ACCOUNT_ENDPOINT"))
32+
.credential(new DefaultAzureCredentialBuilder().build())
33+
.buildAccountsClient();
34+
BinaryData response = client.getAccountPropertiesWithResponse(null).getValue();
35+
// END: readme-sample-getAccountProperties
1436
}
1537
}

sdk/purview/azure-analytics-purview-catalog/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below
5757
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET.
5858

5959
##### Example
60-
<!-- embedme ./src/samples/java/com/azure/analytics/purview/catalog/ReadmeSamples.java#L20-L23 -->
61-
```java
60+
```java readme-sample-createGlossaryClient
6261
GlossaryClient client = new PurviewCatalogClientBuilder()
6362
.endpoint(System.getenv("<account-name>.purview.azure.com"))
6463
.credential(new DefaultAzureCredentialBuilder().build())

0 commit comments

Comments
 (0)