swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Provides read, delete, and failover functionality for Azure SQL Database replication links.
  title: Azure SQL Database replication links
  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/replicationLinks.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-replicationLinks
  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}/replicationLinks":
    get:
      description: Lists a database's replication links.
      operationId: ReplicationLinks_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 to retrieve links for.
          in: path
          name: databaseName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ReplicationLinkListResult"
      tags:
        - DatabaseReplicationLinks
      x-ms-examples:
        List Replication links:
          parameters:
            api-version: 2014-04-01
            databaseName: testdb
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/databases/testdb/replicationLinks/5b301b68-03f6-4b26-b0f4-73ebb8634238
                    location: Japan East
                    name: 5b301b68-03f6-4b26-b0f4-73ebb8634238
                    properties:
                      isTerminationAllowed: true
                      partnerDatabase: testdb
                      partnerLocation: Japan East
                      partnerRole: Primary
                      partnerServer: sqlcrudtest-5961
                      percentComplete: 100
                      replicationMode: ASYNC
                      replicationState: CATCH_UP
                      role: Secondary
                      startTime: 2017-02-10T01:44:27.117
                    type: Microsoft.Sql/servers/databases/replicationLinks
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}":
    delete:
      description: Deletes a database replication link. Cannot be done during failover.
      operationId: ReplicationLinks_Delete
      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 that has the replication link to be dropped.
          in: path
          name: databaseName
          required: true
          type: string
        - description: The ID of the replication link to be deleted.
          in: path
          name: linkId
          required: true
          type: string
      responses:
        "200":
          description: OK
        "204":
          description: NoContent
      tags:
        - DatabaseReplicationLinks
      x-ms-examples:
        Delete a replication link:
          parameters:
            api-version: 2014-04-01
            databaseName: testdb
            linkId: 5b301b68-03f6-4b26-b0f4-73ebb8634238
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets a database replication link.
      operationId: ReplicationLinks_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 to get the link for.
          in: path
          name: databaseName
          required: true
          type: string
        - description: The replication link ID to be retrieved.
          in: path
          name: linkId
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ReplicationLink"
      tags:
        - DatabaseReplicationLinks
      x-ms-examples:
        Get a replication link:
          parameters:
            api-version: 2014-04-01
            databaseName: testdb
            linkId: f0550bf5-07ce-4270-8e4b-71737975973a
            resourceGroupName: sqlcrudtest-8931
            serverName: sqlcrudtest-2137
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-8931/providers/Microsoft.Sql/servers/sqlcrudtest-2137/databases/testdb/replicationLinks/f0550bf5-07ce-4270-8e4b-71737975973a
                location: Japan East
                name: f0550bf5-07ce-4270-8e4b-71737975973a
                properties:
                  isTerminationAllowed: true
                  partnerDatabase: testdb
                  partnerLocation: Japan East
                  partnerRole: Primary
                  partnerServer: sqlcrudtest-1932
                  percentComplete: 100
                  replicationMode: ASYNC
                  replicationState: CATCH_UP
                  role: Secondary
                  startTime: 2017-02-10T01:37:49.153
                type: Microsoft.Sql/servers/databases/replicationLinks
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover":
    post:
      description: Sets which replica database is primary by failing over from the current primary replica database.
      operationId: ReplicationLinks_Failover
      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 that has the replication link to be failed over.
          in: path
          name: databaseName
          required: true
          type: string
        - description: The ID of the replication link to be failed over.
          in: path
          name: linkId
          required: true
          type: string
      responses:
        "202":
          description: Accepted
        "204":
          description: No Content
      tags:
        - DatabaseReplicationLinks
      x-ms-examples:
        Failover a replication link:
          parameters:
            api-version: 2014-04-01
            databaseName: testdb
            linkId: f0550bf5-07ce-4270-8e4b-71737975973a
            resourceGroupName: sqlcrudtest-8931
            serverName: sqlcrudtest-2137
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss":
    post:
      description: Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss.
      operationId: ReplicationLinks_FailoverAllowDataLoss
      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 that has the replication link to be failed over.
          in: path
          name: databaseName
          required: true
          type: string
        - description: The ID of the replication link to be failed over.
          in: path
          name: linkId
          required: true
          type: string
      responses:
        "202":
          description: Accepted
        "204":
          description: No Content
      tags:
        - DatabaseReplicationLinks
      x-ms-examples:
        Failover a replication link:
          parameters:
            api-version: 2014-04-01
            databaseName: testdb
            linkId: f0550bf5-07ce-4270-8e4b-71737975973a
            resourceGroupName: sqlcrudtest-8931
            serverName: sqlcrudtest-2137
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
definitions:
  ReplicationLink:
    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: Represents a database replication link.
    properties:
      location:
        description: Location of the server that contains this firewall rule.
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/ReplicationLinkProperties"
        description: The properties representing the resource.
        x-ms-client-flatten: true
      type:
        description: Type of resource this is.
        readOnly: true
        type: string
  ReplicationLinkListResult:
    description: Represents the response to a List database replication link request.
    properties:
      value:
        description: The list of database replication links housed in the database.
        items:
          $ref: "#/definitions/ReplicationLink"
        type: array
  ReplicationLinkProperties:
    description: Represents the properties of a database replication link.
    properties:
      isTerminationAllowed:
        description: Legacy value indicating whether termination is allowed.  Currently always returns true.
        readOnly: true
        type: boolean
      partnerDatabase:
        description: The name of the partner database.
        readOnly: true
        type: string
      partnerLocation:
        description: The Azure Region of the partner database.
        readOnly: true
        type: string
      partnerRole:
        description: The role of the partner database in the replication link.
        enum:
          - Primary
          - Secondary
          - NonReadableSecondary
          - Source
          - Copy
        readOnly: true
        type: string
        x-ms-enum:
          name: ReplicationRole
      partnerServer:
        description: The name of the server hosting the partner database.
        readOnly: true
        type: string
      percentComplete:
        description: The percentage of seeding complete for the replication link.
        format: int32
        readOnly: true
        type: integer
      replicationMode:
        description: Replication mode of this replication link.
        readOnly: true
        type: string
      replicationState:
        description: The replication state for the replication link.
        enum:
          - PENDING
          - SEEDING
          - CATCH_UP
          - SUSPENDED
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: ReplicationState
      role:
        description: The role of the database in the replication link.
        enum:
          - Primary
          - Secondary
          - NonReadableSecondary
          - Source
          - Copy
        readOnly: true
        type: string
        x-ms-enum:
          name: ReplicationRole
      startTime:
        description: The start time for the replication link.
        format: date-time
        readOnly: true
        type: string
