swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Disk Resource Provider Client.
  title: DiskResourceProviderClient
  version: 2016-04-30-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/compute/resource-manager/Microsoft.Compute/preview/2016-04-30-preview/disk.json
      version: "2.0"
  x-preferred: false
  x-providerName: azure.com
  x-serviceName: compute-disk
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
parameters:
  ApiVersionParameter:
    description: Client Api Version.
    in: query
    name: api-version
    required: true
    type: string
  DiskNameParameter:
    description: The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
    in: path
    name: diskName
    required: true
    type: string
    x-ms-parameter-location: method
  ResourceGroupNameParameter:
    description: The name of the resource group.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  SnapshotNameParameter:
    description: The name of the snapshot within the given subscription and resource group.
    in: path
    name: snapshotName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
    in: path
    name: subscriptionId
    required: true
    type: string
paths:
  "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks":
    get:
      description: Lists all the disks under a subscription.
      operationId: Disks_List
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DiskList"
      tags:
        - Disks
      x-ms-examples:
        List all managed disks in a subscription.:
          parameters:
            api-version: 2016-04-30-preview
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                nextLink: http://disksvchost:99/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks?$skiptoken={token}/Subscriptions/{subscriptionId}/ResourceGroups/myResourceGroup/Disks/myManagedDisk
                value:
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1
                    location: westus
                    name: myManagedDisk1
                    properties:
                      creationData:
                        createOption: Copy
                        sourceResourceId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1
                      diskSizeGB: 200
                      encryptionSettings:
                        diskEncryptionKey:
                          secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                        enabled: true
                        keyEncryptionKey:
                          keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:41:35.9278721+00:00
                    tags:
                      department: Development
                      project: ManagedDisks
                    type: Microsoft.Compute/disks
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2
                    location: westus
                    name: myManagedDisk2
                    properties:
                      creationData:
                        createOption: Empty
                      diskSizeGB: 10
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:41:36.872242+00:00
                    type: Microsoft.Compute/disks
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk3
                    location: westus
                    name: myManagedDisk3
                    properties:
                      creationData:
                        createOption: FromImage
                        imageReference:
                          id: /Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}
                      diskSizeGB: 200
                      encryptionSettings:
                        diskEncryptionKey:
                          secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                        enabled: true
                        keyEncryptionKey:
                          keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:41:36.3973934+00:00
                    tags:
                      department: Development
                      project: ManagedDisks
                    type: Microsoft.Compute/disks
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots":
    get:
      description: Lists snapshots under a subscription.
      operationId: Snapshots_List
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/SnapshotList"
      tags:
        - Snapshots
      x-ms-examples:
        List all snapshots in a subscription.:
          parameters:
            api-version: 2016-04-30-preview
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1
                    location: westus
                    name: mySnapshot1
                    properties:
                      creationData:
                        createOption: Copy
                        sourceResourceId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot
                      diskSizeGB: 200
                      encryptionSettings:
                        diskEncryptionKey:
                          secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                        enabled: true
                        keyEncryptionKey:
                          keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:47:30.6630569+00:00
                    tags:
                      department: Development
                      project: Snapshots
                    type: Microsoft.Compute/snapshots
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2
                    location: westus
                    name: mySnapshot2
                    properties:
                      creationData:
                        createOption: Import
                        sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
                        storageAccountId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount
                      diskSizeGB: 200
                      encryptionSettings:
                        diskEncryptionKey:
                          secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                        enabled: true
                        keyEncryptionKey:
                          keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:47:30.3247198+00:00
                    tags:
                      department: Development
                      project: Snapshots
                    type: Microsoft.Compute/snapshots
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks":
    get:
      description: Lists all the disks under a resource group.
      operationId: Disks_ListByResourceGroup
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DiskList"
      tags:
        - Disks
      x-ms-examples:
        List all managed disks in a resource group.:
          parameters:
            api-version: 2016-04-30-preview
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                nextLink: http://disksvchost:99/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks?$skiptoken={token}/Subscriptions/{subscriptionId}/ResourceGroups/myResourceGroup/Disks/myManagedDisk
                value:
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk
                    location: westus
                    name: myManagedDisk
                    properties:
                      creationData:
                        createOption: Copy
                        sourceResourceId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk
                      diskSizeGB: 200
                      encryptionSettings:
                        diskEncryptionKey:
                          secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                        enabled: true
                        keyEncryptionKey:
                          keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:41:35.9278721+00:00
                    tags:
                      department: Development
                      project: ManagedDisks
                    type: Microsoft.Compute/disks
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk
                    location: westus
                    name: myManagedDisk
                    properties:
                      creationData:
                        createOption: Empty
                      diskSizeGB: 10
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:41:36.872242+00:00
                    type: Microsoft.Compute/disks
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk
                    location: westus
                    name: myManagedDisk
                    properties:
                      creationData:
                        createOption: FromImage
                        imageReference:
                          id: /Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}
                      diskSizeGB: 200
                      encryptionSettings:
                        diskEncryptionKey:
                          secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                        enabled: true
                        keyEncryptionKey:
                          keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:41:36.3973934+00:00
                    tags:
                      department: Development
                      project: ManagedDisks
                    type: Microsoft.Compute/disks
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}":
    delete:
      description: Deletes a disk.
      operationId: Disks_Delete
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - $ref: "#/parameters/DiskNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/OperationStatusResponse"
        "202":
          description: Accepted
        "204":
          description: If the disk is deleted, this is an expected error code.
      tags:
        - Disks
      x-ms-long-running-operation: true
    get:
      description: Gets information about a disk.
      operationId: Disks_Get
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/DiskNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Disk"
      tags:
        - Disks
      x-ms-examples:
        Get information about a managed disk.:
          parameters:
            api-version: 2017-03-30
            diskName: myManagedDisk
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk
                location: westus
                name: myManagedDisk
                properties:
                  creationData:
                    createOption: Empty
                  diskSizeGB: 10
                  encryptionSettings:
                    diskEncryptionKey:
                      secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                      sourceVault:
                        id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                    enabled: true
                    keyEncryptionKey:
                      keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                      sourceVault:
                        id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                  osType: Windows
                  provisioningState: Succeeded
                  timeCreated: 2016-12-28T04:41:35.079872+00:00
                tags:
                  department: Development
                  project: ManagedDisks
                type: Microsoft.Compute/disks
    patch:
      description: Updates (patches) a disk.
      operationId: Disks_Update
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/DiskNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Disk object supplied in the body of the Patch disk operation.
          in: body
          name: disk
          required: true
          schema:
            $ref: "#/definitions/DiskUpdate"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Disk"
        "202":
          description: Accepted
          schema:
            $ref: "#/definitions/Disk"
      tags:
        - Disks
      x-ms-long-running-operation: true
    put:
      description: Creates or updates a disk.
      operationId: Disks_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/DiskNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Disk object supplied in the body of the Put disk operation.
          in: body
          name: disk
          required: true
          schema:
            $ref: "#/definitions/Disk"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Disk"
        "202":
          description: Accepted
          schema:
            $ref: "#/definitions/Disk"
      tags:
        - Disks
      x-ms-examples:
        Create a managed disk by copying a snapshot.:
          parameters:
            api-version: 2016-04-30-preview
            disk:
              location: West US
              name: myDisk
              properties:
                creationData:
                  createOption: Copy
                  sourceResourceId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot
            diskName: myDisk
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: myDisk
                properties:
                  creationData:
                    createOption: Copy
                    sourceResourceId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot
                  provisioningState: Updating
        Create a managed disk by importing an unmanaged blob from a different subscription.:
          parameters:
            api-version: 2016-04-30-preview
            disk:
              location: West US
              name: myDisk
              properties:
                creationData:
                  createOption: Import
                  sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
                  storageAccountId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount
            diskName: myDisk
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: myDisk
                properties:
                  creationData:
                    createOption: Import
                    sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
                    storageAccountId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount
                  provisioningState: Updating
        Create a managed disk by importing an unmanaged blob from the same subscription.:
          parameters:
            api-version: 2016-04-30-preview
            disk:
              location: West US
              name: myDisk
              properties:
                creationData:
                  createOption: Import
                  sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
            diskName: myDisk
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: myDisk
                properties:
                  creationData:
                    createOption: Import
                    sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
                  provisioningState: Updating
        Create a managed disk from a platform image.:
          parameters:
            api-version: 2016-04-30-preview
            disk:
              location: West US
              name: myDisk
              properties:
                creationData:
                  createOption: FromImage
                  imageReference:
                    id: /Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}
                osType: Windows
            diskName: myDisk
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: myDisk
                properties:
                  creationData:
                    createOption: FromImage
                    imageReference:
                      id: /Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}
                  osType: Windows
                  provisioningState: Updating
        Create a managed disk from an existing managed disk in the same or different subscription.:
          parameters:
            api-version: 2016-04-30-preview
            disk:
              location: West US
              name: myDisk2
              properties:
                creationData:
                  createOption: Copy
                  sourceResourceId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1
            diskName: myDisk2
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: myDisk2
                properties:
                  creationData:
                    createOption: Copy
                    sourceResourceId: subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1
                  provisioningState: Updating
        Create an empty managed disk.:
          parameters:
            api-version: 2016-04-30-preview
            disk:
              location: West US
              name: myDisk
              properties:
                creationData:
                  createOption: Empty
                diskSizeGB: 200
            diskName: myDisk
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: myDisk
                properties:
                  creationData:
                    createOption: Empty
                  diskSizeGB: 200
                  provisioningState: Updating
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess":
    post:
      description: Grants access to a disk.
      operationId: Disks_GrantAccess
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - $ref: "#/parameters/DiskNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Access data object supplied in the body of the get disk access operation.
          in: body
          name: grantAccessData
          required: true
          schema:
            $ref: "#/definitions/GrantAccessData"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/AccessUri"
        "202":
          description: Accepted
      tags:
        - Disks
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess":
    post:
      description: Revokes access to a disk.
      operationId: Disks_RevokeAccess
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - $ref: "#/parameters/DiskNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/OperationStatusResponse"
        "202":
          description: Accepted
      tags:
        - Disks
      x-ms-long-running-operation: true
      x-ms-long-running-operation-options:
        final-state-via: azure-async-operation
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots":
    get:
      description: Lists snapshots under a resource group.
      operationId: Snapshots_ListByResourceGroup
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/SnapshotList"
      tags:
        - Snapshots
      x-ms-examples:
        List all snapshots in a resource group.:
          parameters:
            api-version: 2016-04-30-preview
            resourceGroupName: myResourceGroup
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot
                    location: westus
                    name: mySnapshot
                    properties:
                      creationData:
                        createOption: Copy
                        sourceResourceId: subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot
                      diskSizeGB: 200
                      encryptionSettings:
                        diskEncryptionKey:
                          secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                        enabled: true
                        keyEncryptionKey:
                          keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                          sourceVault:
                            id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                      osType: Windows
                      provisioningState: Succeeded
                      timeCreated: 2016-12-28T04:41:35.9278721+00:00
                    tags:
                      department: Development
                      project: Snapshots
                    type: Microsoft.Compute/snapshots
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}":
    delete:
      description: Deletes a snapshot.
      operationId: Snapshots_Delete
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/SnapshotNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/OperationStatusResponse"
        "202":
          description: Accepted
        "204":
          description: If the snapshot is deleted, this is an expected error code.
      tags:
        - Snapshots
      x-ms-long-running-operation: true
    get:
      description: Gets information about a snapshot.
      operationId: Snapshots_Get
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/SnapshotNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Snapshot"
      tags:
        - Snapshots
      x-ms-examples:
        Get information about a snapshot.:
          parameters:
            api-version: 2016-04-30-preview
            resourceGroupName: myResourceGroup
            snapshotName: mySnapshot
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot
                location: westus
                name: mySnapshot
                properties:
                  creationData:
                    createOption: Empty
                  diskSizeGB: 100
                  encryptionSettings:
                    diskEncryptionKey:
                      secretUrl: https://myvmvault.vault-int.azure-int.net/secrets/{secret}
                      sourceVault:
                        id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                    enabled: true
                    keyEncryptionKey:
                      keyUrl: https://myvmvault.vault-int.azure-int.net/keys/{key}
                      sourceVault:
                        id: /subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault
                  osType: Windows
                  provisioningState: Succeeded
                  timeCreated: 2016-12-28T04:41:35.079872+00:00
                tags:
                  department: Development
                  project: Snapshots
                type: Microsoft.Compute/snapshots
    patch:
      description: Updates (patches) a snapshot.
      operationId: Snapshots_Update
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/SnapshotNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Snapshot object supplied in the body of the Patch snapshot operation.
          in: body
          name: snapshot
          required: true
          schema:
            $ref: "#/definitions/SnapshotUpdate"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Snapshot"
        "202":
          description: Accepted
          schema:
            $ref: "#/definitions/Snapshot"
      tags:
        - Snapshots
      x-ms-long-running-operation: true
    put:
      description: Creates or updates a snapshot.
      operationId: Snapshots_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/SnapshotNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Snapshot object supplied in the body of the Put disk operation.
          in: body
          name: snapshot
          required: true
          schema:
            $ref: "#/definitions/Snapshot"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Snapshot"
        "202":
          description: Accepted
          schema:
            $ref: "#/definitions/Snapshot"
      tags:
        - Snapshots
      x-ms-examples:
        Create a snapshot by importing an unmanaged blob from a different subscription.:
          parameters:
            api-version: 2017-03-30
            resourceGroupName: myResourceGroup
            snapshot:
              location: West US
              name: mySnapshot1
              properties:
                creationData:
                  createOption: Import
                  sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
                  storageAccountId: subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount
            snapshotName: mySnapshot1
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: mySnapshot1
                properties:
                  creationData:
                    createOption: Import
                    sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
                    storageAccountId: subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount
                  provisioningState: Updating
        Create a snapshot by importing an unmanaged blob from the same subscription.:
          parameters:
            api-version: 2017-03-30
            resourceGroupName: myResourceGroup
            snapshot:
              location: West US
              name: mySnapshot1
              properties:
                creationData:
                  createOption: Import
                  sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
            snapshotName: mySnapshot1
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: mySnapshot1
                properties:
                  creationData:
                    createOption: Import
                    sourceUri: https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd
                  provisioningState: Updating
        Create a snapshot from an existing snapshot in the same or a different subscription.:
          parameters:
            api-version: 2017-03-30
            resourceGroupName: myResourceGroup
            snapshot:
              location: West US
              name: mySnapshot2
              properties:
                creationData:
                  createOption: Copy
                  sourceResourceId: subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1
            snapshotName: mySnapshot2
            subscriptionId: "{subscription-id}"
          responses:
            "202":
              body:
                location: West US
                name: mySnapshot2
                properties:
                  creationData:
                    createOption: Copy
                    sourceResourceId: subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1
                  provisioningState: Updating
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess":
    post:
      description: Grants access to a snapshot.
      operationId: Snapshots_GrantAccess
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/SnapshotNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Access data object supplied in the body of the get snapshot access operation.
          in: body
          name: grantAccessData
          required: true
          schema:
            $ref: "#/definitions/GrantAccessData"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/AccessUri"
        "202":
          description: Accepted
      tags:
        - Snapshots
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess":
    post:
      description: Revokes access to a snapshot.
      operationId: Snapshots_RevokeAccess
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/SnapshotNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/OperationStatusResponse"
        "202":
          description: Accepted
      tags:
        - Snapshots
      x-ms-long-running-operation: true
      x-ms-long-running-operation-options:
        final-state-via: azure-async-operation
