Skip to content

Commit 30b5f50

Browse files
committed
implementing feedback 5-23pt2
1 parent 974a5a3 commit 30b5f50

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

articles/governance/resource-graph/concepts/arg-get-list-api.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGro
162162

163163
## Known Limitations
164164

165-
1. **VMSS VM Health status** isn't supported by default. If you have a requirement, do let us know by emailing the Azure Resource Graph team.
166-
2. **Supported Resources** - The ARG GET/LIST API supports resources part of ‘resources’ and ‘computeresources’ table. If you have a requirement for a specific resource type outside of these tables, do let us know by emailing team.
165+
1. **VMSS VM Health status** isn't supported by default. If you have a requirement, do let us know by emailing the ARG team.
166+
2. **Supported Resources** - The ARG GET/LIST API supports all resource types as part of the ‘resources’ and ‘computeresources’ table. If you have a requirement for a specific resource type outside of these tables, do let us know by emailing the ARG team.
167167
3. **Single API Version Support** - ARG GET/LIST today only supports a single API version for each resource type, which is generally the latest non-preview version of the type that exists in the Azure REST API spec. The `api-version` parameter in the request URL is ignored by the ARG GET/LIST today. ARG GET/LIST returns `apiVersion` field in resource payloads in responses; this is the version that ARG GET/LIST indexed the resource in. Callers can apply this field to understand the apiVersion to use, if its relevant for their scenario.
168168
4. **Client Support** - Azure REST API: Supported | Azure SDK: Supported [sample .NET code](#sample-sdk-code)| PowerShell: Currently not supported | Azure CLI: Currently not supported | Azure portal: Currently not supported
169169
5. **Client Deserialization Concerns**
@@ -183,41 +183,51 @@ The following example is a .NET Code sample to call ARG GET/LIST API by creating
183183
First, We create custom ArmClientOption with policy that adds the `useResourceGraph=True` flag per call:
184184

185185
```bicep
186-
var ArmClientOptions = new ArmClientOptions();
187-
188-
ArmClientOptions.AddPolicy(new ARG GET/LISTHttpPipelinePolicy(),
189-
190-
HttpPipelinePosition.PerCall);
191-
186+
var armClientOptions = new ArmClientOptions();
187+
armClientOptions.AddPolicy(new ArgGetListHttpPipelinePolicy(), HttpPipelinePosition.PerCall);
192188
```
193189

194190
Then, we create ArmClient using the custom ArmClientOptions:
195191

196192
```bicep
197-
ArmClient client = new ArmClient(new DefaultAzureCredential(), null,
198-
199-
ArmClientOptions);
193+
ArmClient resourceGraphClient = new ArmClient(new DefaultAzureCredential(), null, armClientOptions);
200194
```
201195

202196
What if we want to create an ARMClient using a default subscription? We would set the ArmClient client value to:
203197

204198
```bicep
205-
new ArmClient(new DefaultAzureCredential(), defaultSubId,
206-
ArmClientOptions);
199+
ArmClient resourceGraphClient = new ArmClient(new DefaultAzureCredential(), defaultSubId, armClientOptions);
200+
```
201+
202+
Optionally, to create a default client that does not add the `useResourceGraph` flag, the client code chooses which client to use based on the specific scenario and needs. To do so, use the following:
203+
204+
```bicep
205+
ArmClient defaultClient = new ArmClient(new DefaultAzureCredential(), null, new ArmClientOptions());
207206
```
208207

209208
Then use this policy to add query parameters for every request through the client:
210209

211210
internal class ARG GET/LISTHttpPipelinePolicy : HttpPipelineSynchronousPolicy
212211

213212
```bicep
213+
internal class ArgGetListHttpPipelinePolicy : HttpPipelineSynchronousPolicy
214+
214215
{
215-
public override void OnSendingRequest(HttpMessage message)
216-
{
217-
// Adds the required query param to explicitly query ARG GET/LIST
218-
message.Request.Uri.AppendQuery("useResourceGraph", bool.TrueString);
216+
217+
private static const string UseResourceGraph = "useResourceGraph";
218+
public override void OnSendingRequest(HttpMessage message)
219+
220+
{
221+
// Adds the required query parameter to explicitly query ARG GET/LIST if the flag is not already present
222+
if (!message.Request.Uri.ContainsQuery(UseResourceGraph))
223+
{
224+
message.Request.Uri.AppendQuery(UseResourceGraph, bool.TrueString);
225+
226+
}
227+
228+
}
229+
219230
}
220-
}
221231
```
222232

223233
## Frequently asked questions

0 commit comments

Comments
 (0)