Open neil-yechenwei opened 2 years ago
@neil-yechenwei the API's returning a 201 but it's not defined in the Swagger: https://github.com/Azure/azure-rest-api-specs/blob/fda2db441da3f1fab31bb235e97da3e33c8e3903/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/QueryPacks.json#L220-L225
In the future we're planning on supporting "overrides" within the Data which'll allow us to workaround these Swagger issues by overriding them on our side, but for now this'll need to be fixed in the Swagger, since it's out of date - so can you open an issue on the Rest API Specs repository about this?
Thanks. Sure. Filed an issue on https://github.com/Azure/azure-rest-api-specs/issues/19603
In the interim it should be possible to workaround this by ignoring the error for that status code:
client := operationalinsights.NewOperationalInsightsClientWithBaseURI("..")
ctx := context.TODO()
id := operationalinsights.NewQueryPackID("", "", "")
payload := operationalinsights.LogAnalyticsQueryPack{}
if _, err := client.QueryPacksCreateOrUpdate(ctx, id, payload); err != nil {
if !response.WasStatusCode(resp.HttpResponse, http.Created) { // NOTE: we'll need to make this public: https://github.com/hashicorp/go-azure-helpers/blob/65fb6fe4419b73c7f072ca0e40d969dd2309661b/lang/response/response.go#L22
return fmt.Error("creating %s: %+v", id, err)
}
}
Thanks @tombuildsstuff. Once response.WasStatusCode
goes public, I will update my PR.
WasStatusCode
will be exposed in https://github.com/hashicorp/go-azure-helpers/pull/124
Available once https://github.com/hashicorp/terraform-provider-azurerm/pull/17588 is merged
will be fixed by Azure/azure-rest-api-specs#27524
Hi *,
While trying to create the query pack resource, it failed and throw below error message. Per the error message, seems the Pandora SDK failed to handle the API response when the response code is 201. Could you help take a look? Thanks in advance.
The API version being used: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/QueryPacks.json#L189
The snippet code in TF resource to send request to create the resource:
Request body:
Error message:
The error is thrown from this function: