Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,26 @@
"schema": {
"$ref": "#/definitions/LogAnalyticsQueryPack"
}
},

@neil-yechenwei Neil Ye (neil-yechenwei) Jul 6, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need to remove the block of "200"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can return 200 if a name is passed, whenever a name is not passed 201 is returned

@neil-yechenwei Neil Ye (neil-yechenwei) Sep 13, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Daniel Ben-hamoo (@dabenhamMic) , the symptom is that QueryPacks_CreateOrUpdate API is failed and threw below error message while creating the Query Pack resource because API always returns 201 but 201 isn't defined in the response section of this API.

Error Message returned by API:

operationalinsights.OperationalInsightsClient#QueryPacksCreateOrUpdate:
Failure responding to request: StatusCode=201 -- Original Error:
autorest/azure: Service returned an error. Status=201 Code="Unknown"
Message="Unknown service error"
Details=[{"etag":"\"xx-xx-xx-xx\"","id":"/subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-LA/providers/Microsoft.OperationalInsights/querypacks/acctestlaqp","kind":n"location":"westus","name":"acctestlaqp","properties":{"provisioningState":"Succeed"queryPackId":"xx-xx-xx-xx","timeCreated":"xxxxx","timeModified":"xxxxx"tags":{},"type":"microsoft.operationalinsights/querypacks"}]

And I found API always returns 201 even if a name is passed after tested. Below is an example request. Could you double check the API behavior since it's different with what you mentioned above?

Request Payload:

PUT https://management.azure.com/subscriptions/xx-xx-xx-xx/resourceGroups/acctestRG-LA/providers/Microsoft.OperationalInsights/queryPacks/acctestlaqp

{
    "location": "westus",
    "properties": {},
    "tags": null
}

API Response:
image

Per my understanding, I assume QueryPacks_CreateOrUpdate API is recommended API to create Query Pack resource, right? So does it make sense to add support for 201 response code in the QueryPacks_CreateOrUpdate API rather than introducing a new API?

Adding Arthur Ning (@akning-ms) for awareness.

"201": {
"description": "Created response definition.",
"schema": {
"$ref": "#/definitions/LogAnalyticsQueryPack"
}
}
},
"x-ms-examples": {
"QueryPackCreate": {
"$ref": "./examples/QueryPacksCreate.json"
},
"QueryPackCreateNoName": {
"$ref": "./examples/QueryPacksCreateNoName.json"
},
"QueryPackUpdate": {
"$ref": "./examples/QueryPacksUpdate.json"
},
"QueryPackUpdateNoName": {
"$ref": "./examples/QueryPackUpdateNoName.json"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parameters": {
"api-version": "2019-09-01",
"subscriptionId": "86dc51d3-92ed-4d7e-947a-775ea79b4919",
"resourceGroupName": "my-resource-group",
"LogAnalyticsQueryPackPayload": {
"location": "South Central US",
"tags": {
"Tag1": "Value1"
},
"properties": {}
}
},
"responses": {
"201": {
"body": {
"id": "/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks",
"type": "microsoft.operationalinsights/querypacks",
"location": "South Central US",
"tags": {
"Tag1": "Value1"
},
"properties": {
"queryPackId": "aac8fc00-2b68-441e-8f9b-ded8748dc635",
"timeCreated": "2019-06-04T12:37:56.8543652Z",
"timeModified": "2019-08-04T12:37:56.8543652Z",
"provisioningState": "Succeeded"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"parameters": {
"api-version": "2019-09-01",
"subscriptionId": "86dc51d3-92ed-4d7e-947a-775ea79b4919",
"resourceGroupName": "my-resource-group",
"LogAnalyticsQueryPackPayload": {
"location": "South Central US",
"properties": {}
}
},
"responses": {
"201": {
"body": {
"id": "/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack",
"name": "my-querypack",
"type": "microsoft.operationalinsights/querypacks",
"location": "South Central US",
"tags": {},
"properties": {
"queryPackId": "d1c8fc00-2b68-441e-8f9b-ded8748dc635",
"timeCreated": "2019-08-04T12:37:56.8543652Z",
"timeModified": "2019-08-04T12:37:56.8543652Z",
"provisioningState": "Succeeded"
}
}
}
}
}