diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangeDetails.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangeDetails.json new file mode 100644 index 000000000000..9aa3710fa824 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangeDetails.json @@ -0,0 +1,112 @@ +{ + "title": "Resource Change Details Query", + "description": "A resource change details query.", + "parameters": { + "api-version": "2018-09-01-preview", + "parameters": { + "resourceId": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount", + "changeId": "53dc0515-b86b-4bc2-979b-e4694ab4a556" + } + }, + "responses": { + "200": { + "body": { + "changeId": "53dc0515-b86b-4bc2-979b-e4694ab4a556", + "beforeSnapshot": { + "timestamp": "2018-10-31T01:32:05.993Z", + "content": { + "sku": { + "name": "Standard_LRS", + "tier": "Standard" + }, + "kind": "Storage", + "id": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount", + "name": "mystorageaccount", + "type": "Microsoft.Storage/storageAccounts", + "location": "westus", + "tags": {}, + "properties": { + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + }, + "supportsHttpsTrafficOnly": false, + "encryption": { + "services": { + "file": { + "enabled": true, + "lastEnabledTime": "2018-07-27T18:37:21.8333895Z" + }, + "blob": { + "enabled": true, + "lastEnabledTime": "2018-07-27T18:37:21.8333895Z" + } + }, + "keySource": "Microsoft.Storage" + }, + "provisioningState": "Succeeded", + "creationTime": "2018-07-27T18:37:21.7708872Z", + "primaryEndpoints": { + "blob": "https://mystorageaccount.blob.core.windows.net/", + "queue": "https://mystorageaccount.queue.core.windows.net/", + "table": "https://mystorageaccount.table.core.windows.net/", + "file": "https://mystorageaccount.file.core.windows.net/" + }, + "primaryLocation": "westus", + "statusOfPrimary": "available" + } + } + }, + "afterSnapshot": { + "timestamp": "2018-10-31T01:54:24.42Z", + "content": { + "sku": { + "name": "Standard_LRS", + "tier": "Standard" + }, + "kind": "Storage", + "id": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount", + "name": "mystorageaccount", + "type": "Microsoft.Storage/storageAccounts", + "location": "westus", + "tags": {}, + "properties": { + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + }, + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "enabled": true, + "lastEnabledTime": "2018-07-27T18:37:21.8333895Z" + }, + "blob": { + "enabled": true, + "lastEnabledTime": "2018-07-27T18:37:21.8333895Z" + } + }, + "keySource": "Microsoft.Storage" + }, + "provisioningState": "Succeeded", + "creationTime": "2018-07-27T18:37:21.7708872Z", + "primaryEndpoints": { + "blob": "https://mystorageaccount.blob.core.windows.net/", + "queue": "https://mystorageaccount.queue.core.windows.net/", + "table": "https://mystorageaccount.table.core.windows.net/", + "file": "https://mystorageaccount.file.core.windows.net/" + }, + "primaryLocation": "westus", + "statusOfPrimary": "available" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChanges.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChanges.json new file mode 100644 index 000000000000..105886fa17a4 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChanges.json @@ -0,0 +1,40 @@ +{ + "title": "Basic Resource Changes Query", + "description": "A simple resource changes query.", + "parameters": { + "api-version": "2018-09-01-preview", + "parameters": { + "resourceId": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount", + "interval": { + "start": "2018-10-30T12:09:03.141Z", + "end": "2018-10-31T12:09:03.141Z" + } + } + }, + "responses": { + "200": { + "body": { + "changes": [ + { + "changeId": "2db0ad2d-f6f0-4f46-b529-5c4e8c494648", + "beforeSnapshot": { + "timestamp": "2018-10-31T01:32:05.993Z" + }, + "afterSnapshot": { + "timestamp": "2018-10-31T01:54:24.42Z" + } + }, + { + "changeId": "9dc352cb-b7c1-4198-9eda-e5e3ed66aec8", + "beforeSnapshot": { + "timestamp": "2018-10-30T10:30:19.68Z" + }, + "afterSnapshot": { + "timestamp": "2018-10-30T21:12:31.337Z" + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangesFirstPage.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangesFirstPage.json new file mode 100644 index 000000000000..045368463744 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangesFirstPage.json @@ -0,0 +1,42 @@ +{ + "title": "Resource Changes Query: First Page", + "description": "A resource changes query requesting the first page.", + "parameters": { + "api-version": "2018-09-01-preview", + "parameters": { + "resourceId": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount", + "interval": { + "start": "2018-10-30T12:09:03.141Z", + "end": "2018-10-31T12:09:03.141Z" + }, + "$top": "2" + } + }, + "responses": { + "200": { + "body": { + "changes": [ + { + "changeId": "2db0ad2d-f6f0-4f46-b529-5c4e8c494648", + "beforeSnapshot": { + "timestamp": "2018-10-31T01:32:05.993Z" + }, + "afterSnapshot": { + "timestamp": "2018-10-31T01:54:24.42Z" + } + }, + { + "changeId": "9dc352cb-b7c1-4198-9eda-e5e3ed66aec8", + "beforeSnapshot": { + "timestamp": "2018-10-30T10:30:19.68Z" + }, + "afterSnapshot": { + "timestamp": "2018-10-30T21:12:31.337Z" + } + } + ], + "$skipToken": "ew0KICAiJGlkIjogIjEiLA0KICAiRW5kVGltZSI6ICJcL0RhdGUoMTU1MDc0NT" + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangesNextPage.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangesNextPage.json new file mode 100644 index 000000000000..efbd570e98e0 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourceChangesNextPage.json @@ -0,0 +1,43 @@ +{ + "title": "Resource Changes Query: Next Page", + "description": "A resource changes query requesting the next page using a skip token.", + "parameters": { + "api-version": "2018-09-01-preview", + "parameters": { + "resourceId": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount", + "interval": { + "start": "2018-10-30T12:09:03.141Z", + "end": "2018-10-31T12:09:03.141Z" + }, + "$top": "2", + "$skipToken": "ew0KICAiJGlkIjogIjEiLA0KICAiRW5kVGltZSI6ICJcL0RhdGUoMTU1MDc0NT" + } + }, + "responses": { + "200": { + "body": { + "changes": [ + { + "changeId": "55f458c4-f1c0-4963-bc6c-af275cd47702", + "beforeSnapshot": { + "timestamp": "2018-10-31T03:43:08.629Z" + }, + "afterSnapshot": { + "timestamp": "2018-10-31T05:12:32.087Z" + } + }, + { + "changeId": "0495b929-b86d-46cc-a972-939145feed90", + "beforeSnapshot": { + "timestamp": "2018-10-31T01:54:24.42Z" + }, + "afterSnapshot": { + "timestamp": "2018-10-31T02:01:02.163Z" + } + } + ], + "$skipToken": "kVGltZSI6ICJcL0RhdGUoMTU1MDc0NTew0KICAiJGlkIjogIjEiLA0KICAiRW5" + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json index 14f879b17922..fb66706f7ce3 100644 --- a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json @@ -88,6 +88,90 @@ } } }, + "/providers/Microsoft.ResourceGraph/resourceChanges": { + "post": { + "description": "List changes to a resource for a given time interval.", + "operationId": "ResourceChanges", + "tags": [ + "Changes" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "description": "the parameters for this request for changes.", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceChangesRequestParameters" + } + } + ], + "responses": { + "200": { + "description": "A list of changes associated with a resource over a specific time interval.", + "schema": { + "$ref": "#/definitions/ResourceChangeList" + } + }, + "default": { + "description": "A response indicating an error.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Basic query": { "$ref": "./examples/ResourceChanges.json" }, + "First page query": { "$ref": "./examples/ResourceChangesFirstPage.json" }, + "Next page query": { "$ref": "./examples/ResourceChangesNextPage.json" } + } + } + }, + "/providers/Microsoft.ResourceGraph/resourceChangeDetails": { + "post": { + "description": "Get resource change details.", + "operationId": "ResourceChangeDetails", + "tags": [ + "Changes" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "description": "The parameters for this request for resource change details.", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceChangeDetailsRequestParameters" + } + } + ], + "responses": { + "200": { + "description": "Resource change details.", + "schema": { + "$ref": "#/definitions/ResourceChangeData" + } + }, + "default": { + "description": "A response indicating an error.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Basic query": { + "$ref": "./examples/ResourceChangeDetails.json" + } + } + } + }, "/providers/Microsoft.ResourceGraph/operations": { "get": { "tags": [ @@ -411,6 +495,142 @@ } ] }, + "ResourceChangesRequestParameters": { + "description": "The parameters for a specific changes request.", + "type": "object", + "properties": { + "resourceId": { + "description": "Specifies the resource for a changes request.", + "type": "string" + }, + "interval": { + "description": "Specifies the date and time interval for a changes request.", + "allOf": [ + { + "$ref": "#/definitions/DateTimeInterval" + } + ] + }, + "$skipToken": { + "description": "Acts as the continuation token for paged responses.", + "type": "string" + }, + "$top": { + "description": "The maximum number of changes the client can accept in a paged response.", + "type": "integer", + "format": "int32", + "minimum": 1, + "maximum": 1000 + } + }, + "required": [ + "resourceId", + "interval" + ] + }, + "ResourceChangeList": { + "description": "A list of changes associated with a resource over a specific time interval.", + "type": "object", + "properties": { + "changes": { + "description": "The pageable value returned by the operation, i.e. a list of changes to the resource.\n\n- The list is ordered from the most recent changes to the least recent changes.\n- This list will be empty if there were no changes during the requested interval.\n- The `Before` snapshot timestamp value of the oldest change can be outside of the specified time interval.", + "type": "array", + "items": { + "$ref": "#/definitions/ResourceChangeData" + } + }, + "$skipToken": { + "description": "Skip token that encodes the skip information while executing the current request" + } + } + }, + "ResourceChangeData": { + "description": "Data on a specific change, represented by a pair of before and after resource snapshots.", + "type": "object", + "properties": { + "changeId": { + "description": "The change ID. Valid and unique within the specified resource only.", + "type": "string" + }, + "beforeSnapshot": { + "description": "The snapshot before the change.", + "allOf": [ + { + "$ref": "#/definitions/ResourceSnapshotData" + } + ] + }, + "afterSnapshot": { + "description": "The snapshot after the change.", + "allOf": [ + { + "$ref": "#/definitions/ResourceSnapshotData" + } + ] + } + }, + "required": [ + "changeId", + "beforeSnapshot", + "afterSnapshot" + ] + }, + "ResourceSnapshotData": { + "description": "Data on a specific resource snapshot.", + "type": "object", + "properties": { + "timestamp": { + "description": "The time when the snapshot was created.\nThe snapshot timestamp provides an approximation as to when a modification to a resource was detected. There can be a difference between the actual modification time and the detection time. This is due to differences in how operations that modify a resource are processed, versus how operation that record resource snapshots are processed.", + "type": "string", + "format": "date-time" + }, + "content": { + "description": "The resource snapshot content (in resourceChangeDetails response only).", + "type": "object" + } + }, + "required": [ + "timestamp" + ] + }, + "ResourceChangeDetailsRequestParameters": { + "description": "The parameters for a specific change details request.", + "type": "object", + "properties": { + "resourceId": { + "description": "Specifies the resource for a change details request.", + "type": "string" + }, + "changeId": { + "description": "Specifies the change ID.", + "type": "string" + } + }, + "required": [ + "resourceId", + "changeId" + ] + }, + "DateTimeInterval": { + "description": "An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. `[start, end)`.", + "type": "object", + "properties": { + "start": { + "description": "A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, end)`. Specifying a `start` that occurs chronologically after `end` will result in an error.", + "type": "string", + "format": "date-time" + }, + "end": { + "description": "A datetime indicating the exclusive/open end of the time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in an error.", + "type": "string", + "format": "date-time" + } + }, + "required": [ + "start", + "end" + ] + }, "ErrorResponse": { "title": "Error response.", "type": "object", diff --git a/specification/resourcegraph/resource-manager/readme.md b/specification/resourcegraph/resource-manager/readme.md index aa1d6e08f6f8..df9f3e104d86 100644 --- a/specification/resourcegraph/resource-manager/readme.md +++ b/specification/resourcegraph/resource-manager/readme.md @@ -41,7 +41,6 @@ model-validator: true message-format: json ``` - ### Tag: package-2019-04 These settings apply only when `--tag=package-2019-04` is specified on the command line. @@ -50,6 +49,7 @@ These settings apply only when `--tag=package-2019-04` is specified on the comma input-file: - Microsoft.ResourceGraph/stable/2019-04-01/resourcegraph.json ``` + ### Tag: package-2018-09-preview These settings apply only when `--tag=package-2018-09-preview` is specified on the command line. @@ -89,3 +89,20 @@ csharp: ## Go See configuration in [readme.go.md](./readme.go.md) + +## Suppression + +``` yaml +directive: + - suppress: ListInOperationName + from: resourcegraph.json + where: '$.paths["/providers/Microsoft.ResourceGraph/resourceChanges"].post.operationId' + reason: |- + 1. Is this rule applicable? R1003 ListInOperationName says: "Per ARM SDK guidelines, each 'GET' operation on a resource should have "list" in the name...". However, this is POST, not GET. + + 2. If the rule is applicable anyway, how should we fix it? Renaming it to ResourceChanges_List causes another warning: + "OperationId should contain the verb: 'resourcechanges' in:'ResourceChanges_List'. Consider updating the operationId" + Renaming it to ResourceChanges_ListResourceChanges causes yet another warning: + "Per the Noun_Verb convention for Operation Ids, the noun 'ResourceChanges' should not appear after the underscore." + Renaming it to ResourceChanges_Listresourcechanges seems to get rid of warnings, but the result looks very strange. +```