Azure / azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
https://docs.microsoft.com/azure/developer/go/
MIT License
1.59k stars 821 forks source link

bug(compute-availability-sets): Expand parameter does not work #20576

Open erezrokah opened 1 year ago

erezrokah commented 1 year ago

Bug Report

Trying to use the AvailabilitySetsClient NewListBySubscriptionPager with the expand parameter returns an error:

RESPONSE 400: 400 Bad Request
ERROR CODE: InvalidParameter
--------------------------------------------------------------------------------
{
  \"error\": {
    \"code\": \"InvalidParameter\",
    \"message\": \"The request URL is not valid.\",
    \"target\": \"$expand\"
  }
}
--------------------------------------------------------------------------------

No error returned

Use the code from https://github.com/Azure/azure-sdk-for-go/blob/cf448612bb22e9b72b05f9a52e226d04a0afc53b/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go#L279 but with a real subscription.

I also tried with expand set to instanceView, instanceView\$ref, virtualMachines.

Nope

Maybe I holding it wrong? What is the correct value to pass for the expand parameter?

ghost commented 1 year ago

Hi @erezrokah. Thank you for your feedback and we will look into it soon. Meanwhile, feel free to share your experience using the Azure SDK in this survey.

tadelesh commented 1 year ago

@erezrokah thank you for your feedback. I could reproduce the problem and it seems a service issue. I'll let service team to take a look.

ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @TravisCragg-MSFT, @nikhilpatel909, @sandeepraichura, @hilaryw29, @GabstaMSFT, @ramankumarlive, @ushnaarshadkhan.

Issue Details
### Bug Report - import path of package in question - `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4` - SDK version - `v4.1.0` - output of `go version` - `go version go1.20.2 darwin/arm64` - What happened? Trying to use the `AvailabilitySetsClient` `NewListBySubscriptionPager` with the expand parameter returns an error: ``` RESPONSE 400: 400 Bad Request ERROR CODE: InvalidParameter -------------------------------------------------------------------------------- { \"error\": { \"code\": \"InvalidParameter\", \"message\": \"The request URL is not valid.\", \"target\": \"$expand\" } } -------------------------------------------------------------------------------- ``` - What did you expect or want to happen? No error returned - How can we reproduce it? Use the code from https://github.com/Azure/azure-sdk-for-go/blob/cf448612bb22e9b72b05f9a52e226d04a0afc53b/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go#L279 but with a real subscription. I also tried with expand set to `instanceView`, `instanceView\$ref`, `virtualMachines`. - `instanceView` because of https://learn.microsoft.com/en-us/rest/api/compute/availability-sets/list-by-subscription?tabs=Go#uri-parameters: ![image](https://user-images.githubusercontent.com/26760571/230785167-2c253a20-e8b2-4201-890d-826b630ce646.png) also see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4#AvailabilitySetsClientListBySubscriptionOptions and ![image](https://user-images.githubusercontent.com/26760571/230785334-e0f7fb43-5ccf-4528-90db-01ad1c232eea.png) - `virtualMachines` because of the code above and: https://learn.microsoft.com/en-us/rest/api/compute/availability-sets/list-by-subscription?tabs=Go#list-availability-sets-in-a-subscription. ![image](https://user-images.githubusercontent.com/26760571/230785195-e7b2ddff-8325-4303-adc8-f1542ddcab98.png) - Anything we should know about your environment. Nope Maybe I holding it wrong? What is the correct value to pass for the expand parameter?
Author: erezrokah
Assignees: tadelesh
Labels: `question`, `Compute`, `Compute - VM`, `Service Attention`, `Mgmt`, `customer-reported`, `needs-team-attention`
Milestone: -
erezrokah commented 7 months ago

Hi đź‘‹ When are we expected to receive an update on the issue?

ianneal commented 5 months ago

Any updates on this ticket?

TravisCragg-MSFT commented 1 month ago

I see 2 problems:

  1. The sample for optional parameters is not correct and should be https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Compute/availabilitySets?$expand=instanceView&api-version=2024-03-01
  2. With the given and correct value, I receive the same error

I am following up to get clarity on how this is supposed to be done and update the documentation.

TravisCragg-MSFT commented 1 month ago

The valid parameter is listed as instanceView, but it should be "virtualMachines/$ref"

Below is a valid expand call.

https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Compute/availabilitySets?$expand=virtualMachines/$ref&api-version=2024-03-01

We will be updating the doc to include the information.