definitions:
  AccessUri:
    description: A disk access SAS uri.
    properties:
      properties:
        $ref: "#/definitions/AccessUriOutput"
        description: Operation output data (raw JSON)
        x-ms-client-flatten: true
  AccessUriOutput:
    description: Azure properties, including output.
    properties:
      output:
        $ref: "#/definitions/AccessUriRaw"
        description: Operation output data (raw JSON)
        x-ms-client-flatten: true
  AccessUriRaw:
    description: This object gets 'bubbled up' through flattening.
    properties:
      accessSAS:
        description: A SAS uri for accessing a disk.
        readOnly: true
        type: string
  ApiError:
    description: Api error.
    properties:
      code:
        description: The error code.
        type: string
      details:
        description: The Api error details
        items:
          $ref: "#/definitions/ApiErrorBase"
        type: array
      innererror:
        $ref: "#/definitions/InnerError"
        description: The Api inner error
      message:
        description: The error message.
        type: string
      target:
        description: The target of the particular error.
        type: string
  ApiErrorBase:
    description: Api error base.
    properties:
      code:
        description: The error code.
        type: string
      message:
        description: The error message.
        type: string
      target:
        description: The target of the particular error.
        type: string
  CreationData:
    description: Data used when creating a disk.
    properties:
      createOption:
        description: This enumerates the possible sources of a disk's creation.
        enum:
          - Empty
          - Attach
          - FromImage
          - Import
          - Copy
          - Restore
        type: string
        x-ms-enum:
          modelAsString: false
          name: DiskCreateOption
      imageReference:
        $ref: "#/definitions/ImageDiskReference"
        description: Disk source information.
      sourceResourceId:
        description: If createOption is Copy, this is the ARM id of the source snapshot or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point.
        type: string
      sourceUri:
        description: If createOption is Import, this is a SAS URI to a blob to be imported into a managed disk. If createOption is Copy, this is a relative Uri containing the id of the source snapshot to be copied into a managed disk.
        type: string
      storageAccountId:
        description: If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription
        type: string
    required:
      - createOption
  Disk:
    allOf:
      - $ref: "#/definitions/Resource"
    description: Disk resource.
    properties:
      properties:
        $ref: "#/definitions/DiskProperties"
        x-ms-client-flatten: true
  DiskList:
    description: The List Disks operation response.
    properties:
      nextLink:
        description: the uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks.
        type: string
      value:
        description: A list of disks.
        items:
          $ref: "#/definitions/Disk"
        type: array
    required:
      - value
  DiskProperties:
    description: Disk resource properties.
    properties:
      accountType:
        description: the storage account type of the disk.
        enum:
          - Standard_LRS
          - Premium_LRS
        type: string
        x-ms-enum:
          modelAsString: false
          name: StorageAccountTypes
      creationData:
        $ref: "#/definitions/CreationData"
        description: Disk source information. CreationData information cannot be changed after the disk has been created.
      diskSizeGB:
        description: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
        format: int32
        type: integer
      encryptionSettings:
        $ref: "#/definitions/EncryptionSettings"
        description: Encryption settings for disk or snapshot
      osType:
        description: The Operating System type.
        enum:
          - Windows
          - Linux
        type: string
        x-ms-enum:
          modelAsString: false
          name: OperatingSystemTypes
      ownerId:
        description: A relative URI containing the VM id that has the disk attached.
        readOnly: true
        type: string
      provisioningState:
        description: The disk provisioning state.
        readOnly: true
        type: string
      timeCreated:
        description: The time when the disk was created.
        format: date-time
        readOnly: true
        type: string
    required:
      - creationData
  DiskUpdate:
    allOf:
      - $ref: "#/definitions/ResourceUpdate"
    description: Disk update resource.
    properties:
      properties:
        $ref: "#/definitions/DiskUpdateProperties"
        x-ms-client-flatten: true
  DiskUpdateProperties:
    description: Disk resource update properties.
    properties:
      accountType:
        description: the storage account type of the disk.
        enum:
          - Standard_LRS
          - Premium_LRS
        type: string
        x-ms-enum:
          modelAsString: false
          name: StorageAccountTypes
      creationData:
        $ref: "#/definitions/CreationData"
        description: disk source information. CreationData information cannot be changed after the disk has been created.
      diskSizeGB:
        description: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
        format: int32
        type: integer
      encryptionSettings:
        $ref: "#/definitions/EncryptionSettings"
        description: Encryption settings for disk or snapshot
      osType:
        description: the Operating System type.
        enum:
          - Windows
          - Linux
        type: string
        x-ms-enum:
          modelAsString: false
          name: OperatingSystemTypes
  EncryptionSettings:
    description: Encryption settings for disk or snapshot
    properties:
      diskEncryptionKey:
        $ref: "#/definitions/KeyVaultAndSecretReference"
        description: Key Vault Secret Url and vault id of the disk encryption key
      enabled:
        description: Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.
        type: boolean
      keyEncryptionKey:
        $ref: "#/definitions/KeyVaultAndKeyReference"
        description: Key Vault Key Url and vault id of the key encryption key
  GrantAccessData:
    description: Data used for requesting a SAS.
    properties:
      access:
        enum:
          - None
          - Read
        type: string
        x-ms-enum:
          modelAsString: false
          name: AccessLevel
      durationInSeconds:
        description: Time duration in seconds until the SAS access expires.
        format: int32
        type: integer
    required:
      - access
      - durationInSeconds
  ImageDiskReference:
    description: The source image used for creating the disk.
    properties:
      id:
        description: A relative uri containing either a Platform Image Repository or user image reference.
        type: string
      lun:
        description: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.
        format: int32
        type: integer
    required:
      - id
  InnerError:
    description: Inner error details.
    properties:
      errordetail:
        description: The internal error message or exception dump.
        type: string
      exceptiontype:
        description: The exception type.
        type: string
  KeyVaultAndKeyReference:
    description: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey
    properties:
      keyUrl:
        description: Url pointing to a key or secret in KeyVault
        type: string
      sourceVault:
        $ref: "#/definitions/SourceVault"
        description: Resource id of the KeyVault containing the key or secret
    required:
      - keyUrl
      - sourceVault
  KeyVaultAndSecretReference:
    description: "Key Vault Secret Url and vault id of the encryption key "
    properties:
      secretUrl:
        description: Url pointing to a key or secret in KeyVault
        type: string
      sourceVault:
        $ref: "#/definitions/SourceVault"
        description: Resource id of the KeyVault containing the key or secret
    required:
      - secretUrl
      - sourceVault
  OperationStatusResponse:
    description: Operation status response
    properties:
      endTime:
        description: End time of the operation
        format: date-time
        readOnly: true
        type: string
      error:
        $ref: "#/definitions/ApiError"
        description: Api error
        readOnly: true
      name:
        description: Operation ID
        readOnly: true
        type: string
      startTime:
        description: Start time of the operation
        format: date-time
        readOnly: true
        type: string
      status:
        description: Operation status
        readOnly: true
        type: string
  Resource:
    description: The Resource model definition.
    properties:
      id:
        description: Resource Id
        readOnly: true
        type: string
      location:
        description: Resource location
        type: string
      name:
        description: Resource name
        readOnly: true
        type: string
      tags:
        additionalProperties:
          type: string
        description: Resource tags
        type: object
      type:
        description: Resource type
        readOnly: true
        type: string
    required:
      - location
    x-ms-azure-resource: true
  ResourceUpdate:
    description: The Resource model definition.
    properties:
      tags:
        additionalProperties:
          type: string
        description: Resource tags
        type: object
  Snapshot:
    allOf:
      - $ref: "#/definitions/Resource"
    description: Snapshot resource.
    properties:
      properties:
        $ref: "#/definitions/DiskProperties"
        x-ms-client-flatten: true
  SnapshotList:
    description: The List Snapshots operation response.
    properties:
      nextLink:
        description: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots.
        type: string
      value:
        description: A list of snapshots.
        items:
          $ref: "#/definitions/Snapshot"
        type: array
    required:
      - value
  SnapshotUpdate:
    allOf:
      - $ref: "#/definitions/ResourceUpdate"
    description: Snapshot update resource.
    properties:
      properties:
        $ref: "#/definitions/DiskUpdateProperties"
        x-ms-client-flatten: true
  SourceVault:
    description: The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
    properties:
      id:
        description: Resource Id
        type: string
