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: 2018-06-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/2018-06-01-preview/sensitivityLabels.json
      version: "2.0"
  x-preferred: true
  x-providerName: azure.com
  x-serviceName: sql-sensitivityLabels
  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/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels":
    get:
      description: Gets the sensitivity labels of a given database
      operationId: SensitivityLabels_ListCurrentByDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: An OData filter expression that filters elements in the collection.
          in: query
          name: $filter
          required: false
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the sensitivity labels.
          schema:
            $ref: "#/definitions/SensitivityLabelListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 SensitivityLabelsInvalidODataQuery - The specified OData query is either not valid or not supported

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.
      tags:
        - SensitivityLabels
      x-ms-examples:
        Gets the current sensitivity labels of a given database:
          parameters:
            api-version: 2017-03-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            sensitivityLabelSource: current
            serverName: myServer
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn3/sensitivityLabels/current
                    name: current
                    properties:
                      informationType: Financial
                      labelName: Sensitive
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn4/sensitivityLabels/current
                    name: current
                    properties:
                      informationType: Email
                      labelName: PII
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
      x-ms-odata: "#/definitions/SensitivityLabel"
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels":
    get:
      description: Gets the sensitivity labels of a given database
      operationId: SensitivityLabels_ListRecommendedByDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: An OData filter expression that filters elements in the collection.
          in: query
          name: $filter
          required: false
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the sensitivity labels.
          schema:
            $ref: "#/definitions/SensitivityLabelListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 SensitivityLabelsInvalidODataQuery - The specified OData query is either not valid or not supported

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.
      tags:
        - SensitivityLabels
      x-ms-examples:
        Gets the recommended sensitivity labels of a given database:
          parameters:
            api-version: 2017-03-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            sensitivityLabelSource: recommended
            serverName: myServer
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/recommended
                    name: recommended
                    properties:
                      informationType: Financial
                      labelName: Sensitive
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn2/sensitivityLabels/recommended
                    name: recommended
                    properties:
                      informationType: Email
                      labelName: PII
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
      x-ms-odata: "#/definitions/SensitivityLabel"
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}":
    delete:
      description: Deletes the sensitivity label of a given column
      operationId: SensitivityLabels_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - description: The name of the table.
          in: path
          name: tableName
          required: true
          type: string
        - description: The name of the column.
          in: path
          name: columnName
          required: true
          type: string
        - description: The source of the sensitivity label.
          enum:
            - current
          in: path
          name: sensitivityLabelSource
          required: true
          type: string
          x-ms-enum:
            modelAsString: false
            name: WritableSensitivityLabelSource
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the sensitivity label.
        default:
          description: |-
            *** Error Responses: ***

             * 400 SensitivityLabelSourceNameNotSupported - The specified sensitivity label source is not valid

             * 404 SensitivityLabelsColumnNotFound - The specified schema/table/column could not be found

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 SensitivityLabelsLabelNotFound - The specified sensitivity label could not be found

             * 501 SensitivityLabelRecommendedSourceNameNotSupported - 'Recommended' sensitivity label source is not supported yet
      tags:
        - SensitivityLabels
      x-ms-examples:
        Deletes the sensitivity label of a given column:
          parameters:
            api-version: 2017-03-01-preview
            columnName: myColumn
            databaseName: myDatabase
            resourceGroupName: myRG
            schemaName: dbo
            sensitivityLabelSource: current
            serverName: myServer
            subscriptionId: 00000000-1111-2222-3333-444444444444
            tableName: myTable
          responses:
            "200": {}
    get:
      description: Gets the sensitivity label of a given column
      operationId: SensitivityLabels_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - description: The name of the table.
          in: path
          name: tableName
          required: true
          type: string
        - description: The name of the column.
          in: path
          name: columnName
          required: true
          type: string
        - description: The source of the sensitivity label.
          enum:
            - current
            - recommended
          in: path
          name: sensitivityLabelSource
          required: true
          type: string
          x-ms-enum:
            modelAsString: false
            name: SensitivityLabelSource
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the sensitivity label.
          schema:
            $ref: "#/definitions/SensitivityLabel"
        default:
          description: |-
            *** Error Responses: ***

             * 400 SensitivityLabelSourceNameNotSupported - The specified sensitivity label source is not valid

             * 404 SensitivityLabelsColumnNotFound - The specified schema/table/column could not be found

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 SensitivityLabelsLabelNotFound - The specified sensitivity label could not be found

             * 501 SensitivityLabelRecommendedSourceNameNotSupported - 'Recommended' sensitivity label source is not supported yet
      tags:
        - SensitivityLabels
      x-ms-examples:
        Gets the sensitivity label of a given column:
          parameters:
            api-version: 2017-03-01-preview
            columnName: myColumn
            databaseName: myDatabase
            resourceGroupName: myRG
            schemaName: dbo
            sensitivityLabelSource: current
            serverName: myServer
            subscriptionId: 00000000-1111-2222-3333-444444444444
            tableName: myTable
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current
                name: current
                properties:
                  informationType: PhoneNumber
                  labelName: PII
                type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
    put:
      description: Creates or updates the sensitivity label of a given column
      operationId: SensitivityLabels_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - description: The name of the table.
          in: path
          name: tableName
          required: true
          type: string
        - description: The name of the column.
          in: path
          name: columnName
          required: true
          type: string
        - description: The source of the sensitivity label.
          enum:
            - current
          in: path
          name: sensitivityLabelSource
          required: true
          type: string
          x-ms-enum:
            modelAsString: false
            name: WritableSensitivityLabelSource
        - description: The column sensitivity label resource.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/SensitivityLabel"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the sensitivity label.
          schema:
            $ref: "#/definitions/SensitivityLabel"
        "201":
          description: Successfully created the sensitivity label.
          schema:
            $ref: "#/definitions/SensitivityLabel"
        default:
          description: |-
            *** Error Responses: ***

             * 400 SensitivityLabelSourceNameNotSupported - The specified sensitivity label source is not valid

             * 400 InvalidSensitivityLabelResource - The specified sensitivity label resource is not valid

             * 400 SensitivityLabelLabelNameAndInfoTypeNotProvided - At least one of LabelName and InformationType must be specified

             * 400 LabelNameTooLong - Label name cannot exceed {0} characters

             * 400 InformationTypeTooLong - Information type cannot exceed {0} characters

             * 404 SensitivityLabelsColumnNotFound - The specified schema/table/column could not be found

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 SensitivityLabelsLabelNotFound - The specified sensitivity label could not be found

             * 501 SensitivityLabelRecommendedSourceNameNotSupported - 'Recommended' sensitivity label source is not supported yet
      tags:
        - SensitivityLabels
      x-ms-examples:
        Updates the sensitivity label of a given column with all parameters:
          parameters:
            api-version: 2017-03-01-preview
            columnName: myColumn
            databaseName: myDatabase
            parameters:
              properties:
                informationType: PhoneNumber
                labelName: PII
            resourceGroupName: myRG
            schemaName: dbo
            sensitivityLabelSource: current
            serverName: myServer
            subscriptionId: 00000000-1111-2222-3333-444444444444
            tableName: myTable
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current
                name: current
                properties:
                  informationType: PhoneNumber
                  labelName: PII
                type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current
                name: current
                properties:
                  informationType: PhoneNumber
                  labelName: PII
                type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels":
    get:
      description: Gets the sensitivity labels of a given database
      operationId: SensitivityLabels_ListByDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: An OData filter expression that filters elements in the collection.
          in: query
          name: $filter
          required: false
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the sensitivity labels.
          schema:
            $ref: "#/definitions/SensitivityLabelListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 SensitivityLabelsInvalidODataQuery - The specified OData query is either not valid or not supported

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.
      tags:
        - SensitivityLabels
      x-ms-examples:
        Gets the current and recommended sensitivity labels of a given database:
          parameters:
            api-version: 2017-03-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            serverName: myServer
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current
                    name: current
                    properties:
                      informationType: Financial
                      labelName: Sensitive
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn2/sensitivityLabels/recommended
                    name: recommended
                    properties:
                      informationType: Email
                      labelName: PII
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels
      x-ms-odata: "#/definitions/SensitivityLabel"
      x-ms-pageable:
        nextLinkName: nextLink
definitions:
  SensitivityLabel:
    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 sensitivity label.
    properties:
      properties:
        $ref: "#/definitions/SensitivityLabelProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  SensitivityLabelListResult:
    description: A list of sensitivity labels.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/SensitivityLabel"
        readOnly: true
        type: array
    type: object
  SensitivityLabelProperties:
    description: Properties of a sensitivity label.
    properties:
      informationType:
        description: The information type.
        type: string
      labelName:
        description: The label name.
        type: string
    type: object
