From da30e66a01ee5c8eada772de870e4f479354bd56 Mon Sep 17 00:00:00 2001 From: Vinit Dinesh Parekh Date: Mon, 17 May 2021 14:44:55 -0700 Subject: [PATCH 1/3] Add Resource Identity swagger to common v2 --- .../2020-11-01-preview/ManagedInstances.json | 4 +- .../preview/2020-11-01-preview/Servers.json | 4 +- .../2021-02-01-preview/ManagedInstances.json | 4 +- .../preview/2021-02-01-preview/Servers.json | 4 +- .../sql/resource-manager/common/v2/types.json | 92 +++++++++++++++++++ 5 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 specification/sql/resource-manager/common/v2/types.json diff --git a/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/ManagedInstances.json b/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/ManagedInstances.json index 758ab9e1b32d..84c7e9cb35ab 100644 --- a/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/ManagedInstances.json +++ b/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/ManagedInstances.json @@ -969,7 +969,7 @@ ], "properties": { "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "The Azure Active Directory identity of the managed instance.", "x-ms-mutability": [ "read", @@ -996,7 +996,7 @@ "description": "Managed instance sku" }, "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "Managed instance identity" }, "properties": { diff --git a/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/Servers.json b/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/Servers.json index aa4e10279057..b99f6785495b 100644 --- a/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/Servers.json +++ b/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/Servers.json @@ -736,7 +736,7 @@ ], "properties": { "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "The Azure Active Directory identity of the server.", "x-ms-mutability": [ "read", @@ -760,7 +760,7 @@ "type": "object", "properties": { "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "Server identity" }, "properties": { diff --git a/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/ManagedInstances.json b/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/ManagedInstances.json index 934a8280c2c7..1321783eb9dc 100644 --- a/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/ManagedInstances.json +++ b/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/ManagedInstances.json @@ -978,7 +978,7 @@ ], "properties": { "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "The Azure Active Directory identity of the managed instance.", "x-ms-mutability": [ "read", @@ -1005,7 +1005,7 @@ "description": "Managed instance sku" }, "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "Managed instance identity" }, "properties": { diff --git a/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/Servers.json b/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/Servers.json index a54f852ae472..4e8657f0cdc8 100644 --- a/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/Servers.json +++ b/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/Servers.json @@ -749,7 +749,7 @@ ], "properties": { "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "The Azure Active Directory identity of the server.", "x-ms-mutability": [ "read", @@ -773,7 +773,7 @@ "type": "object", "properties": { "identity": { - "$ref": "#/definitions/ResourceIdentityWithUserAssignedIdentities", + "$ref": "../../../common/v2/types.json#/definitions/ResourceIdentity", "description": "Server identity" }, "properties": { diff --git a/specification/sql/resource-manager/common/v2/types.json b/specification/sql/resource-manager/common/v2/types.json new file mode 100644 index 000000000000..c5bc658e551d --- /dev/null +++ b/specification/sql/resource-manager/common/v2/types.json @@ -0,0 +1,92 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0", + "title": "Common types" + }, + "paths": {}, + "definitions": { + "UserIdentity": { + "description": "Azure Active Directory identity configuration for a resource.", + "type": "object", + "properties": { + "principalId": { + "format": "uuid", + "description": "The Azure Active Directory principal id.", + "type": "string", + "readOnly": true + }, + "clientId": { + "format": "uuid", + "description": "The Azure Active Directory client id.", + "type": "string", + "readOnly": true + } + } + }, + "ResourceIdentity": { + "description": "Azure Active Directory identity configuration for a resource.", + "type": "object", + "properties": { + "userAssignedIdentities": { + "description": "The resource ids of the user assigned identities to use", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserIdentity" + } + }, + "principalId": { + "format": "uuid", + "description": "The Azure Active Directory principal id.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource.", + "enum": [ + "None", + "SystemAssigned", + "UserAssigned" + ], + "type": "string", + "x-ms-enum": { + "name": "IdentityType", + "modelAsString": true + } + }, + "tenantId": { + "format": "uuid", + "description": "The Azure Active Directory tenant id.", + "type": "string", + "readOnly": true + } + } + } + }, + "parameters": { + "SubscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The subscription ID that identifies an Azure subscription.", + "required": true, + "type": "string", + "x-ms-parameter-location": "client" + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API version to use for the request.", + "required": true, + "type": "string", + "x-ms-parameter-location": "client" + }, + "ResourceGroupParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + } + } +} From 23146ce905146dadc905e13fe2404375573470e3 Mon Sep 17 00:00:00 2001 From: Vinit Dinesh Parekh Date: Mon, 17 May 2021 15:00:41 -0700 Subject: [PATCH 2/3] Change version number --- specification/sql/resource-manager/common/v2/types.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/sql/resource-manager/common/v2/types.json b/specification/sql/resource-manager/common/v2/types.json index c5bc658e551d..bd8d8a6c0e61 100644 --- a/specification/sql/resource-manager/common/v2/types.json +++ b/specification/sql/resource-manager/common/v2/types.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.0", + "version": "2.0", "title": "Common types" }, "paths": {}, From 40a4f80e3b90f568a656ca1d868e13c212cd79bf Mon Sep 17 00:00:00 2001 From: Vinit Dinesh Parekh Date: Mon, 17 May 2021 15:20:56 -0700 Subject: [PATCH 3/3] Changed version num. Removed parameters --- .../sql/resource-manager/common/v2/types.json | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/specification/sql/resource-manager/common/v2/types.json b/specification/sql/resource-manager/common/v2/types.json index bd8d8a6c0e61..9cd1182902d7 100644 --- a/specification/sql/resource-manager/common/v2/types.json +++ b/specification/sql/resource-manager/common/v2/types.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "2.0", + "version": "v2", "title": "Common types" }, "paths": {}, @@ -62,31 +62,5 @@ } } } - }, - "parameters": { - "SubscriptionIdParameter": { - "name": "subscriptionId", - "in": "path", - "description": "The subscription ID that identifies an Azure subscription.", - "required": true, - "type": "string", - "x-ms-parameter-location": "client" - }, - "ApiVersionParameter": { - "name": "api-version", - "in": "query", - "description": "The API version to use for the request.", - "required": true, - "type": "string", - "x-ms-parameter-location": "client" - }, - "ResourceGroupParameter": { - "name": "resourceGroupName", - "in": "path", - "description": "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - } } }