Azure-sdk-for-go: Azure KeyVault list operation doesn't work

Created on 22 Sep 2016  路  6Comments  路  Source: Azure/azure-sdk-for-go

As per the swagger file method Vaults_list takes api-version parameter with only possible value of 2015-11-01 but generated Go sdk method's ListPreparer overrides it from the client.

@mcardosos : Could you please include the execption details you are hitting with this case here:

Most helpful comment

What even is this pattern? Why do we publish the KeyVault API under a certain version and then have certain paths that have to be called with a different API version? Seems needlessly confusing, especially if anyone else is hand-writing calls against Azure endpoints. Can someone explain this? Otherwise I can take it to the rest specs repo....

All 6 comments

What even is this pattern? Why do we publish the KeyVault API under a certain version and then have certain paths that have to be called with a different API version? Seems needlessly confusing, especially if anyone else is hand-writing calls against Azure endpoints. Can someone explain this? Otherwise I can take it to the rest specs repo....

keyvault.VaultsClient#List: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidApiVersionParameter" Message="The api-version '2015-06-01' is invalid. The supported versions are '2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."

If I change the APIversion to 2015-11-01 (just like in the swagger), the operation also lists storage accounts.

@pomortaz Could you please throw some lights on this pattern and requirements from the service side to help us understand this scenario better. Thanks!

I agree with @colemickens and also confuse why api version is mentioned in two places in swagger. SDK only has one api version which is top level swagger version tied to the API and users see this version in SDK. We can not have version defined locally in swagger for endpoints.

"swagger": "2.0",
"info": {
"title": "KeyVaultManagementClient",
"description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.",
"version": "2015-06-01"
},

I think specs team needs to fix this. @mcardosos can you check with them.

The reason for having a different API version for listing all key vault resources is that for this case we are calling ARM directly instead of being redirected to Key Vault Resource Provider. Please see this.
The path for Vaults_List is "/subscriptions/{subscriptionId}/resources" which doesn't actually provide the scope of the resource which is KeyVault to the ARM. So the API version belong to ARM and not Key Vault.

There were a handful of actions that we could take to address this issue: (Note, not all of them are in conflict.)

  1. Push on the Services Team to expose their own version of this function in their own API Version. (Not expedient)
  2. Manually polish the auto-generated Key-Vault code to make this work out for each release. (Too expensive, error prone)
  3. Demonstrate the means of using the Resources Services directly to solve this problem. (Not directly addressing this problem.)

As seen above, I've addressed this issue in the Azure-Sample corresponding to using this code base. I'll close this issue for now.

Was this page helpful?
0 / 5 - 0 ratings