Skip to content

Commit

Permalink
Updating ContainerStorage Swagger (#24749)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
aarongalang authored Aug 2, 2023
1 parent d8220a0 commit 978acdc
Show file tree
Hide file tree
Showing 124 changed files with 5,125 additions and 3,724 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Azure Container Storage Resource Provider TypeSpec and Swagger Specification

The TypeSpec and generated API specification for the Azure Container Storage Resource Provider.

## Development Environment

0. Change directory into the `src\Swagger\Microsoft.ContainerStorage\ContainerStorage.Management\` directory.

1. Install Node.js 16 LTS and ensure you are able to run the npm command in a command prompt:

```console
npm --version
```

2. Install Azure DevOps Auth helper for npm to pull the libraries from the secured feed

```console
npm install -g vsts-npm-auth
vsts-npm-auth -config .npmrc
```

3. Install TypeSpec compiler and libraries:

```console
npm install -g @typespec/compiler
```

4. (Optional) Install the TypeSpec extension for your editor of choice:

- Visual Studio Code

``` console
tsp code install
```

- Visual Studio

``` console
tsp vs install
```

5. Install node package dependencies:

```console
tsp install
```

6. Compile TypeSpec to Swagger. This will update the files in the directory `.\resource-manager\Microsoft.ContainerStorage\preview\<api-version>\`:

```console
tsp compile src\Swagger\Microsoft.ContainerStorage\ContainerStorage.Management
```

7. To re-generate examples, download and install the [OAV
tool](https://github.com/Azure/oav) and run it: note: This directory is taken
from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs),
and the following commands should be run from there.

```console
npm install -g oav@latest
oav generate-examples <path to containerstorage.json>
# example
oav generate-examples src\Swagger\Microsoft.ContainerStorage\resource-manager\Microsoft.ContainerStorage\preview\2023-07-01-preview\containerstorage.json
```

## Testing and Viewing API as an Interface

1. Visit the official [Swagger Editor](https://editor.swagger.io/).

2. Copy the generated Swagger from `containerstorage.json` and paste it into the editor.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"title": "Operations_List",
"operationId": "Operations_List",
"parameters": {
"api-version": "2023-07-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "Microsoft.ContainerStorage/Volumes/Get",
"isDataAction": true,
"display": {
"provider": "Microsoft Container Storage",
"resource": "Operation",
"operation": "Get Operation",
"description": "Gets the status of an asynchronous operation"
},
"origin": "user",
"actionType": "Internal"
}
],
"nextLink": "http://nextlink.contoso.com"
}
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
{
"title": "Pools_CreateOrUpdate_AzureDisk",
"operationId": "Pools_CreateOrUpdate",
"parameters": {
"api-version": "2023-07-01-preview",
"subscriptionId": "bb4d87a2-4273-466c-a6ba-61d818061b3a",
"resourceGroupName": "test-rg",
"poolName": "test-pool",
"resource": {
"properties": {
"provisioningState": "Succeeded",
"status": {
"state": "Pending",
"message": "Operation is Pending"
},
"zones": [
"1",
"2",
"3"
],
"resources": {
"requests": {
"storage": 15578
}
},
"poolType": {
"azureDisk": {
"skuName": "Premium_LRS",
"encryption": {
"keyName": "test-key",
"keyVaultUri": "https://test-kv.vault.azure.net/",
"identity": {
"type": "None",
"userAssignedIdentities": {
"key7678": {}
}
}
}
}
},
"reclaimPolicy": "Delete",
"assignments": [
{
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest"
}
]
},
"tags": {
"key1888": "value1888"
},
"location": "eastus"
}
},
"responses": {
"200": {
"body": {
"properties": {
"provisioningState": "Succeeded",
"status": {
"state": "Pending",
"message": "Operation is Pending"
},
"zones": [
"1",
"2",
"3"
],
"resources": {
"requests": {
"storage": 15578
}
},
"poolType": {
"azureDisk": {
"resourceGroup": "test-rg2",
"skuName": "Premium_LRS",
"encryption": {
"keyName": "test-key",
"keyVaultUri": "https://test-kv.vault.azure.net/",
"identity": {
"principalId": "14215384-6980-4e3c-8c58-c7738db7d34e",
"tenantId": "02cd8342-46ab-45d5-8cc4-2a80b9a90af5",
"type": "None",
"userAssignedIdentities": {
"key7678": {
"principalId": "6a6104be-65e4-48a8-919d-a88c1cd2a255",
"clientId": "5286d698-5b3d-4051-a280-2e4f20869426"
}
}
}
},
"disks": [
{
"id": "eui.e8238fa6bf530001001b448b45263379",
"reference": "/dev/sdk"
}
]
}
},
"reclaimPolicy": "Delete",
"assignments": [
{
"status": {
"state": "Assigning",
"message": "The assignment of the pool to the resource is in progress"
},
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest"
}
]
},
"tags": {
"key1888": "value1888"
},
"location": "eastus",
"name": "test-pool",
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerStorage/pools/test-pool",
"type": "Microsoft.ContainerStorage/pools",
"systemData": {
"createdBy": "user1",
"createdByType": "User",
"createdAt": "2023-07-17T21:48:26.401Z",
"lastModifiedBy": "user2",
"lastModifiedByType": "User",
"lastModifiedAt": "2023-07-17T21:48:26.401Z"
}
}
},
"201": {
"headers": {
"location": "https://contoso.com/operationstatus"
},
"body": {
"properties": {
"provisioningState": "Succeeded",
"status": {
"state": "Pending",
"message": "Operation is Pending"
},
"zones": [
"1",
"2",
"3"
],
"resources": {
"requests": {
"storage": 15578
}
},
"poolType": {
"azureDisk": {
"resourceGroup": "test-rg2",
"skuName": "Premium_LRS",
"encryption": {
"keyName": "test-key",
"keyVaultUri": "https://test-kv.vault.azure.net/",
"identity": {
"principalId": "14215384-6980-4e3c-8c58-c7738db7d34e",
"tenantId": "02cd8342-46ab-45d5-8cc4-2a80b9a90af5",
"type": "None",
"userAssignedIdentities": {
"key7678": {
"principalId": "6a6104be-65e4-48a8-919d-a88c1cd2a255",
"clientId": "5286d698-5b3d-4051-a280-2e4f20869426"
}
}
}
},
"disks": [
{
"id": "eui.e8238fa6bf530001001b448b45263379",
"reference": "/dev/sdk"
}
]
}
},
"reclaimPolicy": "Delete",
"assignments": [
{
"status": {
"state": "Assigning",
"message": "The assignment of the pool to the resource is in progress"
},
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest"
}
]
},
"tags": {
"key1888": "value1888"
},
"location": "eastus",
"name": "test-pool",
"id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerStorage/pools/test-pool",
"type": "Microsoft.ContainerStorage/pools",
"systemData": {
"createdBy": "user1",
"createdByType": "User",
"createdAt": "2023-07-17T21:48:26.401Z",
"lastModifiedBy": "user2",
"lastModifiedByType": "User",
"lastModifiedAt": "2023-07-17T21:48:26.401Z"
}
}
}
}
}
Loading

0 comments on commit 978acdc

Please sign in to comment.