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

Add purge operations to AppInsights management plane #2528

Merged
merged 4 commits into from
Feb 23, 2018
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 @@ -243,6 +243,78 @@
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/purge": {
"post": {
"description": "Purges data in an Application Insights component by a set of user-defined filters.",
"operationId": "Components_Purge",
"parameters": [
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceNameParameter"
},
{
"$ref": "#/parameters/ComponentPurgeParameter"
}
],
"responses": {
"202": {
"description": "Accepted request for purging an Application Insights component.",
"schema": {
"$ref": "#/definitions/ComponentPurgeResponse"
}
}
},
"x-ms-examples": {
"ComponentPurge": {
"$ref": "./examples/ComponentsPurge.json"
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/operations/{purgeId}": {
"get": {
"description": "Gets the status of a previously submitted purge using the id returned from the original purge request.",
"operationId": "Components_GetPurgeStatus",
"parameters": [
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceNameParameter"
},
{
"$ref": "#/parameters/ComponentPurgeIdParameter"
}
],
"responses": {
"200": {
"description": "Returns status of purge operation in body of response. e.g.: running, completed.",
"schema": {
"$ref": "#/definitions/ComponentPurgeStatusResponse"
}
}
},
"x-ms-examples": {
"ComponentPurgeStatus": {
"$ref": "./examples/ComponentsPurgeStatus.json"
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -434,6 +506,63 @@
"description": "The URI to get the next set of Application Insights component defintions if too many components where returned in the result set."
}
}
},
"ComponentPurgeBody": {
"description": "Describes the body of a purge request for an App Insights component",
"required": [
"table",
"filters"
],
"properties": {
"table": {
"type": "string",
"description": "Table from which to purge data."
},
"filters": {
"type": "array",
"description": "The set of columns and filters (queries) to run over them to purge the resulting data.",
"items": {
"$ref": "#/definitions/ComponentPurgeBodyFilters"
}
}
}
},
"ComponentPurgeBodyFilters": {
"description": "User-defined filters to return data which will be purged from the table.",
"properties": {
"column": {
"description": "The column of the table over which the given query should run",
"type": "string"
},
"filter": {
"description": "A query to to run over the provided table and column to purge the corresponding data.",
"type": "string"
}
}
},
"ComponentPurgeResponse": {
"description": "Response containing operationId for a specific purge action.",
"properties": {
"operationId": {
"description": "Id to use when querying for status for a particular purge operation.",
"type": "string"
}
},
"required": [
"operationId"
]
},
"ComponentPurgeStatusResponse": {
"description": "Response containing status for a specific purge operation.",
"properties": {
"status": {
"description": "Status of the operation represented by the requested Id.",
"type": "string"
Copy link
Member

Choose a reason for hiding this comment

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

Can this be an enum so that callers are aware of the possible values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it can! 👍

}
},
"required": [
"status"
]
}
},
"parameters": {
Expand Down Expand Up @@ -466,6 +595,22 @@
"type": "string",
"description": "The name of the Application Insights component resource.",
"x-ms-parameter-location": "method"
},
"ComponentPurgeParameter": {
"name": "body",
"in": "body",
"description": "Describes the body of a request to purge data in a single table of an Application Insights component",
"required": true,
"schema": {
"$ref": "#/definitions/ComponentPurgeBody"
}
},
"ComponentPurgeIdParameter": {
"name": "purgeId",
"in": "path",
"required": true,
"type": "string",
"description": "In a purge status request, this is the Id of the operation the status of which is returned."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"parameters": {
"api-version": "2015-05-01",
"subscriptionId": "subid",
"resourceGroupName": "my-resource-group",
"resourceName": "my-component",
"body": {
"table": "requests",
"filters": [
{
"column": "duration",
"filter": ">1000"
},
{
"column": "timestamp",
"filter": ">= datetime(2017-09-01T00:00:00.000Z)"
},
{
"column": "application_Version",
"filter": "in ('Draft_master_20171018.2', 'Draft_master_2017024.1')"
}
]
}
},
"responses": {
"202": {
"body": {
"operationId": "7d7cf277-9113-4ab3-8359-d0364b74d01d"
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"parameters": {
"api-version": "2015-05-01",
"subscriptionId": "subid",
"resourceGroupName": "my-resource-group",
"resourceName": "my-component",
"purgeId": "6779dd32-272a-45d3-a9b8-84d7f47abfb7"
},
"responses": {
"200": {
"body": {
"status": "completed"
}
}
}
}