From 2e88f0e0951d1cdbe59db4dafbc48c93a723bfa2 Mon Sep 17 00:00:00 2001 From: Daniel Hu Date: Tue, 4 Oct 2022 20:43:02 -0700 Subject: [PATCH] Introduce Microsoft.Resources/snapshots (#20921) * Add new snapshots type * Readme * Readme typo * suppressions * readme * Preview * Make augmented properties siblings of the original ARM resource * Snapshot * prettier * fix examples * comments * comments * comments --- .../examples/GetSnapshot.json | 87 ++++++ .../examples/ListSnapshots.json | 162 +++++++++++ .../preview/2022-11-01-preview/snapshots.json | 251 ++++++++++++++++++ .../resources/resource-manager/readme.md | 22 ++ 4 files changed, 522 insertions(+) create mode 100644 specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/GetSnapshot.json create mode 100644 specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/ListSnapshots.json create mode 100644 specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/snapshots.json diff --git a/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/GetSnapshot.json b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/GetSnapshot.json new file mode 100644 index 000000000000..f5d4d2a64f2e --- /dev/null +++ b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/GetSnapshot.json @@ -0,0 +1,87 @@ +{ + "parameters": { + "subscriptionId": "subscriptionId1", + "resourceGroupName": "resourceGroup1", + "resourceProviderNamespace": "resourceProvider1", + "resourceType": "resourceType1", + "resourceName": "resourceName1", + "api-version": "2022-11-01-preview", + "snapshotId": "snapshotId1" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/providers/Microsoft.Resources/snapshots/snapshotId1", + "name": "snapshotId1", + "type": "Microsoft.Resources/snapshots", + "properties": { + "apiVersion": "2022-05-01", + "content": { + "sku": { + "name": "Standard_GZRS", + "tier": "Standard" + }, + "kind": "StorageV2", + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1", + "name": "resourceName1", + "type": "resourceProvider1/resourceType1", + "location": "eastus", + "tags": { + "aaa": "aaaa", + "dfasdf": "dfsadfsf" + }, + "properties": { + "defaultToOAuthAuthentication": false, + "keyCreationTime": { + "key1": "2021-04-15T20:12:24.1028866Z", + "key2": "2021-04-15T19:58:00.3691784Z" + }, + "privateEndpointConnections": [], + "minimumTlsVersion": "TLS1_0", + "allowBlobPublicAccess": true, + "allowSharedKeyAccess": true, + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + }, + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "keyType": "Account", + "enabled": true, + "lastEnabledTime": "2021-04-15T19:58:00.3848008Z" + }, + "blob": { + "keyType": "Account", + "enabled": true, + "lastEnabledTime": "2021-04-15T19:58:00.3848008Z" + } + }, + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot", + "provisioningState": "Succeeded", + "creationTime": "2021-04-15T19:58:00.2285507Z", + "primaryEndpoints": { + "dfs": "https://resourceName1.dfs.core.windows.net/", + "web": "https://resourceName1.z13.web.core.windows.net/", + "blob": "https://resourceName1.blob.core.windows.net/", + "queue": "https://resourceName1.queue.core.windows.net/", + "table": "https://resourceName1.table.core.windows.net/", + "file": "https://resourceName1.file.core.windows.net/" + }, + "primaryLocation": "eastus", + "statusOfPrimary": "available", + "lastGeoFailoverTime": "2022-07-21T22:11:20.3670939Z", + "secondaryLocation": "westus", + "statusOfSecondary": "available" + } + } + } + } + } + } +} diff --git a/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/ListSnapshots.json b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/ListSnapshots.json new file mode 100644 index 000000000000..ba07b914e7d2 --- /dev/null +++ b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/examples/ListSnapshots.json @@ -0,0 +1,162 @@ +{ + "parameters": { + "subscriptionId": "subscriptionId1", + "resourceGroupName": "resourceGroup1", + "resourceProviderNamespace": "resourceProvider1", + "resourceType": "resourceType1", + "resourceName": "resourceName1", + "api-version": "2022-11-01-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/providers/Microsoft.Resources/snapshots/snapshotId1", + "name": "snapshotId1", + "type": "Microsoft.Resources/snapshots", + "properties": { + "apiVersion": "2022-05-01", + "content": { + "sku": { + "name": "Standard_GZRS", + "tier": "Standard" + }, + "kind": "StorageV2", + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1", + "name": "resourceName1", + "type": "resourceProvider1/resourceType1", + "location": "eastus", + "tags": { + "aaa": "aaaa", + "dfasdf": "dfsadfsf" + }, + "properties": { + "defaultToOAuthAuthentication": false, + "keyCreationTime": { + "key1": "2021-04-15T20:12:24.1028866Z", + "key2": "2021-04-15T19:58:00.3691784Z" + }, + "privateEndpointConnections": [], + "minimumTlsVersion": "TLS1_0", + "allowBlobPublicAccess": true, + "allowSharedKeyAccess": true, + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + }, + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "keyType": "Account", + "enabled": true, + "lastEnabledTime": "2021-04-15T19:58:00.3848008Z" + }, + "blob": { + "keyType": "Account", + "enabled": true, + "lastEnabledTime": "2021-04-15T19:58:00.3848008Z" + } + }, + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot", + "provisioningState": "Succeeded", + "creationTime": "2021-04-15T19:58:00.2285507Z", + "primaryEndpoints": { + "dfs": "https://resourceName1.dfs.core.windows.net/", + "web": "https://resourceName1.z13.web.core.windows.net/", + "blob": "https://resourceName1.blob.core.windows.net/", + "queue": "https://resourceName1.queue.core.windows.net/", + "table": "https://resourceName1.table.core.windows.net/", + "file": "https://resourceName1.file.core.windows.net/" + }, + "primaryLocation": "eastus", + "statusOfPrimary": "available", + "lastGeoFailoverTime": "2022-07-21T22:11:20.3670939Z", + "secondaryLocation": "westus", + "statusOfSecondary": "available" + } + } + } + }, + { + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/providers/Microsoft.Resources/snapshots/snapshotId2", + "name": "snapshotId2", + "type": "Microsoft.Resources/snapshots", + "properties": { + "apiVersion": "2022-05-01", + "content": { + "sku": { + "name": "Standard_GZRS", + "tier": "Standard" + }, + "kind": "StorageV2", + "id": "/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1", + "name": "resourceName1", + "type": "resourceProvider1/resourceType1", + "location": "eastus", + "tags": { + "aaa": "aaaa", + "dfasdf": "dfsadfsf" + }, + "properties": { + "defaultToOAuthAuthentication": false, + "keyCreationTime": { + "key1": "2021-04-15T20:12:24.1028866Z", + "key2": "2021-04-15T19:58:00.3691784Z" + }, + "privateEndpointConnections": [], + "minimumTlsVersion": "TLS1_0", + "allowBlobPublicAccess": true, + "allowSharedKeyAccess": true, + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + }, + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "keyType": "Account", + "enabled": true, + "lastEnabledTime": "2021-04-15T19:58:00.3848008Z" + }, + "blob": { + "keyType": "Account", + "enabled": true, + "lastEnabledTime": "2021-04-15T19:58:00.3848008Z" + } + }, + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot", + "provisioningState": "Succeeded", + "creationTime": "2021-04-15T19:58:00.2285507Z", + "primaryEndpoints": { + "dfs": "https://resourceName1.dfs.core.windows.net/", + "web": "https://resourceName1.z13.web.core.windows.net/", + "blob": "https://resourceName1.blob.core.windows.net/", + "queue": "https://resourceName1.queue.core.windows.net/", + "table": "https://resourceName1.table.core.windows.net/", + "file": "https://resourceName1.file.core.windows.net/" + }, + "primaryLocation": "eastus", + "statusOfPrimary": "available", + "lastGeoFailoverTime": "2022-07-21T22:11:20.3670939Z", + "secondaryLocation": "westus", + "statusOfSecondary": "available" + } + } + } + } + ] + } + } + } +} diff --git a/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/snapshots.json b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/snapshots.json new file mode 100644 index 000000000000..678eb0c7ab00 --- /dev/null +++ b/specification/resources/resource-manager/Microsoft.Resources/preview/2022-11-01-preview/snapshots.json @@ -0,0 +1,251 @@ +{ + "swagger": "2.0", + "info": { + "version": "2022-11-01-preview", + "title": "SnapshotsClient", + "description": "The Resource Snapshots 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/snapshots": { + "get": { + "tags": [ + "ListSnapshots" + ], + "operationId": "Snapshots_List", + "x-ms-examples": { + "ListSnapshots": { + "$ref": "./examples/ListSnapshots.json" + } + }, + "description": "Obtains a list of snapshots from the past 14 days for the target resource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/ResourceProviderNamespaceParameter" + }, + { + "$ref": "#/parameters/ResourceTypeParameter" + }, + { + "$ref": "#/parameters/ResourceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/$top" + }, + { + "$ref": "#/parameters/$skipToken" + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/SnapshotListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Resources/snapshots/{snapshotId}": { + "get": { + "tags": [ + "GetSnapshot" + ], + "operationId": "Snapshots_Get", + "x-ms-examples": { + "GetSnapshot": { + "$ref": "./examples/GetSnapshot.json" + } + }, + "description": "Obtains the specified snapshot for the target resource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/ResourceProviderNamespaceParameter" + }, + { + "$ref": "#/parameters/ResourceTypeParameter" + }, + { + "$ref": "#/parameters/ResourceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/snapshotIdParameter" + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/Snapshot" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + } + } + }, + "definitions": { + "Snapshot": { + "type": "object", + "description": "A generic resource snapshot with additional metadata", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/SnapshotProperties" + } + } + }, + "SnapshotProperties": { + "description": "The properties of a snapshot", + "type": "object", + "properties": { + "apiVersion": { + "type": "string", + "description": "The API Version of the resource captured" + }, + "content": { + "description": "The actual ARM Resource", + "additionalProperties": {}, + "type": "object" + } + } + }, + "SnapshotListResult": { + "description": "The list of snapshots", + "type": "object", + "properties": { + "nextLink": { + "type": "string", + "description": "The link used to get the next page of Snapshots" + }, + "value": { + "description": "The list of snapshots", + "type": "array", + "x-ms-identifiers": [ + "id" + ], + "items": { + "$ref": "#/definitions/Snapshot" + } + } + } + } + }, + "parameters": { + "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" + }, + "snapshotIdParameter": { + "name": "snapshotId", + "in": "path", + "required": true, + "type": "string", + "description": "The ID of the snapshot", + "x-ms-parameter-location": "method" + }, + "$top": { + "required": false, + "default": 20, + "description": "(Optional) Set the maximum number of results per response.", + "in": "query", + "maximum": 100, + "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/readme.md b/specification/resources/resource-manager/readme.md index 83994fb5e305..2b514e0f1321 100644 --- a/specification/resources/resource-manager/readme.md +++ b/specification/resources/resource-manager/readme.md @@ -72,6 +72,20 @@ tag: package-templatespecs-2022-02 ``` yaml $(package-changes) tag: package-changes-2022-05 ``` + +``` yaml $(package-snapshots) +tag: package-snapshots-2022-11 +``` + +### Tag: package-snapshots-2022-11 + +These settings apply only when `--tag=package-snapshots-2022-11` is specified on the command line. + +``` yaml $(tag) == 'package-snapshots-2022-11' +input-file: +- Microsoft.Resources/preview/2022-11-01-preview/snapshots.json +``` + ### Tag: package-changes-2022-05 These settings apply only when `--tag=package-changes-2022-05` is specified on the command line. @@ -889,6 +903,13 @@ directive: suppress: OperationsAPIImplementation where: $.paths reason: 'Duplicate Operations API causes generation issues' + - from: snapshots.json + suppress: OperationsAPIImplementation + where: $.paths + reason: 'Duplicate Operations API causes generation issues' + - suppress: TopLevelResourcesListBySubscription + from: snapshots.json + reason: We will be pushing customers to use Azure Resource Graph for those at scale scenarios. - suppress: RequiredReadOnlySystemData from: changes.json reason: System Metadata from a change resource perspective is irrelevant @@ -942,6 +963,7 @@ batch: - package-deploymentscripts: true - package-templatespecs: true - package-changes: true + - package-snapshots: true ``` ### Tag: profile-hybrid-2019-03-01