Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.61k stars 5.01k forks source link

[Sample Issue] Regenrating Log Analytics Workspace Access Keys requires a parameter that isn't documented. #29592

Open KjeldSchmidt opened 3 months ago

KjeldSchmidt commented 3 months ago

Link to sample

https://learn.microsoft.com/en-us/rest/api/loganalytics/shared-keys/regenerate?view=rest-loganalytics-2023-09-01&tabs=Python#regeneratesharedkeys

Library name and version

azure-mgmt-loganalytics 12.0.0

Language of the Sample

Sample Issue Type

Issue details

Hey there,

The REST API documented on the linked page is missing a required parameter. The sample in its current form results in the error keyType value must equal primarySharedKey or secondarySharedKey. Some experimentation shows that this key-value-pair should be passed as a query parameter.

The error in the API documentation also affects libraries generated from it, e.g. azure-mgmt-loganalytics version 12.0.0. The library has no way to pass this parameter, so we are forced to use direct HTTP calls with an undocumented parameter instead of using the appropriate function in the management library.

Thanks a bunch, Kjeld

Expected behavior

I should be able to pass a parameter to define which key to regenerate into LogAnalyticsManagementClient.shared_keys.regenerate.

This should then result in that one key being regenerated.

Actual behavior

I cannot pass a key specifier into LogAnalyticsManagementClient.shared_keys.regenerate.

The call results in a failed request with the error keyType value must equal primarySharedKey or secondarySharedKey.

Reproduction Steps

Follow this sample request

i.e., create a Log Analytics Workspace, get a LogAnalyticsManagementClient and attempt to call client.shared_keys.regenerate with the appropriate Workspace details as parameters.

Environment

Library: azure-mgmt-loganalytics Library version: 12.0.0 OS: Windows 10 Python Version: 3.11.8

ChenxiJiang333 commented 2 months ago

related swagger definition https://github.com/Azure/azure-rest-api-specs/blob/main/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/SharedKeys.json#L85