swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Provides read and update functionality for Azure SQL Database backup long term retention policy
  title: Azure SQL Database Backup Long Term Retention Policy
  version: 2014-04-01
  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/stable/2014-04-01/backupLongTermRetentionPolicies.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-backupLongTermRetentionPolicies
  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:
  ServerNameParameter:
    description: The name of the server.
    in: path
    name: serverName
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies":
    get:
      description: Returns a database backup long term retention policy
      operationId: BackupLongTermRetentionPolicies_ListByDatabase
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database.
          in: path
          name: databaseName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicyListResult"
      tags:
        - BackupLongTermRetentionPolicies
      x-ms-examples:
        Get backup long term retention policy:
          parameters:
            api-version: 2014-04-01
            backupLongTermRetentionPolicyName: Default
            databaseName: longtermretentiontest-9012
            resourceGroupName: longtermretentiontest-1234
            serverName: longtermretentiontest-5678
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentiontest-1234/providers/Microsoft.Sql/servers/longtermretentiontest-5678/databases/longtermretentiontest-9012/backupLongTermRetentionPolicies/Default
                    location: Japan East
                    name: Default
                    properties:
                      recoveryServicesBackupPolicyResourceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentionvaulttest-1234/providers/Microsoft.RecoveryServices/vaults/testVaultabc/backupPolicies/testPolicyxyz
                      state: Enabled
                    type: Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}":
    get:
      description: Returns a database backup long term retention policy
      operationId: BackupLongTermRetentionPolicies_Get
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database.
          in: path
          name: databaseName
          required: true
          type: string
        - description: The name of the backup long term retention policy
          enum:
            - Default
          in: path
          name: backupLongTermRetentionPolicyName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: BackupLongTermRetentionPolicyName
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
      tags:
        - BackupLongTermRetentionPolicies
      x-ms-examples:
        Get backup long term retention policy:
          parameters:
            api-version: 2014-04-01
            backupLongTermRetentionPolicyName: Default
            databaseName: longtermretentiontest-9012
            resourceGroupName: longtermretentiontest-1234
            serverName: longtermretentiontest-5678
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentiontest-1234/providers/Microsoft.Sql/servers/longtermretentiontest-5678/databases/longtermretentiontest-9012/backupLongTermRetentionPolicies/Default
                location: Japan East
                name: Default
                properties:
                  recoveryServicesBackupPolicyResourceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentionvaulttest-1234/providers/Microsoft.RecoveryServices/vaults/testVaultabc/backupPolicies/testPolicyxyz
                  state: Enabled
                type: Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies
    put:
      description: Creates or updates a database backup long term retention policy
      operationId: BackupLongTermRetentionPolicies_CreateOrUpdate
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database
          in: path
          name: databaseName
          required: true
          type: string
        - description: The name of the backup long term retention policy
          enum:
            - Default
          in: path
          name: backupLongTermRetentionPolicyName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: BackupLongTermRetentionPolicyName
        - description: The required parameters to update a backup long term retention policy
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
        "201":
          description: Created
          schema:
            $ref: "#/definitions/BackupLongTermRetentionPolicy"
        "202":
          description: Accepted
      tags:
        - BackupLongTermRetentionPolicies
      x-ms-examples:
        Update backup long term retention policy:
          parameters:
            api-version: 2014-04-01
            backupLongTermRetentionPolicyName: Default
            databaseName: longtermretentiontest-9012
            parameters:
              location: Japan East
              properties:
                recoveryServicesBackupPolicyResourceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentionvaulttest-1234/providers/Microsoft.RecoveryServices/vaults/testVaultabc/backupPolicies/testPolicyxyz
                state: Enabled
            resourceGroupName: longtermretentiontest-1234
            serverName: longtermretentiontest-5678
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentiontest-1234/providers/Microsoft.Sql/servers/longtermretentiontest-5678/databases/longtermretentiontest-9012/backupLongTermRetentionPolicies/Default
                location: Japan East
                name: Default
                properties:
                  recoveryServicesBackupPolicyResourceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentionvaulttest-1234/providers/Microsoft.RecoveryServices/vaults/testVaultabc/backupPolicies/testPolicyxyz
                  state: Enabled
                type: Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentiontest-1234/providers/Microsoft.Sql/servers/longtermretentiontest-5678/databases/longtermretentiontest-9012/backupLongTermRetentionPolicies/Default
                location: Japan East
                name: Default
                properties:
                  recoveryServicesBackupPolicyResourceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/longtermretentionvaulttest-1234/providers/Microsoft.RecoveryServices/vaults/testVaultabc/backupPolicies/testPolicyxyz
                  state: Enabled
                type: Microsoft.Sql/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 backup long term retention policy
    properties:
      location:
        description: The geo-location where the resource lives
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/BackupLongTermRetentionPolicyProperties"
        description: The properties of the backup long term retention policy
        x-ms-client-flatten: true
  BackupLongTermRetentionPolicyListResult:
    description: Represents the response to a list long-term retention policies request.
    properties:
      value:
        description: The list of long-term retention policies in the database.
        items:
          $ref: "#/definitions/BackupLongTermRetentionPolicy"
        type: array
    required:
      - value
  BackupLongTermRetentionPolicyProperties:
    description: The properties of a backup long term retention policy
    properties:
      recoveryServicesBackupPolicyResourceId:
        description: The azure recovery services backup protection policy resource id
        type: string
      state:
        description: The status of the backup long term retention policy
        enum:
          - Disabled
          - Enabled
        type: string
        x-ms-enum:
          name: BackupLongTermRetentionPolicyState
    required:
      - state
      - recoveryServicesBackupPolicyResourceId
