swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Azure SQL Database management API provides a RESTful set of web APIs that interact with Azure SQL Database services to manage your databases. The API enables users to create, retrieve, update, and delete databases, servers, and other entities.
  title: SqlManagementClient
  version: 2017-03-01-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/sql/resource-manager/Microsoft.Sql/preview/2017-03-01-preview/longTermRetention.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-longTermRetention
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
parameters:
  ApiVersionParameter:
    description: The API version to use for the request.
    in: query
    name: api-version
    required: true
    type: string
    x-ms-parameter-location: client
  BlobAuditingPolicyNameParameter:
    description: The name of the blob auditing policy.
    enum:
      - default
    in: path
    name: blobAuditingPolicyName
    required: true
    type: string
    x-ms-parameter-location: method
  DatabaseNameParameter:
    description: The name of the database.
    in: path
    name: databaseName
    required: true
    type: string
    x-ms-parameter-location: method
  LongTermRetentionDatabaseStateParameter:
    description: Whether to query against just live databases, just deleted databases, or all databases.
    enum:
      - All
      - Live
      - Deleted
    in: query
    name: databaseState
    required: false
    type: string
    x-ms-enum:
      modelAsString: true
      name: longTermRetentionDatabaseState
    x-ms-parameter-location: method
  ManagedInstanceNameParameter:
    description: The name of the managed instance.
    in: path
    name: managedInstanceName
    required: true
    type: string
    x-ms-parameter-location: method
  ResourceGroupParameter:
    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.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  ServerNameParameter:
    description: The name of the server.
    in: path
    name: serverName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineContainerNameParameter:
    description: The name of the SqlVirtualMachineContainer.
    in: path
    name: sqlVirtualMachineContainerName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineInstanceNameParameter:
    description: The name of the SqlVirtualMachineInstance.
    in: path
    name: sqlVirtualMachineInstanceName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The subscription ID that identifies an Azure subscription.
    in: path
    name: subscriptionId
    required: true
    type: string
    x-ms-parameter-location: client
  VirtualClusterNameParameter:
    description: The name of the virtual cluster.
    in: path
    name: virtualClusterName
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups":
    get:
      description: Lists the long term retention backups for a given location.
      operationId: LongTermRetentionBackups_ListByLocation
      parameters:
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: Whether or not to only get the latest backup for each database.
          in: query
          name: onlyLatestPerDatabase
          required: false
          type: boolean
        - $ref: "#/parameters/LongTermRetentionDatabaseStateParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of backups.
          schema:
            $ref: "#/definitions/LongTermRetentionBackupListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get all long term retention backups under the location.:
          parameters:
            api-version: 2017-03-01
            locationName: japaneast
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver1/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000
                    name: 55555555-6666-7777-8888-999999999999;2017-08-23T08:00:00.000Z
                    properties:
                      backupTime: 2017-08-23T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase1
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver1
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver2/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000
                    name: 12341234-1234-1234-1234-123123123123;2017-08-30T08:00:00.000Z
                    properties:
                      backupTime: 2017-08-30T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase2
                      serverCreateTime: 2017-04-10T08:00:00.000Z
                      serverName: testserver2
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver3/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000
                    name: 43214321-4321-4321-4321-321321321321;2017-09-06T08:00:00.000Z
                    properties:
                      backupTime: 2017-09-06T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase3
                      serverCreateTime: 2017-05-10T08:00:00.000Z
                      serverName: testserver3
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups":
    get:
      description: Lists the long term retention backups for a given server.
      operationId: LongTermRetentionBackups_ListByServer
      parameters:
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: Whether or not to only get the latest backup for each database.
          in: query
          name: onlyLatestPerDatabase
          required: false
          type: boolean
        - $ref: "#/parameters/LongTermRetentionDatabaseStateParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of backups.
          schema:
            $ref: "#/definitions/LongTermRetentionBackupListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get all long term retention backups under the server.:
          parameters:
            api-version: 2017-03-01
            locationName: japaneast
            longTermRetentionServerName: testserver
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000
                    name: 55555555-6666-7777-8888-999999999999;131637960820000000
                    properties:
                      backupTime: 2017-08-23T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase1
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000
                    name: 12341234-1234-1234-1234-123123123123;131657960820000000
                    properties:
                      backupTime: 2017-08-30T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase2
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000
                    name: 43214321-4321-4321-4321-321321321321;131667960820000000
                    properties:
                      backupTime: 2017-09-06T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase3
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups":
    get:
      description: Lists all long term retention backups for a database.
      operationId: LongTermRetentionBackups_ListByDatabase
      parameters:
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: The name of the database
          in: path
          name: longTermRetentionDatabaseName
          required: true
          type: string
        - description: Whether or not to only get the latest backup for each database.
          in: query
          name: onlyLatestPerDatabase
          required: false
          type: boolean
        - $ref: "#/parameters/LongTermRetentionDatabaseStateParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of backups.
          schema:
            $ref: "#/definitions/LongTermRetentionBackupListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get all long term retention backups under the database.:
          parameters:
            api-version: 2017-03-01
            locationName: japaneast
            longTermRetentionDatabaseName: testDatabase
            longTermRetentionServerName: testserver
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000
                    name: 55555555-6666-7777-8888-999999999999;131637960820000000
                    properties:
                      backupTime: 2017-08-23T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131657960820000000
                    name: 55555555-6666-7777-8888-999999999999;131657960820000000
                    properties:
                      backupTime: 2017-08-30T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131677960820000000
                    name: 55555555-6666-7777-8888-999999999999;131677960820000000
                    properties:
                      backupTime: 2017-09-06T08:00:00.000Z
                      databaseDeletionTime: 2017-09-07T08:00:00.000Z
                      databaseName: testDatabase
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}":
    delete:
      description: Deletes a long term retention backup.
      operationId: LongTermRetentionBackups_Delete
      parameters:
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: The name of the database
          in: path
          name: longTermRetentionDatabaseName
          required: true
          type: string
        - description: The backup name.
          in: path
          name: backupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the backup.
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidLongTermRetentionBackupId - Invalid long term retention backup identifier.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Delete the long term retention backup.:
          parameters:
            api-version: 2017-03-01-preview
            backupName: 55555555-6666-7777-8888-999999999999;131637960820000000
            locationName: japaneast
            longTermRetentionDatabaseName: testDatabase
            longTermRetentionServerName: testserver
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "202": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a long term retention backup.
      operationId: LongTermRetentionBackups_Get
      parameters:
        - description: The location of the database.
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: The name of the database
          in: path
          name: longTermRetentionDatabaseName
          required: true
          type: string
        - description: The backup name.
          in: path
          name: backupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the backup.
          schema:
            $ref: "#/definitions/LongTermRetentionBackup"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidLongTermRetentionBackupId - Invalid long term retention backup identifier.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get the long term retention backup.:
          parameters:
            api-version: 2017-03-01
            backupName: 55555555-6666-7777-8888-999999999999;131637960820000000
            locationName: japaneast
            longTermRetentionDatabaseName: testDatabase
            longTermRetentionServerName: testserver
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2017-09-06T08:00:00.000Z
                name: 2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;131637960820000000
                properties:
                  backupTime: 2017-09-06T08:00:00.000Z
                  databaseDeletionTime: null
                  databaseName: testDatabase
                  serverCreateTime: 2017-03-10T08:00:00.000Z
                  serverName: testserver
                type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups":
    get:
      description: Lists the long term retention backups for a given location.
      operationId: LongTermRetentionBackups_ListByResourceGroupLocation
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: Whether or not to only get the latest backup for each database.
          in: query
          name: onlyLatestPerDatabase
          required: false
          type: boolean
        - $ref: "#/parameters/LongTermRetentionDatabaseStateParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of backups.
          schema:
            $ref: "#/definitions/LongTermRetentionBackupListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get all long term retention backups under the location.:
          parameters:
            api-version: 2017-03-01
            locationName: japaneast
            resourceGroupName: testResourceGroup
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver1/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000
                    name: 55555555-6666-7777-8888-999999999999;2017-08-23T08:00:00.000Z
                    properties:
                      backupTime: 2017-08-23T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase1
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver1
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver2/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000
                    name: 12341234-1234-1234-1234-123123123123;2017-08-30T08:00:00.000Z
                    properties:
                      backupTime: 2017-08-30T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase2
                      serverCreateTime: 2017-04-10T08:00:00.000Z
                      serverName: testserver2
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver3/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000
                    name: 43214321-4321-4321-4321-321321321321;2017-09-06T08:00:00.000Z
                    properties:
                      backupTime: 2017-09-06T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase3
                      serverCreateTime: 2017-05-10T08:00:00.000Z
                      serverName: testserver3
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups":
    get:
      description: Lists the long term retention backups for a given server.
      operationId: LongTermRetentionBackups_ListByResourceGroupServer
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: Whether or not to only get the latest backup for each database.
          in: query
          name: onlyLatestPerDatabase
          required: false
          type: boolean
        - $ref: "#/parameters/LongTermRetentionDatabaseStateParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of backups.
          schema:
            $ref: "#/definitions/LongTermRetentionBackupListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get all long term retention backups under the server.:
          parameters:
            api-version: 2017-03-01
            locationName: japaneast
            longTermRetentionServerName: testserver
            resourceGroupName: testResourceGroup
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000
                    name: 55555555-6666-7777-8888-999999999999;131637960820000000
                    properties:
                      backupTime: 2017-08-23T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase1
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000
                    name: 12341234-1234-1234-1234-123123123123;131657960820000000
                    properties:
                      backupTime: 2017-08-30T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase2
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000
                    name: 43214321-4321-4321-4321-321321321321;131667960820000000
                    properties:
                      backupTime: 2017-09-06T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase3
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups":
    get:
      description: Lists all long term retention backups for a database.
      operationId: LongTermRetentionBackups_ListByResourceGroupDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: The name of the database
          in: path
          name: longTermRetentionDatabaseName
          required: true
          type: string
        - description: Whether or not to only get the latest backup for each database.
          in: query
          name: onlyLatestPerDatabase
          required: false
          type: boolean
        - $ref: "#/parameters/LongTermRetentionDatabaseStateParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of backups.
          schema:
            $ref: "#/definitions/LongTermRetentionBackupListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get all long term retention backups under the database.:
          parameters:
            api-version: 2017-03-01
            locationName: japaneast
            longTermRetentionDatabaseName: testDatabase
            longTermRetentionServerName: testserver
            resourceGroupName: testResourceGroup
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000
                    name: 55555555-6666-7777-8888-999999999999;131637960820000000
                    properties:
                      backupTime: 2017-08-23T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131657960820000000
                    name: 55555555-6666-7777-8888-999999999999;131657960820000000
                    properties:
                      backupTime: 2017-08-30T08:00:00.000Z
                      databaseDeletionTime: null
                      databaseName: testDatabase
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131677960820000000
                    name: 55555555-6666-7777-8888-999999999999;131677960820000000
                    properties:
                      backupTime: 2017-09-06T08:00:00.000Z
                      databaseDeletionTime: 2017-09-07T08:00:00.000Z
                      databaseName: testDatabase
                      serverCreateTime: 2017-03-10T08:00:00.000Z
                      serverName: testserver
                    type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}":
    delete:
      description: Deletes a long term retention backup.
      operationId: LongTermRetentionBackups_DeleteByResourceGroup
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The location of the database
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: The name of the database
          in: path
          name: longTermRetentionDatabaseName
          required: true
          type: string
        - description: The backup name.
          in: path
          name: backupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the backup.
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidLongTermRetentionBackupId - Invalid long term retention backup identifier.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Delete the long term retention backup.:
          parameters:
            api-version: 2017-03-01-preview
            backupName: 55555555-6666-7777-8888-999999999999;131637960820000000
            locationName: japaneast
            longTermRetentionDatabaseName: testDatabase
            longTermRetentionServerName: testserver
            resourceGroupName: testResourceGroup
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "202": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a long term retention backup.
      operationId: LongTermRetentionBackups_GetByResourceGroup
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The location of the database.
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the server
          in: path
          name: longTermRetentionServerName
          required: true
          type: string
        - description: The name of the database
          in: path
          name: longTermRetentionDatabaseName
          required: true
          type: string
        - description: The backup name.
          in: path
          name: backupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the backup.
          schema:
            $ref: "#/definitions/LongTermRetentionBackup"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidLongTermRetentionBackupId - Invalid long term retention backup identifier.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - LongTermRetentionBackups
      x-ms-examples:
        Get the long term retention backup.:
          parameters:
            api-version: 2017-03-01
            backupName: 55555555-6666-7777-8888-999999999999;131637960820000000
            locationName: japaneast
            longTermRetentionDatabaseName: testDatabase
            longTermRetentionServerName: testserver
            resourceGroupName: testResourceGroup
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2017-09-06T08:00:00.000Z
                name: 2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;131637960820000000
                properties:
                  backupTime: 2017-09-06T08:00:00.000Z
                  databaseDeletionTime: null
                  databaseName: testDatabase
                  serverCreateTime: 2017-03-10T08:00:00.000Z
                  serverName: testserver
                type: Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies":
    get:
      description: Gets a database's long term retention policy.
      operationId: BackupLongTermRetentionPolicies_ListByDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully get the policy.
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - BackupLongTermRetentionPolicies
      x-ms-examples:
        Get the long term retention policy for the database.:
          parameters:
            api-version: 2017-03-01
            databaseName: testDatabase
            policyName: default
            resourceGroupName: resourceGroup
            serverName: testserver
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver/databases/testDatabase/backupLongTermRetentionPolicies/default
                name: default
                properties:
                  monthlyRetention: P1Y
                  weekOfYear: 5
                  weeklyRetention: P1M
                  yearlyRetention: P5Y
                type: Microsoft.Sql/resourceGroups/servers/databases/backupLongTermRetentionPolicies
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}":
    get:
      description: Gets a database's long term retention policy.
      operationId: BackupLongTermRetentionPolicies_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The policy name. Should always be Default.
          enum:
            - default
          in: path
          name: policyName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: LongTermRetentionPolicyName
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully get the policy.
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - BackupLongTermRetentionPolicies
      x-ms-examples:
        Get the long term retention policy for the database.:
          parameters:
            api-version: 2017-03-01
            databaseName: testDatabase
            policyName: default
            resourceGroupName: resourceGroup
            serverName: testserver
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver/databases/testDatabase/backupLongTermRetentionPolicies/default
                name: default
                properties:
                  monthlyRetention: P1Y
                  weekOfYear: 5
                  weeklyRetention: P1M
                  yearlyRetention: P5Y
                type: Microsoft.Sql/resourceGroups/servers/databases/backupLongTermRetentionPolicies
    put:
      description: Sets a database's long term retention policy.
      operationId: BackupLongTermRetentionPolicies_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The policy name. Should always be Default.
          enum:
            - default
          in: path
          name: policyName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: LongTermRetentionPolicyName
        - description: The long term retention policy info.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully set the policy.
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidParameterValue - An invalid value was given to a parameter.

             * 400 LongTermRetentionPolicyNotSupported - Long Term Retention is not supported on this database.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - BackupLongTermRetentionPolicies
      x-ms-examples:
        Create or update the long term retention policy for the database.:
          parameters:
            api-version: 2017-03-01
            databaseName: testDatabase
            parameters:
              properties:
                monthlyRetention: P1Y
                weekOfYear: 5
                weeklyRetention: P1M
                yearlyRetention: P5Y
            policyName: default
            resourceGroupName: resourceGroup
            serverName: testserver
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver/databases/testDatabase/backupLongTermRetentionPolicies/default
                name: default
                properties:
                  monthlyRetention: P1Y
                  weekOfYear: 5
                  weeklyRetention: P1M
                  yearlyRetention: P5Y
                type: Microsoft.Sql/resourceGroups/servers/databases/backupLongTermRetentionPolicies
            "202": {}
      x-ms-long-running-operation: true
