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/renameDatabase.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-renameDatabase
  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
  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/servers/{serverName}/databases/{databaseName}/move":
    post:
      description: Renames a database.
      operationId: Databases_Rename
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database to rename.
          in: path
          name: databaseName
          required: true
          type: string
        - description: The resource move definition for renaming this database.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ResourceMoveDefinition"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully renamed the database.
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidResourceMoveRequest - The resource move request is invalid.

             * 400 InvalidMoveTargetResourceId - The target resource identifier in move request is invalid.

             * 400 MismatchingSubscriptionWithUrl - The provided subscription did not match the subscription in the Url.

             * 400 MismatchingResourceGroupNameWithUrl - The provided resource group name did not match the name in the Url.

             * 400 MismatchingServerNameWithUrl - The provided server name did not match the name in the Url.

             * 400 UnsupportedServiceName - The specified name is an invalid name because it contains one or more unsupported unicode characters.

             * 400 CannotMoveOrDropSyncMetadataDatabase - Cannot drop database used as sync metadata database.

             * 400 InvalidIdentifier - The identifier contains NULL or an invalid unicode character.

             * 400 TokenTooLong - The provided token is too long.

             * 400 CannotMoveOrDropJobAccountDatabase - Cannot drop database associated with job account.

             * 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

             * 404 SourceDatabaseNotFound - The source database does not exist.
      tags:
        - Databases
      x-ms-examples:
        Renames a database.:
          parameters:
            api-version: 2017-03-01-preview
            databaseName: testdb
            parameters:
              id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/newtestdb
            resourceGroupName: Default-SQL-SouthEastAsia
            serverName: testsvr
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
definitions:
  ResourceMoveDefinition:
    description: Contains the information necessary to perform a resource move (rename).
    properties:
      id:
        description: The target ID for the resource
        type: string
    required:
      - id
    type: object
