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/ManagedRestorableDroppedDatabaseBackupShortTermRetenion.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-ManagedRestorableDroppedDatabaseBackupShortTermRetenion
  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
  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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies":
    get:
      description: Gets a dropped database's short term retention policy list.
      operationId: ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_ListByRestorableDroppedDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - in: path
          name: restorableDroppedDatabaseId
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the policies.
          schema:
            $ref: "#/definitions/ManagedBackupShortTermRetentionPolicyListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidRestorableDroppedDatabaseDeletionDate - The restorable dropped database deletion date given is invalid

             * 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies
      x-ms-examples:
        Get the short term retention policy list for the database.:
          parameters:
            api-version: 2017-03-01-preview
            managedInstanceName: testsvr
            resourceGroupName: Default-SQL-SouthEastAsia
            restorableDroppedDatabaseId: testdb,131403269876900000
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstance/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default
                    name: default
                    properties:
                      retentionDays: 14
                    type: Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstance/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default
                    name: default
                    properties:
                      retentionDays: 14
                    type: Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}":
    get:
      description: Gets a dropped database's short term retention policy.
      operationId: ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - in: path
          name: restorableDroppedDatabaseId
          required: true
          type: string
        - description: The policy name.
          enum:
            - default
          in: path
          name: policyName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: ManagedShortTermRetentionPolicyName
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the policies.
          schema:
            $ref: "#/definitions/ManagedBackupShortTermRetentionPolicy"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidRestorableDroppedDatabaseDeletionDate - The restorable dropped database deletion date given is invalid

             * 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies
      x-ms-examples:
        Get the short term retention policy for the database.:
          parameters:
            api-version: 2017-03-01-preview
            managedInstanceName: testsvr
            policyName: default
            resourceGroupName: Default-SQL-SouthEastAsia
            restorableDroppedDatabaseId: testdb,131403269876900000
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstance/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default
                name: default
                properties:
                  retentionDays: 14
                type: Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies
    patch:
      description: Sets a database's long term retention policy.
      operationId: ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Update
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - in: path
          name: restorableDroppedDatabaseId
          required: true
          type: string
        - description: The policy name. Should always be "default".
          enum:
            - default
          in: path
          name: policyName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: ManagedShortTermRetentionPolicyName
        - description: The long term retention policy info.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ManagedBackupShortTermRetentionPolicy"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the policy.
          schema:
            $ref: "#/definitions/ManagedBackupShortTermRetentionPolicy"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidRestorableDroppedDatabaseDeletionDate - The restorable dropped database deletion date given is invalid

             * 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

             * 400 InvalidBackupRetentionPeriod - The retention days of {0} is not a valid configuration. Valid backup retention in days must be between {1} and {2}

             * 400 InvalidBackupRetentionDays - The retention days of {0} is not a valid configuration. Valid backup retention must be in 7-day increments (7, 14, 21, etc.)

             * 400 InvalidRestorableDroppedDatabaseDeletionDate - The restorable dropped database deletion date given is invalid

             * 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

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

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 CannotFindObject - Cannot find the object because it does not exist or you do not have permissions

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies
      x-ms-examples:
        Update the short term retention policy for the restorable dropped database.:
          parameters:
            api-version: 2017-03-01-preview
            managedInstanceName: testsvr
            parameters:
              retentionDays: 14
            policyName: default
            resourceGroupName: resourceGroup
            restorableDroppedDatabaseId: testdb,131403269876900000
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup/providers/Microsoft.Sql/managedInstance/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default
                name: default
                properties:
                  retentionDays: 14
                type: Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies
            "202": {}
      x-ms-long-running-operation: true
    put:
      description: Sets a database's long term retention policy.
      operationId: ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - in: path
          name: restorableDroppedDatabaseId
          required: true
          type: string
        - description: The policy name. Should always be "default".
          enum:
            - default
          in: path
          name: policyName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: ManagedShortTermRetentionPolicyName
        - description: The long term retention policy info.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ManagedBackupShortTermRetentionPolicy"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the policy.
          schema:
            $ref: "#/definitions/ManagedBackupShortTermRetentionPolicy"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidRestorableDroppedDatabaseDeletionDate - The restorable dropped database deletion date given is invalid

             * 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

             * 400 InvalidBackupRetentionPeriod - The retention days of {0} is not a valid configuration. Valid backup retention in days must be between {1} and {2}

             * 400 InvalidBackupRetentionDays - The retention days of {0} is not a valid configuration. Valid backup retention must be in 7-day increments (7, 14, 21, etc.)

             * 400 InvalidRestorableDroppedDatabaseDeletionDate - The restorable dropped database deletion date given is invalid

             * 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

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

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 CannotFindObject - Cannot find the object because it does not exist or you do not have permissions

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies
      x-ms-examples:
        Update the short term retention policy for the restorable dropped database.:
          parameters:
            api-version: 2017-03-01-preview
            managedInstanceName: testsvr
            parameters:
              retentionDays: 14
            policyName: default
            resourceGroupName: resourceGroup
            restorableDroppedDatabaseId: testdb,131403269876900000
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup/providers/Microsoft.Sql/managedInstance/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default
                name: default
                properties:
                  retentionDays: 14
                type: Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies
            "202": {}
      x-ms-long-running-operation: true
definitions:
  ManagedBackupShortTermRetentionPolicy:
    allOf:
      - $ref: "#/definitions/ProxyResource"
    description: A short term retention policy.
    properties:
      properties:
        $ref: "#/definitions/ManagedBackupShortTermRetentionPolicyProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  ManagedBackupShortTermRetentionPolicyListResult:
    description: A list of short term retention policies.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/ManagedBackupShortTermRetentionPolicy"
        readOnly: true
        type: array
    type: object
  ManagedBackupShortTermRetentionPolicyProperties:
    description: Properties of a short term retention policy
    properties:
      retentionDays:
        description: The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
        format: int32
        type: integer
    type: object
  ProxyResource:
    allOf:
      - $ref: "#/definitions/Resource"
    description: ARM proxy resource.
    properties: {}
    type: object
  Resource:
    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
