swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: MonitorManagementClient
  version: 2017-05-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-ms-code-generation-settings:
    name: MonitorManagementClient
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/subscriptionDiagnosticsSettings_API.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: monitor-subscriptionDiagnosticsSettings_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:
  ApiVersionParameter:
    description: Client Api Version.
    in: query
    name: api-version
    required: true
    type: string
  NameParameter:
    description: The name of the diagnostic setting.
    in: path
    name: name
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The subscription id.
    in: path
    name: subscriptionId
    required: true
    type: string
    x-ms-parameter-location: method
    x-ms-skip-url-encoding: true
paths:
  "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings":
    get:
      description: Gets the active subscription diagnostic settings list for the specified subscriptionId.
      operationId: SubscriptionDiagnosticSettings_List
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request to get more information about subscription diagnostic setting
          schema:
            $ref: "#/definitions/SubscriptionDiagnosticSettingsResourceCollection"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - SubscriptionDiagnosticSettings
      x-ms-examples:
        Gets the subscription diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            subscriptionId: fb9f25f9-5785-4510-a38f-a62f188eb9f8
          responses:
            "200":
              body:
                value:
                  - id: subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/providers/AzureResourceManager/diagnosticSettings/ds4
                    name: ds4
                    properties:
                      eventHubAuthorizationRuleId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
                      logs:
                        - category: Security
                          enabled: true
                        - category: Administrative
                          enabled: true
                        - category: ServiceHealth
                          enabled: true
                        - category: Alert
                          enabled: true
                        - category: Recommendation
                          enabled: true
                        - category: Policy
                          enabled: true
                        - category: Autoscale
                          enabled: true
                        - category: ResourceHealth
                          enabled: true
                      storageAccountId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                      workspaceId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/Microsoft.OperationalInsights/workspaces/test1
                    type: null
              headers: {}
  "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}":
    delete:
      description: Deletes existing subscription diagnostic settings for the specified resource.
      operationId: SubscriptionDiagnosticSettings_Delete
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/NameParameter"
      responses:
        "200":
          description: Successful request to remove a subscription diagnostic setting
        "204":
          description: Successful request to remove a subscription diagnostic setting
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - SubscriptionDiagnosticSettings
      x-ms-examples:
        Deletes the subscription diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            name: ds4
            subscriptionId: 1a66ce04-b633-4a0b-b2bc-a912ec8986a6
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets the active subscription diagnostic settings for the specified resource.
      operationId: SubscriptionDiagnosticSettings_Get
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/NameParameter"
      responses:
        "200":
          description: Successful request to get more information about diagnostic setting.
          schema:
            $ref: "#/definitions/SubscriptionDiagnosticSettingsResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - SubscriptionDiagnosticSettings
      x-ms-examples:
        Gets the subscription diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            name: mysetting
            subscriptionId: fb9f25f9-5785-4510-a38f-a62f188eb9f8
          responses:
            "200":
              body:
                id: subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/providers/AzureResourceManager/diagnosticSettings/ds4
                location: global
                name: ds4
                properties:
                  eventHubAuthorizationRuleId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
                  logs:
                    - category: Security
                      enabled: true
                    - category: Administrative
                      enabled: true
                    - category: ServiceHealth
                      enabled: true
                    - category: Alert
                      enabled: true
                    - category: Recommendation
                      enabled: true
                    - category: Policy
                      enabled: true
                    - category: Autoscale
                      enabled: true
                    - category: ResourceHealth
                      enabled: true
                  storageAccountId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                  workspaceId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/Microsoft.OperationalInsights/workspaces/test1
                type: null
              headers: {}
    put:
      description: Creates or updates subscription diagnostic settings for the specified resource.
      operationId: SubscriptionDiagnosticSettings_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Parameters supplied to the operation.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/SubscriptionDiagnosticSettingsResource"
        - $ref: "#/parameters/NameParameter"
      responses:
        "200":
          description: Successful request to create a subscription diagnostic setting
          schema:
            $ref: "#/definitions/SubscriptionDiagnosticSettingsResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - SubscriptionDiagnosticSettings
      x-ms-examples:
        Creates or Updates the subscription diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            name: ds4
            parameters:
              properties:
                eventHubAuthorizationRuleId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
                eventHubName: myeventhub
                logs:
                  - category: Security
                    enabled: true
                storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                workspaceId: ""
            subscriptionId: fb9f25f9-5785-4510-a38f-a62f188eb9f8
          responses:
            "200":
              body:
                id: subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/providers/AzureResourceManager/diagnosticSettings/ds4
                location: global
                name: ds4
                properties:
                  eventHubAuthorizationRuleId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
                  logs:
                    - category: Security
                      enabled: true
                    - category: Administrative
                      enabled: true
                    - category: ServiceHealth
                      enabled: true
                    - category: Alert
                      enabled: true
                    - category: Recommendation
                      enabled: true
                    - category: Policy
                      enabled: true
                    - category: Autoscale
                      enabled: true
                    - category: ResourceHealth
                      enabled: true
                  storageAccountId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                  workspaceId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/apptest/providers/Microsoft.OperationalInsights/workspaces/test1
                type: null
              headers: {}
definitions:
  ErrorResponse:
    description: Describes the format of Error response.
    properties:
      code:
        description: Error code
        type: string
      message:
        description: Error message indicating why the operation failed.
        type: string
    type: object
  SubscriptionDiagnosticSettings:
    description: The subscription diagnostic settings.
    properties:
      eventHubAuthorizationRuleId:
        description: The resource Id for the event hub authorization rule.
        type: string
      eventHubName:
        description: The name of the event hub. If none is specified, the default event hub will be selected.
        type: string
      logs:
        description: The list of logs settings.
        items:
          $ref: "#/definitions/SubscriptionLogSettings"
        type: array
      serviceBusRuleId:
        description: The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
        type: string
      storageAccountId:
        description: The resource ID of the storage account to which you would like to send Diagnostic Logs.
        type: string
      workspaceId:
        description: "The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2"
        type: string
  SubscriptionDiagnosticSettingsResource:
    allOf:
      - $ref: "#/definitions/SubscriptionProxyOnlyResource"
    description: The subscription diagnostic setting resource.
    properties:
      properties:
        $ref: "#/definitions/SubscriptionDiagnosticSettings"
        description: Properties of a Subscription Diagnostic Settings Resource.
        x-ms-client-flatten: true
    type: object
  SubscriptionDiagnosticSettingsResourceCollection:
    description: Represents a collection of subscription diagnostic settings resources.
    properties:
      value:
        description: The collection of subscription diagnostic settings resources.
        items:
          $ref: "#/definitions/SubscriptionDiagnosticSettingsResource"
        type: array
  SubscriptionLogSettings:
    description: Part of Subscription diagnostic setting. Specifies the settings for a particular log.
    properties:
      category:
        description: Name of a Subscription Diagnostic Log category for a resource type this setting is applied to.
        type: string
      enabled:
        description: a value indicating whether this log is enabled.
        type: boolean
    required:
      - enabled
  SubscriptionProxyOnlyResource:
    description: A proxy only azure resource object
    properties:
      id:
        description: Azure resource Id
        readOnly: true
        type: string
      location:
        description: Location of the resource
        type: string
      name:
        description: Azure resource name
        readOnly: true
        type: string
      type:
        description: Azure resource type
        readOnly: true
        type: string
    x-ms-azure-resource: true
