swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Azure Log Analytics API reference for Query Packs management.
  title: Azure Log Analytics Query Packs
  version: 2019-09-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/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-09-01-preview/QueryPacks_API.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: applicationinsights-QueryPacks_API
  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
security:
  - azure_auth:
      - user_impersonation
parameters:
  ResourceNameParameter:
    description: The name of the Log Analytics QueryPack resource.
    in: path
    name: queryPackName
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/providers/microsoft.insights/queryPacks":
    get:
      description: Gets a list of all Log Analytics QueryPacks within a subscription.
      operationId: QueryPacks_List
      parameters:
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: A list containing 0 or more Log Analytics QueryPack definitions.
          schema:
            $ref: "#/definitions/LogAnalyticsQueryPackListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        QueryPacksList.json:
          parameters:
            api-version: 2019-09-01-preview
            subscriptionId: 86dc51d3-92ed-4d7e-947a-775ea79b4919
          responses:
            "200":
              body:
                nextLink: null
                value:
                  - id: /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/queryPacks/my-querypack
                    location: South Central US
                    name: my-querypack
                    properties:
                      provisioningState: Succeeded
                      queryPackId: d1c8fc00-2b68-441e-8f9b-ded8748dc6aa
                      timeCreated: 2019-08-04T12:37:56.8543652Z
                      timeModified: 2019-08-04T12:37:56.8543652Z
                    tags: {}
                    type: microsoft.insights/querypacks
                  - id: /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-other-resource-group/providers/microsoft.insights/queryPacks/my-other-querypack
                    location: South Central US
                    name: my-other-querypack
                    properties:
                      provisioningState: Succeeded
                      queryPackId: aac8fc00-2b68-441e-8f9b-ded8748dc635
                      timeCreated: 2019-06-04T12:37:56.8543652Z
                      timeModified: 2019-08-04T12:37:56.8543652Z
                    tags: {}
                    type: microsoft.insights/querypacks
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/queryPacks":
    get:
      description: Gets a list of Log Analytics QueryPacks within a resource group.
      operationId: QueryPacks_ListByResourceGroup
      parameters:
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: A list containing 0 or more Log Analytics QueryPack definitions.
          schema:
            $ref: "#/definitions/LogAnalyticsQueryPackListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        QueryPackListByResourceGroup:
          parameters:
            api-version: 2019-09-01-preview
            resourceGroupName: my-resource-group
            subscriptionId: 86dc51d3-92ed-4d7e-947a-775ea79b4919
          responses:
            "200":
              body:
                nextLink: null
                value:
                  - id: /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/queryPacks/my-querypack
                    location: South Central US
                    name: my-querypack
                    properties:
                      provisioningState: Succeeded
                      queryPackId: d1c8fc00-2b68-441e-8f9b-ded8748dc6aa
                      timeCreated: 2019-08-04T12:37:56.8543652Z
                      timeModified: 2019-08-04T12:37:56.8543652Z
                    tags: {}
                    type: microsoft.insights/querypacks
                  - id: /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/queryPacks/my-other-querypack
                    location: South Central US
                    name: my-other-querypack
                    properties:
                      provisioningState: Succeeded
                      queryPackId: aac8fc00-2b68-441e-8f9b-ded8748dc635
                      timeCreated: 2019-06-04T12:37:56.8543652Z
                      timeModified: 2019-08-04T12:37:56.8543652Z
                    tags: {}
                    type: microsoft.insights/querypacks
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/queryPacks/{queryPackName}":
    delete:
      description: Deletes a Log Analytics QueryPack.
      operationId: QueryPacks_Delete
      parameters:
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - $ref: "#/parameters/ResourceNameParameter"
      responses:
        "200":
          description: Successful request when deleting a Log Analytics QueryPack.
        "204":
          description: The specified QueryPack does not exist.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        QueryPacksDelete:
          parameters:
            api-version: 2019-09-01-preview
            queryPackName: my-querypack
            resourceGroupName: my-resource-group
            subscriptionId: 86dc51d3-92ed-4d7e-947a-775ea79b4919
          responses:
            "200": {}
            "204": {}
    get:
      description: Returns a Log Analytics QueryPack.
      operationId: QueryPacks_Get
      parameters:
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - $ref: "#/parameters/ResourceNameParameter"
      responses:
        "200":
          description: An Log Analytics QueryPack definition.
          schema:
            $ref: "#/definitions/LogAnalyticsQueryPack"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        QueryPackGet:
          parameters:
            api-version: 2019-09-01-preview
            queryPackName: my-querypack
            resourceGroupName: my-resource-group
            subscriptionId: 86dc51d3-92ed-4d7e-947a-775ea79b4919
          responses:
            "200":
              body:
                id: /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/queryPacks/my-querypack
                location: southcentralus
                name: my-querypack
                properties:
                  provisioningState: Succeeded
                  queryPackId: d1c8fc00-2b68-441e-8f9b-ded8748dc635
                  timeCreated: 2019-08-04T12:37:56.8543652Z
                  timeModified: 2019-08-04T12:37:56.8543652Z
                tags: {}
                type: microsoft.insights/querypacks
    patch:
      description: Updates an existing QueryPack's tags. To update other fields use the CreateOrUpdate method.
      operationId: QueryPacks_UpdateTags
      parameters:
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - $ref: "#/parameters/ResourceNameParameter"
        - description: Updated tag information to set into the QueryPack instance.
          in: body
          name: QueryPackTags
          required: true
          schema:
            $ref: "#/definitions/TagsResource"
      responses:
        "200":
          description: Updating the Log Analytics QueryPack's tags was successful. QueryPack tags are updated and returned with the rest of the QueryPack's object properties.
          schema:
            $ref: "#/definitions/LogAnalyticsQueryPack"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        QueryPackUpdateTagsOnly:
          parameters:
            QueryPackTags:
              tags:
                Tag1: Value1
                Tag2: Value2
            api-version: 2019-09-01-preview
            queryPackName: my-querypack
            resourceGroupName: my-resource-group
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.insights/queryPacks/my-querypack
                location: South Central US
                name: my-querypack
                properties:
                  provisioningState: Succeeded
                  queryPackId: aac8fc00-2b68-441e-8f9b-ded8748dc635
                  timeCreated: 2019-06-04T12:37:56.8543652Z
                  timeModified: 2019-08-04T12:37:56.8543652Z
                tags:
                  Tag1: Value1
                  Tag2: Value2
                type: microsoft.insights/querypacks
    put:
      description: "Creates (or updates) a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation."
      operationId: QueryPacks_CreateOrUpdate
      parameters:
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - $ref: "#/parameters/ResourceNameParameter"
        - description: Properties that need to be specified to create or update a Log Analytics QueryPack.
          in: body
          name: LogAnalyticsQueryPackPayload
          required: true
          schema:
            $ref: "#/definitions/LogAnalyticsQueryPack"
      responses:
        "200":
          description: Successful request when creating or updating a Log Analytics QueryPack. The updated QueryPack is returned.
          schema:
            $ref: "#/definitions/LogAnalyticsQueryPack"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        QueryPackCreate:
          parameters:
            LogAnalyticsQueryPackPayload:
              location: South Central US
              properties: {}
            api-version: 2019-09-01-preview
            queryPackName: my-querypack
            resourceGroupName: my-resource-group
            subscriptionId: 86dc51d3-92ed-4d7e-947a-775ea79b4919
          responses:
            "200":
              body:
                id: /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/queryPacks/my-querypack
                location: South Central US
                name: my-querypack
                properties:
                  provisioningState: Succeeded
                  queryPackId: d1c8fc00-2b68-441e-8f9b-ded8748dc635
                  timeCreated: 2019-08-04T12:37:56.8543652Z
                  timeModified: 2019-08-04T12:37:56.8543652Z
                tags: {}
                type: microsoft.insights/querypacks
        QueryPackUpdate:
          parameters:
            LogAnalyticsQueryPackPayload:
              location: South Central US
              properties: {}
              tags:
                Tag1: Value1
            api-version: 2019-09-01-preview
            queryPackName: my-querypack
            resourceGroupName: my-resource-group
            subscriptionId: 86dc51d3-92ed-4d7e-947a-775ea79b4919
          responses:
            "200":
              body:
                id: /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/queryPacks/my-querypack
                location: South Central US
                name: my-querypack
                properties:
                  provisioningState: Succeeded
                  queryPackId: aac8fc00-2b68-441e-8f9b-ded8748dc635
                  timeCreated: 2019-06-04T12:37:56.8543652Z
                  timeModified: 2019-08-04T12:37:56.8543652Z
                tags:
                  Tag1: Value1
                type: microsoft.insights/querypacks
