Skip to content

Commit 978acdc

Browse files
authored
Updating ContainerStorage Swagger (#24749)
* updating containerstorage to match Azure-ContainerStorageRP swagger * updating readme.md files * removing disks in example request and adding an extra zone to examples * updating examples
1 parent d8220a0 commit 978acdc

124 files changed

Lines changed: 5125 additions & 3724 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Azure Container Storage Resource Provider TypeSpec and Swagger Specification
2+
3+
The TypeSpec and generated API specification for the Azure Container Storage Resource Provider.
4+
5+
## Development Environment
6+
7+
0. Change directory into the `src\Swagger\Microsoft.ContainerStorage\ContainerStorage.Management\` directory.
8+
9+
1. Install Node.js 16 LTS and ensure you are able to run the npm command in a command prompt:
10+
11+
```console
12+
npm --version
13+
```
14+
15+
2. Install Azure DevOps Auth helper for npm to pull the libraries from the secured feed
16+
17+
```console
18+
npm install -g vsts-npm-auth
19+
vsts-npm-auth -config .npmrc
20+
```
21+
22+
3. Install TypeSpec compiler and libraries:
23+
24+
```console
25+
npm install -g @typespec/compiler
26+
```
27+
28+
4. (Optional) Install the TypeSpec extension for your editor of choice:
29+
30+
- Visual Studio Code
31+
32+
``` console
33+
tsp code install
34+
```
35+
36+
- Visual Studio
37+
38+
``` console
39+
tsp vs install
40+
```
41+
42+
5. Install node package dependencies:
43+
44+
```console
45+
tsp install
46+
```
47+
48+
6. Compile TypeSpec to Swagger. This will update the files in the directory `.\resource-manager\Microsoft.ContainerStorage\preview\<api-version>\`:
49+
50+
```console
51+
tsp compile src\Swagger\Microsoft.ContainerStorage\ContainerStorage.Management
52+
```
53+
54+
7. To re-generate examples, download and install the [OAV
55+
tool](https://github.com/Azure/oav) and run it: note: This directory is taken
56+
from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs),
57+
and the following commands should be run from there.
58+
59+
```console
60+
npm install -g oav@latest
61+
oav generate-examples <path to containerstorage.json>
62+
# example
63+
oav generate-examples src\Swagger\Microsoft.ContainerStorage\resource-manager\Microsoft.ContainerStorage\preview\2023-07-01-preview\containerstorage.json
64+
```
65+
66+
## Testing and Viewing API as an Interface
67+
68+
1. Visit the official [Swagger Editor](https://editor.swagger.io/).
69+
70+
2. Copy the generated Swagger from `containerstorage.json` and paste it into the editor.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"title": "Operations_List",
3+
"operationId": "Operations_List",
4+
"parameters": {
5+
"api-version": "2023-07-01-preview"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"value": [
11+
{
12+
"name": "Microsoft.ContainerStorage/Volumes/Get",
13+
"isDataAction": true,
14+
"display": {
15+
"provider": "Microsoft Container Storage",
16+
"resource": "Operation",
17+
"operation": "Get Operation",
18+
"description": "Gets the status of an asynchronous operation"
19+
},
20+
"origin": "user",
21+
"actionType": "Internal"
22+
}
23+
],
24+
"nextLink": "http://nextlink.contoso.com"
25+
}
26+
}
27+
}
28+
}

specification/containerstorage/ContainerStorage.Management/examples/Operations_List_MaximumSet_Gen.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

specification/containerstorage/ContainerStorage.Management/examples/Operations_List_MinimumSet_Gen.json

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
{
2+
"title": "Pools_CreateOrUpdate_AzureDisk",
3+
"operationId": "Pools_CreateOrUpdate",
4+
"parameters": {
5+
"api-version": "2023-07-01-preview",
6+
"subscriptionId": "bb4d87a2-4273-466c-a6ba-61d818061b3a",
7+
"resourceGroupName": "test-rg",
8+
"poolName": "test-pool",
9+
"resource": {
10+
"properties": {
11+
"provisioningState": "Succeeded",
12+
"status": {
13+
"state": "Pending",
14+
"message": "Operation is Pending"
15+
},
16+
"zones": [
17+
"1",
18+
"2",
19+
"3"
20+
],
21+
"resources": {
22+
"requests": {
23+
"storage": 15578
24+
}
25+
},
26+
"poolType": {
27+
"azureDisk": {
28+
"skuName": "Premium_LRS",
29+
"encryption": {
30+
"keyName": "test-key",
31+
"keyVaultUri": "https://test-kv.vault.azure.net/",
32+
"identity": {
33+
"type": "None",
34+
"userAssignedIdentities": {
35+
"key7678": {}
36+
}
37+
}
38+
}
39+
}
40+
},
41+
"reclaimPolicy": "Delete",
42+
"assignments": [
43+
{
44+
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest"
45+
}
46+
]
47+
},
48+
"tags": {
49+
"key1888": "value1888"
50+
},
51+
"location": "eastus"
52+
}
53+
},
54+
"responses": {
55+
"200": {
56+
"body": {
57+
"properties": {
58+
"provisioningState": "Succeeded",
59+
"status": {
60+
"state": "Pending",
61+
"message": "Operation is Pending"
62+
},
63+
"zones": [
64+
"1",
65+
"2",
66+
"3"
67+
],
68+
"resources": {
69+
"requests": {
70+
"storage": 15578
71+
}
72+
},
73+
"poolType": {
74+
"azureDisk": {
75+
"resourceGroup": "test-rg2",
76+
"skuName": "Premium_LRS",
77+
"encryption": {
78+
"keyName": "test-key",
79+
"keyVaultUri": "https://test-kv.vault.azure.net/",
80+
"identity": {
81+
"principalId": "14215384-6980-4e3c-8c58-c7738db7d34e",
82+
"tenantId": "02cd8342-46ab-45d5-8cc4-2a80b9a90af5",
83+
"type": "None",
84+
"userAssignedIdentities": {
85+
"key7678": {
86+
"principalId": "6a6104be-65e4-48a8-919d-a88c1cd2a255",
87+
"clientId": "5286d698-5b3d-4051-a280-2e4f20869426"
88+
}
89+
}
90+
}
91+
},
92+
"disks": [
93+
{
94+
"id": "eui.e8238fa6bf530001001b448b45263379",
95+
"reference": "/dev/sdk"
96+
}
97+
]
98+
}
99+
},
100+
"reclaimPolicy": "Delete",
101+
"assignments": [
102+
{
103+
"status": {
104+
"state": "Assigning",
105+
"message": "The assignment of the pool to the resource is in progress"
106+
},
107+
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest"
108+
}
109+
]
110+
},
111+
"tags": {
112+
"key1888": "value1888"
113+
},
114+
"location": "eastus",
115+
"name": "test-pool",
116+
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerStorage/pools/test-pool",
117+
"type": "Microsoft.ContainerStorage/pools",
118+
"systemData": {
119+
"createdBy": "user1",
120+
"createdByType": "User",
121+
"createdAt": "2023-07-17T21:48:26.401Z",
122+
"lastModifiedBy": "user2",
123+
"lastModifiedByType": "User",
124+
"lastModifiedAt": "2023-07-17T21:48:26.401Z"
125+
}
126+
}
127+
},
128+
"201": {
129+
"headers": {
130+
"location": "https://contoso.com/operationstatus"
131+
},
132+
"body": {
133+
"properties": {
134+
"provisioningState": "Succeeded",
135+
"status": {
136+
"state": "Pending",
137+
"message": "Operation is Pending"
138+
},
139+
"zones": [
140+
"1",
141+
"2",
142+
"3"
143+
],
144+
"resources": {
145+
"requests": {
146+
"storage": 15578
147+
}
148+
},
149+
"poolType": {
150+
"azureDisk": {
151+
"resourceGroup": "test-rg2",
152+
"skuName": "Premium_LRS",
153+
"encryption": {
154+
"keyName": "test-key",
155+
"keyVaultUri": "https://test-kv.vault.azure.net/",
156+
"identity": {
157+
"principalId": "14215384-6980-4e3c-8c58-c7738db7d34e",
158+
"tenantId": "02cd8342-46ab-45d5-8cc4-2a80b9a90af5",
159+
"type": "None",
160+
"userAssignedIdentities": {
161+
"key7678": {
162+
"principalId": "6a6104be-65e4-48a8-919d-a88c1cd2a255",
163+
"clientId": "5286d698-5b3d-4051-a280-2e4f20869426"
164+
}
165+
}
166+
}
167+
},
168+
"disks": [
169+
{
170+
"id": "eui.e8238fa6bf530001001b448b45263379",
171+
"reference": "/dev/sdk"
172+
}
173+
]
174+
}
175+
},
176+
"reclaimPolicy": "Delete",
177+
"assignments": [
178+
{
179+
"status": {
180+
"state": "Assigning",
181+
"message": "The assignment of the pool to the resource is in progress"
182+
},
183+
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest"
184+
}
185+
]
186+
},
187+
"tags": {
188+
"key1888": "value1888"
189+
},
190+
"location": "eastus",
191+
"name": "test-pool",
192+
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerStorage/pools/test-pool",
193+
"type": "Microsoft.ContainerStorage/pools",
194+
"systemData": {
195+
"createdBy": "user1",
196+
"createdByType": "User",
197+
"createdAt": "2023-07-17T21:48:26.401Z",
198+
"lastModifiedBy": "user2",
199+
"lastModifiedByType": "User",
200+
"lastModifiedAt": "2023-07-17T21:48:26.401Z"
201+
}
202+
}
203+
}
204+
}
205+
}

0 commit comments

Comments
 (0)