Skip to content

how does one consume armresourcegraph QueryResponse #21004

Closed
@unmarshall

Description

@unmarshall

Bug Report

  • What happened?
    As recommended we are now migrating to use resourcegraph API. The API seems to work fine when i just print out the ClientResourcesResponse.Data but if i now want to iterate over rows/JsonObjectArray then i am currently not able to find a way or an example to do just that. The data type of Data is any.

I have checked the documentation links and each and every example is incomplete.
Example (the list is not comprehensive):

All the examples fall short of how to extract values from Data. You cannot range over it because its not an iterable. You cannot cast it to a slice as that is not allowed and is also incorrect. I even tried to change the options via:

Options: &armresourcegraph.QueryRequestOptions{
	ResultFormat: to.Ptr(armresourcegraph.ResultFormatObjectArray),
},

But since type of Data is any it becomes difficult to consume it.

  • What did you expect or want to happen?
    At least give one complete example on how to iterate either over table rows (if ResultFormat is set to ResultFormatTable) or consume ResultFormatObjectArray.

  • How can we reproduce it?
    Just use the resource graph query to return a result which has more than 1 rows.

  • Anything we should know about your environment.

Testing on MacOs Version 13.4
Golang Version 1.20.5
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.7.1

Metadata

Metadata

Assignees

Labels

ARMMgmtThis issue is related to a management-plane library.Resource GraphService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions