From df12be95a74fbd2813640ed4eeff7ee2575a3b76 Mon Sep 17 00:00:00 2001 From: Daniel Hu Date: Wed, 26 Jan 2022 16:01:10 -0800 Subject: [PATCH] Adding changes resource type to Microsoft.Resources (#17500) * Adding changes resource type * Changing date to march * Suppress system data * Minor change * Resolve swagger lintdiff * Swagger lint diff * Swagger lint diff * Minor change * Semantic Validation * Swagger LintDiff * Readme * Readme * Suppression --- .../preview/2022-03-01-preview/changes.json | 424 ++++++++++++++++++ .../examples/GetChange.json | 46 ++ .../examples/ListChanges.json | 67 +++ .../resources/resource-manager/readme.md | 24 + 4 files changed, 561 insertions(+) create mode 100644 specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/changes.json create mode 100644 specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/GetChange.json create mode 100644 specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/ListChanges.json diff --git a/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/changes.json b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/changes.json new file mode 100644 index 000000000000..50a9fb675edc --- /dev/null +++ b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/changes.json @@ -0,0 +1,424 @@ +{ + "swagger": "2.0", + "info": { + "version": "2022-03-01-preview", + "title": "ChangesClient", + "description": "The Resource Changes Client" + }, + "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/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Resources/changes": { + "get": { + "tags": [ + "ListChanges" + ], + "operationId": "ChangeResources_List", + "x-ms-examples": { + "ListChanges": { + "$ref": "./examples/ListChanges.json" + } + }, + "description": "Obtains a list of change resources from the past 14 days for the target resource", + "parameters": [ + { + "$ref": "#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/ResourceProviderNamespaceParameter" + }, + { + "$ref": "#/parameters/ResourceTypeParameter" + }, + { + "$ref": "#/parameters/ResourceNameParameter" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/top" + }, + { + "$ref": "#/parameters/skipToken" + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/ChangeResourceListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Resources/changes/{changeResourceId}": { + "get": { + "tags": [ + "GetChange" + ], + "operationId": "ChangeResource_Get", + "x-ms-examples": { + "GetChange": { + "$ref": "./examples/GetChange.json" + } + }, + "description": "Obtains the specified change resource for the target resource", + "parameters": [ + { + "$ref": "#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/ResourceProviderNamespaceParameter" + }, + { + "$ref": "#/parameters/ResourceTypeParameter" + }, + { + "$ref": "#/parameters/ResourceNameParameter" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ChangeResourceIdParameter" + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/ChangeResourceResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/ErrorResponse" + } + } + } + } + } + }, + "definitions": { + "ChangeResourceListResult": { + "description": "The list of resources", + "type": "object", + "properties": { + "nextLink": { + "type": "string", + "description": "The link used to get the next page of Change Resources" + }, + "value": { + "description": "The list of resources", + "type": "array", + "items": { + "$ref": "#/definitions/ChangeResourceResult" + } + } + } + }, + "ChangeResourceResult": { + "description": "Change Resource", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/ChangeProperties" + } + } + }, + "ChangeProperties": { + "description": "The properties of a change", + "type": "object", + "properties": { + "targetResourceId": { + "description": "The fully qualified ID of the target resource that was changed", + "type": "string", + "readOnly": true + }, + "targetResourceType": { + "description": "The namespace and type of the resource", + "type": "string", + "readOnly": true + }, + "changeType": { + "description": "The type of change that was captured in the resource", + "type": "string", + "readOnly": true, + "enum": [ + "Update", + "Delete", + "Create" + ], + "x-ms-enum": { + "name": "ChangeType", + "modelAsString": false, + "values": [ + { + "value": "Update", + "description": "An existing resource underwent a change", + "name": "Update" + }, + { + "value": "Delete", + "description": "An existing resource was deleted", + "name": "Update" + }, + { + "value": "Create", + "description": "A newly created resource", + "name": "Create" + } + ] + } + }, + "changeAttributes": { + "$ref": "#/definitions/ChangeAttributes" + }, + "changes": { + "$ref": "#/definitions/ChangesDictionary" + } + } + }, + "ChangeAttributes": { + "description": "Details about the change resource", + "type": "object", + "properties": { + "correlationId": { + "description": "The ARM correlation ID of the change resource", + "type": "string", + "readOnly": true + }, + "timestamp": { + "description": "The time the change(s) on the target resource ocurred", + "type": "string", + "readOnly": true + }, + "changesCount": { + "type": "integer", + "format": "int64", + "readOnly": true, + "description": "The number of changes this resource captures" + }, + "previousResourceSnapshotId": { + "description": "The GUID of the previous snapshot", + "type": "string", + "readOnly": true + }, + "newResourceSnapshotId": { + "description": "The GUID of the new snapshot", + "type": "string", + "readOnly": true + } + } + }, + "ChangesDictionary": { + "description": "A dictionary with changed property name as a key and the change details as the value", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ChangeBase" + } + }, + "ChangeBase": { + "description": "An individual change on the target resource", + "type": "object", + "properties": { + "propertyChangeType": { + "description": "The type of change that occurred", + "type": "string", + "readOnly": true, + "enum": [ + "Insert", + "Update", + "Remove" + ], + "x-ms-enum": { + "name": "PropertyChangeType", + "modelAsString": false, + "values": [ + { + "value": "Update", + "description": "An existing property underwent a change", + "name": "Update" + }, + { + "value": "Insert", + "description": "A property was newly created", + "name": "Insert" + }, + { + "value": "Remove", + "description": "An existing property was deleted", + "name": "Remove" + } + ] + } + }, + "changeCategory": { + "description": "The entity that made the change", + "type": "string", + "readOnly": true, + "enum": [ + "User", + "System" + ], + "x-ms-enum": { + "name": "ChangeCategory", + "modelAsString": false, + "values": [ + { + "value": "User", + "description": "User initiated change", + "name": "User" + }, + { + "value": "System", + "description": "System initiated change", + "name": "System" + }, + { + "value": "Create", + "description": "A newly created resource", + "name": "Create" + } + ] + } + }, + "previousValue": { + "description": "The target resource property value before the change", + "type": "string", + "readOnly": true + }, + "newValue": { + "description": "The target resource property value after the change", + "type": "string", + "readOnly": true + } + } + } + }, + "parameters": { + "SubscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "required": true, + "type": "string", + "description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)" + }, + "ResourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the resource group.", + "x-ms-parameter-location": "method" + }, + "ResourceProviderNamespaceParameter": { + "name": "resourceProviderNamespace", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the resource provider namespace.", + "x-ms-parameter-location": "method" + }, + "ResourceTypeParameter": { + "name": "resourceType", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the resource type.", + "x-ms-parameter-location": "method" + }, + "ResourceNameParameter": { + "name": "resourceName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the resource.", + "x-ms-parameter-location": "method" + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The API version to be used with the HTTP request." + }, + "ChangeResourceIdParameter": { + "name": "changeResourceId", + "in": "path", + "required": true, + "type": "string", + "description": "The ID of the change resource", + "x-ms-parameter-location": "method" + }, + "top": { + "required": false, + "default": 100, + "description": "(Optional) Set the maximum number of results per response.", + "in": "query", + "maximum": 999, + "minimum": 1, + "name": "top", + "type": "integer", + "format": "int64", + "x-ms-parameter-location": "method" + }, + "skipToken": { + "required": false, + "description": "(Optional) The page-continuation token", + "in": "query", + "name": "skipToken", + "type": "string", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/GetChange.json b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/GetChange.json new file mode 100644 index 000000000000..c309601e41fe --- /dev/null +++ b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/GetChange.json @@ -0,0 +1,46 @@ +{ + "parameters": { + "subscriptionId": "subscriptionId1", + "resourceGroupName": "resourceGroup1", + "resourceProviderNamespace": "resourceProvider1", + "resourceType": "resourceType1", + "resourceName": "resourceName1", + "api-version": "2022-03-01-preview", + "changeResourceId": "1d58d72f-0719-4a48-9228-b7ea682885bf" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/Microsoft.Resources/changes/1d58d72f-0719-4a48-9228-b7ea682885bf", + "name": "1d58d72f-0719-4a48-9228-b7ea682885bf", + "type": "Microsoft.Resources/changes", + "properties": { + "targetResourceId": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1", + "targetResourceType": "resourceProvider1/resourceType1", + "changeType": "Update", + "changeAttributes": { + "correlationId": "88420d5d-8d0e-471f-9115-10d34750c617", + "timestamp": "2021-11-19T14:29:09.9210000Z", + "changesCount": 2, + "previousResourceSnapshotId": "ed90e35a-1661-42cc-a44c-e27f508005be", + "newResourceSnapshotId": "6eac9d0f-63b4-4e7f-97a5-740c73757efb" + }, + "changes": { + "properties.provisioningState": { + "propertyChangeType": "Update", + "changeCategory": "System", + "previousValue": "Updating", + "newValue": "Succeeded" + }, + "tags.key1": { + "propertyChangeType": "Insert", + "changeCategory": "User", + "previousValue": "null", + "newValue": "someValue" + } + } + } + } + } + } +} diff --git a/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/ListChanges.json b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/ListChanges.json new file mode 100644 index 000000000000..8e96e5838c5d --- /dev/null +++ b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-03-01-preview/examples/ListChanges.json @@ -0,0 +1,67 @@ +{ + "parameters": { + "subscriptionId": "subscriptionId1", + "resourceGroupName": "resourceGroup1", + "resourceProviderNamespace": "resourceProvider1", + "resourceType": "resourceType1", + "resourceName": "resourceName1", + "api-version": "2022-03-01-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/Microsoft.Resources/changes/a9f34285-13a2-e79c-f468-cfb71c7bd227", + "name": "a9f34285-13a2-e79c-f468-cfb71c7bd227", + "type": "Microsoft.Resources/changes", + "properties": { + "targetResourceId": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1", + "targetResourceType": "resourceProvider1/resourceType1", + "changeType": "Update", + "changeAttributes": { + "correlationId": "88420d5d-8d0e-471f-9115-10d34750c617", + "timestamp": "2021-11-19T14:29:09.9210000Z", + "changesCount": 2, + "previousResourceSnapshotId": "ed90e35a-1661-42cc-a44c-e27f508005be", + "newResourceSnapshotId": "6eac9d0f-63b4-4e7f-97a5-740c73757efb" + }, + "changes": { + "properties.provisioningState": { + "propertyChangeType": "Update", + "changeCategory": "System", + "previousValue": "Updating", + "newValue": "Succeeded" + }, + "tags.key1": { + "propertyChangeType": "Insert", + "changeCategory": "User", + "previousValue": "null", + "newValue": "someValue" + } + } + } + }, + { + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/Microsoft.Resources/changes/a9f34285-13a2-e79c-f468-cfb71c7bd227", + "name": "a9f34285-13a2-e79c-f468-cfb71c7bd227", + "type": "Microsoft.Resources/changes", + "properties": { + "targetResourceId": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1", + "targetResourceType": "resourceProvider1/resourceType1", + "changeType": "Create", + "changeAttributes": { + "changesCount": 0, + "correlationId": "88420d5d-8d0e-471f-9115-10d34750c617", + "timestamp": "2021-11-19T14:29:09.9210000Z", + "previousResourceSnapshotId": "b09f5e52-0b46-4d13-84a9-08653d39fed6", + "newResourceSnapshotId": "4db20fc0-de17-4cdd-92d8-fd6bf94b9fd9" + }, + "changes": {} + } + } + ] + } + } + } +} diff --git a/specification/resources/resource-manager/readme.md b/specification/resources/resource-manager/readme.md index c74e1724a1f2..ffc9b9b9881c 100644 --- a/specification/resources/resource-manager/readme.md +++ b/specification/resources/resource-manager/readme.md @@ -68,6 +68,19 @@ tag: package-deploymentscripts-2020-10 tag: package-templatespecs-2021-05 ``` +``` yaml $(package-changes) +tag: package-changes-2022-03 +``` + +### Tag: package-changes-2022-03 + +These settings apply only when `--tag=package-changes-2022-03-01-preview` is specified on the command line. + +``` yaml $(tag) == 'package-changes-2022-03' +input-file: +- Microsoft.Resources/preview/2022-03-01-preview/changes.json +``` + ### Tag: package-policy-2021-06 These settings apply only when `--tag=package-policy-2021-06` is specified on the command line. @@ -835,6 +848,16 @@ directive: - suppress: TopLevelResourcesListByResourceGroup from: privateLinks.json reason: The resource is managed in a management group level (instead of inside a resource group) + - suppress: TopLevelResourcesListBySubscription + from: changes.json + reason: We will be pushing customers to use Azure Resource Graph for those at scale scenarios. + - from: changes.json + suppress: OperationsAPIImplementation + where: $.paths + reason: 'Duplicate Operations API causes generation issues' + - suppress: RequiredReadOnlySystemData + from: changes.json + reason: System Metadata from a change resource perspective is irrelevant ``` --- @@ -884,6 +907,7 @@ batch: - package-managedapplications: true - package-deploymentscripts: true - package-templatespecs: true + - package-changes: true ``` ### Tag: profile-hybrid-2019-03-01