definitions:
  BackupLongTermRetentionPolicy:
    allOf:
      - allOf:
          - description: ARM resource.
            properties:
              id:
                description: Resource ID.
                readOnly: true
                type: string
              name:
                description: Resource name.
                readOnly: true
                type: string
              type:
                description: Resource type.
                readOnly: true
                type: string
            type: object
            x-ms-azure-resource: true
        description: ARM proxy resource.
        properties: {}
        type: object
    description: A long term retention policy.
    properties:
      properties:
        $ref: "#/definitions/LongTermRetentionPolicyProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  LongTermRetentionBackup:
    allOf:
      - allOf:
          - description: ARM resource.
            properties:
              id:
                description: Resource ID.
                readOnly: true
                type: string
              name:
                description: Resource name.
                readOnly: true
                type: string
              type:
                description: Resource type.
                readOnly: true
                type: string
            type: object
            x-ms-azure-resource: true
        description: ARM proxy resource.
        properties: {}
        type: object
    description: A long term retention backup.
    properties:
      properties:
        $ref: "#/definitions/LongTermRetentionBackupProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  LongTermRetentionBackupListResult:
    description: A list of long term retention backups.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/LongTermRetentionBackup"
        readOnly: true
        type: array
    type: object
  LongTermRetentionBackupProperties:
    description: Properties of a long term retention backup
    properties:
      backupExpirationTime:
        description: The time the long term retention backup will expire.
        format: date-time
        readOnly: true
        type: string
      backupTime:
        description: The time the backup was taken
        format: date-time
        readOnly: true
        type: string
      databaseDeletionTime:
        description: The delete time of the database
        format: date-time
        readOnly: true
        type: string
      databaseName:
        description: The name of the database the backup belong to
        readOnly: true
        type: string
      serverCreateTime:
        description: The create time of the server.
        format: date-time
        readOnly: true
        type: string
      serverName:
        description: The server name that the backup database belong to.
        readOnly: true
        type: string
    type: object
  LongTermRetentionPolicyProperties:
    description: Properties of a long term retention policy
    properties:
      monthlyRetention:
        description: The monthly retention policy for an LTR backup in an ISO 8601 format.
        type: string
      weekOfYear:
        description: The week of year to take the yearly backup in an ISO 8601 format.
        format: int32
        type: integer
      weeklyRetention:
        description: The weekly retention policy for an LTR backup in an ISO 8601 format.
        type: string
      yearlyRetention:
        description: The yearly retention policy for an LTR backup in an ISO 8601 format.
        type: string
    type: object
