Skip to content

Commit 86ba737

Browse files
csassasinAshwani Tiwari
and
Ashwani Tiwari
authored
New API for attaching and detaching managed data disks in Control plane (#26093)
* Updating the new API draft changes * Update virtualMachineScaleSet.json * Indentation corrected * Addition of necessary files 1. Addition of necessary file. * Indentation correction * Updated references * Updated * Updated examples * Updated the examples * Updated based on lint-diff * Identation corrected * Updating based on LintDiff * Update diskId Update diskId * Update computeRPCommon.json * Update virtualMachine.json to check * Update error * Updated example with valid values * Suppress resource naming requirement --------- Co-authored-by: Ashwani Tiwari <[email protected]>
1 parent b7df97e commit 86ba737

8 files changed

+380
-0
lines changed

specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/computeRPCommon.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,69 @@
19591959
}
19601960
},
19611961
"description": "Specifies additional settings to be applied when patch mode AutomaticByPlatform is selected in Linux patch settings."
1962+
},
1963+
"AttachDetachDataDisksRequest": {
1964+
"type": "object",
1965+
"properties": {
1966+
"dataDisksToAttach": {
1967+
"type": "array",
1968+
"minItems": 1,
1969+
"items": {
1970+
"$ref": "#/definitions/DataDisksToAttach"
1971+
},
1972+
"x-ms-identifiers": [
1973+
"diskId"
1974+
],
1975+
"description": "The list of managed data disks to be attached."
1976+
},
1977+
"dataDisksToDetach": {
1978+
"type": "array",
1979+
"minItems": 1,
1980+
"items": {
1981+
"$ref": "#/definitions/DataDisksToDetach"
1982+
},
1983+
"x-ms-identifiers": [
1984+
"diskId"
1985+
],
1986+
"description": "The list of managed data disks to be detached."
1987+
}
1988+
},
1989+
"description": "Specifies the input for attaching and detaching a list of managed data disks."
1990+
},
1991+
"DataDisksToAttach": {
1992+
"type": "object",
1993+
"properties": {
1994+
"diskId": {
1995+
"type": "string",
1996+
"description": "ID of the managed data disk."
1997+
},
1998+
"lun": {
1999+
"type": "integer",
2000+
"format": "int32",
2001+
"description": "The logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. If not specified, lun would be auto assigned."
2002+
}
2003+
},
2004+
"required": [
2005+
"diskId"
2006+
],
2007+
"description": "Describes the data disk to be attached."
2008+
},
2009+
"DataDisksToDetach": {
2010+
"type": "object",
2011+
"properties": {
2012+
"diskId": {
2013+
"type": "string",
2014+
"description": "ID of the managed data disk."
2015+
},
2016+
"detachOption": {
2017+
"$ref": "#/definitions/DetachOption",
2018+
"description": "Supported options available for Detach of a disk from a VM. Refer to DetachOption object reference for more details."
2019+
}
2020+
},
2021+
"required": [
2022+
"diskId"
2023+
],
2024+
"description": "Describes the data disk to be detached."
19622025
}
19632026
}
19642027
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"parameters": {
3+
"resourceGroupName": "rgcompute",
4+
"vmName": "aaaaaaaaaaaaaaaaaaaa",
5+
"api-version": "2023-09-01",
6+
"subscriptionId": "{subscription-id}",
7+
"parameters": {
8+
"dataDisksToAttach": [
9+
{
10+
"lun": 1,
11+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"
12+
},
13+
{
14+
"lun": 2,
15+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"
16+
}
17+
],
18+
"dataDisksToDetach": [
19+
{
20+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x",
21+
"detachOption": "ForceDetach"
22+
},
23+
{
24+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z",
25+
"detachOption": "ForceDetach"
26+
}
27+
]
28+
}
29+
},
30+
"responses": {
31+
"200": {
32+
"body": {
33+
"location": "adfdf"
34+
}
35+
},
36+
"202": {
37+
"headers": {
38+
"location": "https://foo.com/operationstatus"
39+
}
40+
}
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"parameters": {
3+
"resourceGroupName": "rgcompute",
4+
"vmName": "azure-vm",
5+
"api-version": "2023-09-01",
6+
"subscriptionId": "{subscription-id}",
7+
"parameters": {
8+
"dataDisksToAttach": [
9+
{
10+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"
11+
}
12+
],
13+
"dataDisksToDetach": [
14+
{
15+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x"
16+
}
17+
]
18+
}
19+
},
20+
"responses": {
21+
"200": {
22+
"body": {
23+
"location": "westus"
24+
},
25+
"headers": {
26+
"location": "https://foo.com/operationstatus"
27+
}
28+
},
29+
"202": {
30+
"headers": {
31+
"location": "https://foo.com/operationstatus"
32+
}
33+
}
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"parameters": {
3+
"resourceGroupName": "rgcompute",
4+
"vmScaleSetName": "azure-vmscaleset",
5+
"instanceId": "0",
6+
"api-version": "2023-09-01",
7+
"subscriptionId": "{subscription-id}",
8+
"parameters": {
9+
"dataDisksToAttach": [
10+
{
11+
"lun": 1,
12+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"
13+
},
14+
{
15+
"lun": 2,
16+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"
17+
}
18+
],
19+
"dataDisksToDetach": [
20+
{
21+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x",
22+
"detachOption": "ForceDetach"
23+
},
24+
{
25+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z",
26+
"detachOption": "ForceDetach"
27+
}
28+
]
29+
}
30+
},
31+
"responses": {
32+
"200": {
33+
"body": {
34+
"location": "westus"
35+
},
36+
"headers": {
37+
"location": "https://foo.com/operationstatus"
38+
}
39+
},
40+
"202": {
41+
"headers": {
42+
"location": "https://foo.com/operationstatus"
43+
}
44+
}
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"parameters": {
3+
"resourceGroupName": "rgcompute",
4+
"vmScaleSetName": "azure-vmscaleset",
5+
"instanceId": "0",
6+
"api-version": "2023-09-01",
7+
"subscriptionId": "{subscription-id}",
8+
"parameters": {
9+
"dataDisksToAttach": [
10+
{
11+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"
12+
}
13+
],
14+
"dataDisksToDetach": [
15+
{
16+
"diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x"
17+
}
18+
]
19+
}
20+
},
21+
"responses": {
22+
"200": {
23+
"body": {
24+
"location": "westus"
25+
},
26+
"headers": {
27+
"location": "https://foo.com/operationstatus"
28+
}
29+
},
30+
"202": {
31+
"headers": {
32+
"location": "https://foo.com/operationstatus"
33+
}
34+
}
35+
}
36+
}

specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/virtualMachine.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,80 @@
19351935
"final-state-via": "location"
19361936
}
19371937
}
1938+
},
1939+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks": {
1940+
"post": {
1941+
"tags": [
1942+
"VirtualMachines"
1943+
],
1944+
"operationId": "VirtualMachines_AttachDetachDataDisks",
1945+
"description": "Attach and detach data disks to/from the virtual machine.",
1946+
"parameters": [
1947+
{
1948+
"name": "resourceGroupName",
1949+
"in": "path",
1950+
"required": true,
1951+
"type": "string",
1952+
"description": "The name of the resource group."
1953+
},
1954+
{
1955+
"name": "vmName",
1956+
"in": "path",
1957+
"required": true,
1958+
"type": "string",
1959+
"description": "The name of the virtual machine."
1960+
},
1961+
{
1962+
"name": "parameters",
1963+
"in": "body",
1964+
"required": true,
1965+
"schema": {
1966+
"$ref": "./computeRPCommon.json#/definitions/AttachDetachDataDisksRequest"
1967+
},
1968+
"description": "Parameters supplied to the attach and detach data disks operation on the virtual machine."
1969+
},
1970+
{
1971+
"$ref": "../../../common-types/v1/common.json#/parameters/SubscriptionIdParameter"
1972+
},
1973+
{
1974+
"$ref": "../../../common-types/v1/common.json#/parameters/ApiVersionParameter"
1975+
}
1976+
],
1977+
"responses": {
1978+
"200": {
1979+
"description": "OK",
1980+
"schema": {
1981+
"$ref": "#/definitions/VirtualMachine"
1982+
}
1983+
},
1984+
"202": {
1985+
"description": "Accepted",
1986+
"headers": {
1987+
"Location": {
1988+
"type": "string"
1989+
}
1990+
}
1991+
},
1992+
"default": {
1993+
"description": "Error response describing why the operation failed.",
1994+
"schema": {
1995+
"$ref": "../../../common-types/v1/common.json#/definitions/CloudError"
1996+
}
1997+
}
1998+
},
1999+
"x-ms-long-running-operation": true,
2000+
"x-ms-long-running-operation-options": {
2001+
"final-state-via": "location"
2002+
},
2003+
"x-ms-examples": {
2004+
"VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen": {
2005+
"$ref": "./examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.json"
2006+
},
2007+
"VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen": {
2008+
"$ref": "./examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.json"
2009+
}
2010+
}
2011+
}
19382012
}
19392013
},
19402014
"definitions": {

0 commit comments

Comments
 (0)