Skip to content

Commit c09ecaf

Browse files
mgmt, resourcegraph, example in readme (Azure#21676)
1 parent 16ee95e commit c09ecaf

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ See [API design][design] for general introduction on design and key concepts on
7474

7575
## Examples
7676

77+
```java
78+
QueryRequest queryRequest = new QueryRequest()
79+
.withSubscriptions(Collections.singletonList(subscriptionId))
80+
.withQuery("Resources | project name, type | limit 5 | order by name asc");
81+
// table format
82+
queryRequest.withOptions(new QueryRequestOptions().withResultFormat(ResultFormat.TABLE));
83+
QueryResponse response = manager.resourceProviders().resources(queryRequest);
84+
85+
86+
// object array format
87+
queryRequest.withOptions(new QueryRequestOptions().withResultFormat(ResultFormat.OBJECT_ARRAY));
88+
response = manager.resourceProviders().resources(queryRequest);
89+
90+
```
91+
92+
7793
## Troubleshooting
7894

7995
## Next steps

sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/ResourceGraphTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public void queryTest() {
3232
ResourceGraphManager manager = ResourceGraphManager
3333
.authenticate(new DefaultAzureCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
3434

35+
// @embedmeStart
3536
QueryRequest queryRequest = new QueryRequest()
3637
.withSubscriptions(Collections.singletonList(subscriptionId))
3738
.withQuery("Resources | project name, type | limit 5 | order by name asc");
@@ -48,5 +49,6 @@ public void queryTest() {
4849

4950
Assertions.assertNotNull(response.data());
5051
Assertions.assertTrue(response.data() instanceof List);
52+
// @embedmeEnd
5153
}
5254
}

0 commit comments

Comments
 (0)