Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OperationalInsights: DataCollectorLogs new api support. #10365

Merged
merged 16 commits into from
Aug 24, 2020
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"swagger": "2.0",
"info": {
"title": "Azure Log Analytics",
"description": "Azure Log Analytics API reference",
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
"version": "2020-03-01-preview"
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"paths": {
"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataCollectorLogs": {
Copy link
Contributor

Choose a reason for hiding this comment

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

From description it seems like this POST action is used to delete a log table. what is the need to expose deletion operation through the control plane on something (tables) which is not exposed on the control plane. Its wierd and can cause of sorts of issues like permission check, inconsistent state/confusion for customer where i am assuming same thing can be from the dataplane api as well etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

and if we agree that this is the only way to go about it and its required, i will ask you, at the very least to change the name of this action. This POST action from the name seems very harmless but it ends up deleting something. So name should indicate what this operation does. may be call it deleteDataCollectorLogsTable. But lets answer the above question first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it all derives from the fact this is not a typical CRUD, so post is multi purpose, in this case being used for delete.
i have no problem changing the post to delete, but there will be no put. is that sounds reasonable?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, better to switch to GET and DELETE

"post": {
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
"tags": [
"DataCollectorLogs"
],
"x-ms-examples": {
"DataCollectorLogsDelete": {
"$ref": "./examples/DataCollectorLogsDelete.json"
}
},
"operationId": "DataCollectorLogs_Delete",
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
"description": "Deletes a specify custom log table",
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "../../../common/v1/types.json#/parameters/WorkspaceNameParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DataCollectorLogs"
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
},
"description": "The parameters required to delete a specify custom log table."
},
{
"$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/ByPassRetentionProtection"
}
],
"responses": {
"200": {
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the response of this post action?

Copy link
Contributor

Choose a reason for hiding this comment

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

please add the response schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no schema, just 200 since its basically a delete.

"description": "OK response definition."
}
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
}
},
"get": {
Copy link
Contributor

Choose a reason for hiding this comment

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

how is the POST different from this GET? the API signature is same.

Copy link
Contributor

Choose a reason for hiding this comment

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

so the scenario is user lists the tables and then you want to give them the option to delete them. In that case, your POST should be changed to a DELETE, and they can provide the tableName that they want to delete. Much cleaner approach. POST for delete is ugly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we do not support full CRUD, is it fine if i will supply delete and get and no put? this is why we used post instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, it will be ok to have GET and DELETE

"tags": [
"DataCollectorLogs"
],
"description": "Listing all custom logs tables, being created via data collector endpoint and scoped to the specified workspace",
"operationId": "DataCollectorLogs_ListByWorkspace",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "../../../common/v1/types.json#/parameters/WorkspaceNameParameter"
}
],
"responses": {
"200": {
"description": "OK response definition.",
"schema": {
"$ref": "#/definitions/DataCollectorLogsListResult"
}
}
},
"x-ms-pageable": {
"nextLinkName": null
},
"x-ms-examples": {
"DataCollectorLogsListByWorkspace": {
"$ref": "./examples/DataCollectorLogsListByWorkspace.json"
}
}
}
}
},
"definitions": {
"DataCollectorLogsProperties": {
"description": "Data collector logs properties.",
"type": "object",
"properties": {
"action": {
"description": "The action to be applied on a selected custom log table.",
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
"type": "string",
"writeOnly": true,
"enum": [
"Delete"
],
"x-ms-enum": {
"name": "ActionType",
"modelAsString": false
}
},
"name": {
"description": "Table's name.",
"type": "string"
}
}
},
"DataCollectorLogs": {
"properties": {
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/DataCollectorLogsProperties",
"description": "Data collector logs properties."
}
},
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v1/types.json#/definitions/ProxyResource"
}
],
"description": "Data collector logs top level resource container."
},
"DataCollectorLogsListResult": {
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/DataCollectorLogs"
},
"description": "custom logs tables list."
}
},
"description": "Custom logs table collection, all tables are scoped to the specified workspace."
}
},
"parameters": {
"ByPassRetentionProtection": {
"name": "byPassRetentionProtection",
"in": "query",
"required": false,
"type": "boolean",
"description": "Will allow to by pass retention validation."
dulikvor marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"parameters": {
"resourceGroupName": "mms-eus",
"workspaceName": "testDataCollectorLogsWS",
"parameters": {
"properties": {
"action": "Delete",
"name": "Test_CL"
}
},
"api-version": "2020-03-01-preview",
"subscriptionId": "00000000-0000-0000-0000-00000000000"
},
"responses": {
"200": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"parameters": {
"resourceGroupName": "mms-eus",
"workspaceName": "testDataCollectorLogsWS",
"api-version": "2020-03-01-preview",
"subscriptionId": "00000000-0000-0000-0000-00000000000"
},
"responses": {
"200": {
"body": {
"value": [
{
"properties": {
"name": "Table0_CL"
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/mms-eus/providers/microsoft.operationalinsights/workspaces/testDataCollectorLogsWS/dataCollectorLogs/Table0_CL",
"name": "Table0_CL",
"type": "Microsoft.OperationalInsights/workspaces/dataCollectorLogs"
},
{
"properties": {
"name": "Table1_CL"
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/mms-eus/providers/microsoft.operationalinsights/workspaces/testDataCollectorLogsWS/dataCollectorLogs/Table1_CL",
"name": "Table1_CL",
"type": "Microsoft.OperationalInsights/workspaces/dataCollectorLogs"
},
{
"properties": {
"name": "Table2_CL"
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/mms-eus/providers/microsoft.operationalinsights/workspaces/testDataCollectorLogsWS/dataCollectorLogs/Table2_CL",
"name": "Table2_CL",
"type": "Microsoft.OperationalInsights/workspaces/dataCollectorLogs"
},
{
"properties": {
"name": "Table3_CL"
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/mms-eus/providers/microsoft.operationalinsights/workspaces/testDataCollectorLogsWS/dataCollectorLogs/Table3_CL",
"name": "Table3_CL",
"type": "Microsoft.OperationalInsights/workspaces/dataCollectorLogs"
},
{
"properties": {
"name": "Table4_CL"
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/mms-eus/providers/microsoft.operationalinsights/workspaces/testDataCollectorLogsWS/dataCollectorLogs/Table4_CL",
"name": "Table4_CL",
"type": "Microsoft.OperationalInsights/workspaces/dataCollectorLogs"
}
]
}
}
}
}
2 changes: 2 additions & 0 deletions specification/operationalinsights/resource-manager/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ These settings apply only when `--tag=package-2020-03-preview` is specified on t
input-file:
- Microsoft.OperationalInsights/preview/2020-03-01-preview/DataExports.json
- Microsoft.OperationalInsights/preview/2020-03-01-preview/DataSources.json
- Microsoft.OperationalInsights/preview/2020-03-01-preview/DataCollectorLogs.json
- Microsoft.OperationalInsights/preview/2020-03-01-preview/IntelligencePacks.json
- Microsoft.OperationalInsights/preview/2020-03-01-preview/LinkedServices.json
- Microsoft.OperationalInsights/preview/2020-03-01-preview/LinkedStorageAccounts.json
Expand Down Expand Up @@ -202,6 +203,7 @@ input-file:
- $(this-folder)/Microsoft.OperationalInsights/preview/2019-08-01-preview/OperationalInsights.json
- $(this-folder)/Microsoft.OperationalInsights/preview/2020-03-01-preview/DataExports.json
- $(this-folder)/Microsoft.OperationalInsights/preview/2020-03-01-preview/DataSources.json
- $(this-folder)/Microsoft.OperationalInsights/preview/2020-03-01-preview/DataCollectorLogs.json
- $(this-folder)/Microsoft.OperationalInsights/preview/2020-03-01-preview/IntelligencePacks.json
- $(this-folder)/Microsoft.OperationalInsights/preview/2020-03-01-preview/LinkedServices.json
- $(this-folder)/Microsoft.OperationalInsights/preview/2020-03-01-preview/LinkedStorageAccounts.json
Expand Down