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: 2019-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/2019-06-01-preview/WorkloadClassifiers.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-WorkloadClassifiers
  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}/workloadGroups/{workloadGroupName}/workloadClassifiers":
    get:
      description: Gets the list of workload classifiers for a workload group
      operationId: WorkloadClassifiers_ListByWorkloadGroup
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the workload group from which to receive the classifiers from.
          in: path
          name: workloadGroupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of workload groups.
          schema:
            $ref: "#/definitions/WorkloadClassifierListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 OperationNotAllowedOnPausedDatabase - Operation is not allowed on a paused database.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 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 ResourceNotFound - The requested resource was not found.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 ConflictingDatabaseOperation - There is already some operation on the database and the current operation should wait till it is done.

             * 503 DatabaseUnavailable - The operation failed because the database is unavailable.

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

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - WorkloadClassifiers
      x-ms-examples:
        Get the list of workload classifiers for a workload group:
          parameters:
            api-version: 2019-06-01-preview
            databaseName: testdb
            resourceGroupName: Default-SQL-SouthEastAsia
            serverName: testsvr
            subscriptionId: 00000000-1111-2222-3333-444444444444
            workloadGroupName: wlm_workloadgroup
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/classifier3
                    name: classifier3
                    properties:
                      context: ""
                      endTime: ""
                      importance: high
                      label: ""
                      memberName: dbo
                      startTime: ""
                    type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/classifier1
                    name: classifier1
                    properties:
                      context: test_context
                      endTime: 14:00
                      importance: high
                      label: test_label
                      memberName: dbo
                      startTime: 12:00
                    type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/classifier2
                    name: classifier2
                    properties:
                      context: ""
                      endTime: 17:00
                      importance: high
                      label: ""
                      memberName: dbo
                      startTime: 11:00
                    type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}":
    delete:
      description: Deletes a workload classifier.
      operationId: WorkloadClassifiers_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the workload group from which to receive the classifier from.
          in: path
          name: workloadGroupName
          required: true
          type: string
        - description: The name of the workload classifier to delete.
          in: path
          name: workloadClassifierName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the workload classifier.
        "202":
          description: Deleting the workload classifier is in progress.
        "204":
          description: The specified workload classifier does not exist.
        default:
          description: |-
            *** Error Responses: ***

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 OperationNotAllowedOnPausedDatabase - Operation is not allowed on a paused database.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 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 ResourceNotFound - The requested resource was not found.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 ConflictingDatabaseOperation - There is already some operation on the database and the current operation should wait till it is done.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 503 DatabaseUnavailable - The operation failed because the database is unavailable.

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

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - WorkloadClassifiers
      x-ms-examples:
        Delete a workload classifier:
          parameters:
            api-version: 2019-06-01-preview
            databaseName: testdb
            resourceGroupName: Default-SQL-SouthEastAsia
            serverName: testsvr
            subscriptionId: 00000000-1111-2222-3333-444444444444
            workloadClassifierName: wlm_workloadclassifier
            workloadGroupName: wlm_workloadgroup
          responses:
            "200": {}
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a workload classifier
      operationId: WorkloadClassifiers_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the workload group from which to receive the classifier from.
          in: path
          name: workloadGroupName
          required: true
          type: string
        - description: The name of the workload classifier.
          in: path
          name: workloadClassifierName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the specifies workload classifier.
          schema:
            $ref: "#/definitions/WorkloadClassifier"
        default:
          description: |-
            *** Error Responses: ***

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 OperationNotAllowedOnPausedDatabase - Operation is not allowed on a paused database.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 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 ResourceNotFound - The requested resource was not found.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 ConflictingDatabaseOperation - There is already some operation on the database and the current operation should wait till it is done.

             * 503 DatabaseUnavailable - The operation failed because the database is unavailable.

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

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - WorkloadClassifiers
      x-ms-examples:
        Gets a workload classifier for a data warehouse:
          parameters:
            api-version: 2019-06-01-preview
            databaseName: testdb
            resourceGroupName: Default-SQL-SouthEastAsia
            serverName: testsvr
            subscriptionId: 00000000-1111-2222-3333-444444444444
            workloadClassifierName: wlm_classifier
            workloadGroupName: wlm_workloadgroup
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_classifier
                name: wlm_classifier
                properties:
                  context: test_context
                  endTime: 14:00
                  importance: high
                  label: test_label
                  memberName: dbo
                  startTime: 12:00
                type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
    put:
      description: Creates or updates a workload classifier.
      operationId: WorkloadClassifiers_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the workload group from which to receive the classifier from.
          in: path
          name: workloadGroupName
          required: true
          type: string
        - description: The name of the workload classifier to create/update.
          in: path
          name: workloadClassifierName
          required: true
          type: string
        - description: The properties of the workload classifier.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/WorkloadClassifier"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the workload classifier.
          schema:
            $ref: "#/definitions/WorkloadClassifier"
        "201":
          description: Successfully created the workload classifier.
          schema:
            $ref: "#/definitions/WorkloadClassifier"
        "202":
          description: Create or update for the workload classifier is in progress.
        default:
          description: |-
            *** Error Responses: ***

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 OperationNotAllowedOnPausedDatabase - Operation is not allowed on a paused database.

             * 400 InvalidMemberNameParameter - Invalid member name parameter for this workload classifier.

             * 400 InvalidStartTimeAndEndTimeParameters - Invalid start time and end time parameters for the workload classifier.

             * 400 InvalidImportanceParameter - Importance must be one of the following strings: Low, Below_Normal, Normal, Above_Normal, High.

             * 400 InvalidResourceRequestBody - The resource or resource properties in the request body is empty or invalid.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 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 ResourceNotFound - The requested resource was not found.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 ConflictingDatabaseOperation - There is already some operation on the database and the current operation should wait till it is done.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 503 DatabaseUnavailable - The operation failed because the database is unavailable.

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

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - WorkloadClassifiers
      x-ms-examples:
        Create a workload group with all properties specified.:
          parameters:
            api-version: 2019-06-01-preview
            databaseName: testdb
            parameters:
              properties:
                context: test_context
                endTime: 14:00
                importance: high
                label: test_label
                memberName: dbo
                startTime: 12:00
            resourceGroupName: Default-SQL-SouthEastAsia
            serverName: testsvr
            subscriptionId: 00000000-1111-2222-3333-444444444444
            workloadClassifierName: wlm_workloadclassifier
            workloadGroupName: wlm_workloadgroup
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_workloadclassifier
                name: wlm_workloadclassifier
                properties:
                  context: test_context
                  endTime: 14:00
                  importance: high
                  label: test_label
                  memberName: dbo
                  startTime: 12:00
                type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_workloadclassifier
                name: wlm_workloadclassifier
                properties:
                  context: test_context
                  endTime: 14:00
                  importance: high
                  label: test_label
                  memberName: dbo
                  startTime: 12:00
                type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
            "202": {}
        Create a workload group with the required properties specified.:
          parameters:
            api-version: 2019-06-01-preview
            databaseName: testdb
            parameters:
              properties:
                memberName: dbo
            resourceGroupName: Default-SQL-SouthEastAsia
            serverName: testsvr
            subscriptionId: 00000000-1111-2222-3333-444444444444
            workloadClassifierName: wlm_workloadclassifier
            workloadGroupName: wlm_workloadgroup
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_workloadclassifier
                name: wlm_workloadclassifier
                properties:
                  context: ""
                  endTime: ""
                  importance: ""
                  label: ""
                  memberName: dbo
                  startTime: ""
                type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_workloadclassifier
                name: wlm_workloadclassifier
                properties:
                  context: ""
                  endTime: ""
                  importance: ""
                  label: ""
                  memberName: dbo
                  startTime: ""
                type: Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers
            "202": {}
      x-ms-long-running-operation: true
definitions:
  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
  WorkloadClassifier:
    allOf:
      - $ref: "#/definitions/ProxyResource"
    description: Workload classifier operations for a data warehouse
    properties:
      properties:
        $ref: "#/definitions/WorkloadClassifierProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  WorkloadClassifierListResult:
    description: A list of workload classifiers for a workload group.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/WorkloadClassifier"
        readOnly: true
        type: array
    type: object
  WorkloadClassifierProperties:
    description: Workload classifier definition. For more information look at sys.workload_management_workload_classifiers (DMV).
    properties:
      context:
        description: The workload classifier context.
        type: string
      endTime:
        description: The workload classifier end time for classification.
        type: string
      importance:
        description: The workload classifier importance.
        type: string
      label:
        description: The workload classifier label.
        type: string
      memberName:
        description: The workload classifier member name.
        type: string
      startTime:
        description: The workload classifier start time for classification.
        type: string
    required:
      - memberName
    type: object
