From d5da3d5e3149ffbe684c25b103946673470659e6 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Wed, 21 Feb 2018 16:15:22 -0800 Subject: [PATCH 1/4] Add purge to management plane API --- .../stable/2015-05-01/components_API.json | 90 +++++++++++++++++++ .../2015-05-01/examples/ComponentsPurge.json | 33 +++++++ 2 files changed, 123 insertions(+) create mode 100644 specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurge.json diff --git a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json index 5fbdac483403..246eb923d487 100644 --- a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json +++ b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json @@ -243,6 +243,42 @@ } } } + }, + "/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" + } + } + } } }, "definitions": { @@ -434,6 +470,51 @@ "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" + ] } }, "parameters": { @@ -466,6 +547,15 @@ "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" + } } } } \ No newline at end of file diff --git a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurge.json b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurge.json new file mode 100644 index 000000000000..599cea6afb76 --- /dev/null +++ b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurge.json @@ -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" + } + } + } +} + \ No newline at end of file From 891212c0bfb6b3267802c8984cf607d3242dcaac Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 22 Feb 2018 00:06:55 -0800 Subject: [PATCH 2/4] Adding purge status operation --- .../stable/2015-05-01/components_API.json | 55 +++++++++++++++++++ .../examples/ComponentsPurgeStatus.json | 17 ++++++ 2 files changed, 72 insertions(+) create mode 100644 specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json diff --git a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json index 246eb923d487..602ce040cf3d 100644 --- a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json +++ b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json @@ -279,6 +279,42 @@ } } } + }, + "/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": { @@ -515,6 +551,18 @@ "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" + } + }, + "required": [ + "status" + ] } }, "parameters": { @@ -556,6 +604,13 @@ "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." } } } \ No newline at end of file diff --git a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json new file mode 100644 index 000000000000..61f76b411115 --- /dev/null +++ b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json @@ -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" + } + } + } +} + \ No newline at end of file From bcdbc275b9d1dbf614a12e2adf830c2bb2a98b89 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 22 Feb 2018 16:31:49 -0800 Subject: [PATCH 3/4] Change purge statue to enum --- .../stable/2015-05-01/components_API.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json index 602ce040cf3d..eb6e4ba00c9f 100644 --- a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json +++ b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/components_API.json @@ -557,7 +557,15 @@ "properties": { "status": { "description": "Status of the operation represented by the requested Id.", - "type": "string" + "type": "string", + "enum": [ + "Pending", + "Completed" + ], + "x-ms-enum": { + "name": "PurgeState", + "modelAsString": true + } } }, "required": [ From aea5fabd66933d3377055411a89774f8e62692fd Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 22 Feb 2018 16:33:19 -0800 Subject: [PATCH 4/4] capitalize response status --- .../stable/2015-05-01/examples/ComponentsPurgeStatus.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json index 61f76b411115..c28fdc13744d 100644 --- a/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json +++ b/specification/applicationinsights/resource-manager/microsoft.insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json @@ -9,7 +9,7 @@ "responses": { "200": { "body": { - "status": "completed" + "status": "Completed" } } }