definitions:
  ErrorResponse:
    description: Describe the format of an Error response.
    properties:
      code:
        description: Error code
        type: string
      message:
        description: Error message indicating why the operation failed.
        type: string
    type: object
  LogAnalyticsQueryPack:
    allOf:
      - $ref: "#/definitions/QueryPacksResource"
    description: An Log Analytics QueryPack definition.
    properties:
      properties:
        $ref: "#/definitions/LogAnalyticsQueryPackProperties"
        description: Properties that define a Log Analytics QueryPack resource.
        x-ms-client-flatten: true
    required:
      - properties
  LogAnalyticsQueryPackListResult:
    description: Describes the list of Log Analytics QueryPack resources.
    properties:
      nextLink:
        description: The URI to get the next set of Log Analytics QueryPack definitions if too many QueryPacks where returned in the result set.
        type: string
      value:
        description: List of Log Analytics QueryPack definitions.
        items:
          $ref: "#/definitions/LogAnalyticsQueryPack"
        type: array
    required:
      - value
  LogAnalyticsQueryPackProperties:
    description: Properties that define a Log Analytics QueryPack resource.
    properties:
      provisioningState:
        description: "Current state of this QueryPack: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed."
        readOnly: true
        type: string
      queryPackId:
        description: The unique ID of your application. This field cannot be changed.
        readOnly: true
        type: string
      timeCreated:
        description: Creation Date for the Log Analytics QueryPack, in ISO 8601 format.
        format: date-time
        readOnly: true
        type: string
      timeModified:
        description: Last modified date of the Log Analytics QueryPack, in ISO 8601 format.
        format: date-time
        readOnly: true
        type: string
  QueryPacksResource:
    description: An azure resource object
    properties:
      id:
        description: Azure resource Id
        readOnly: true
        type: string
      location:
        description: Resource location
        type: string
        x-ms-mutability:
          - create
          - read
      name:
        description: Azure resource name
        readOnly: true
        type: string
      tags:
        additionalProperties:
          type: string
        description: Resource tags
      type:
        description: Azure resource type
        readOnly: true
        type: string
    required:
      - location
    x-ms-azure-resource: true
  TagsResource:
    description: A container holding only the Tags for a resource, allowing the user to update the tags on a QueryPack instance.
    properties:
      tags:
        additionalProperties:
          type: string
        description: Resource tags
