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/diagnosticsSettings_API.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: monitor-diagnosticsSettings_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
  ResourceUriParameter:
    description: The identifier of the resource.
    in: path
    name: resourceUri
    required: true
    type: string
    x-ms-parameter-location: method
    x-ms-skip-url-encoding: true
paths:
  "/{resourceUri}/providers/microsoft.insights/diagnosticSettings":
    get:
      description: Gets the active diagnostic settings list for the specified resource.
      operationId: DiagnosticSettings_List
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request to get more information about diagnostic setting
          schema:
            $ref: "#/definitions/DiagnosticSettingsResourceCollection"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DiagnosticSettings
      x-ms-examples:
        Gets the diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            resourceUri: subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting
                    name: mysetting
                    properties:
                      eventHubAuthorizationRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                      logs:
                        - category: WorkflowRuntime
                          enabled: true
                          retentionPolicy:
                            days: 0
                            enabled: false
                      metrics:
                        - category: WorkflowMetrics
                          enabled: true
                          retentionPolicy:
                            days: 0
                            enabled: false
                      storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                      workspaceId: ""
                    type: microsoft.logic/workflows
              headers: {}
  "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}":
    delete:
      description: Deletes existing diagnostic settings for the specified resource.
      operationId: DiagnosticSettings_Delete
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/NameParameter"
      responses:
        "200":
          description: Successful request to remove a diagnostic setting
        "204":
          description: Successful request to remove a diagnostic setting
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DiagnosticSettings
      x-ms-examples:
        Deletes the diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            name: mysetting
            resourceUri: subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets the active diagnostic settings for the specified resource.
      operationId: DiagnosticSettings_Get
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/NameParameter"
      responses:
        "200":
          description: Successful request to get more information about diagnostic setting
          schema:
            $ref: "#/definitions/DiagnosticSettingsResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DiagnosticSettings
      x-ms-examples:
        Gets the diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            name: mysetting
            resourceUri: subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6
          responses:
            "200":
              body:
                id: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service
                name: mysetting
                properties:
                  eventHubAuthorizationRuleId: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
                  logs:
                    - category: WorkflowRuntime
                      enabled: true
                      retentionPolicy:
                        days: 0
                        enabled: false
                  metrics:
                    - category: WorkflowMetrics
                      enabled: true
                      retentionPolicy:
                        days: 0
                        enabled: false
                  storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                  workspaceId: ""
                type: ""
              headers: {}
    put:
      description: Creates or updates diagnostic settings for the specified resource.
      operationId: DiagnosticSettings_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Parameters supplied to the operation.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/DiagnosticSettingsResource"
        - $ref: "#/parameters/NameParameter"
      responses:
        "200":
          description: Successful request to create a diagnostic setting
          schema:
            $ref: "#/definitions/DiagnosticSettingsResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DiagnosticSettings
      x-ms-examples:
        Creates or Updates the diagnostic setting:
          parameters:
            api-version: 2017-05-01-preview
            name: mysetting
            parameters:
              properties:
                eventHubAuthorizationRuleId: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
                eventHubName: myeventhub
                logAnalyticsDestinationType: Dedicated
                logs:
                  - category: WorkflowRuntime
                    enabled: true
                    retentionPolicy:
                      days: 0
                      enabled: false
                metrics:
                  - category: WorkflowMetrics
                    enabled: true
                    retentionPolicy:
                      days: 0
                      enabled: false
                storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                workspaceId: ""
            resourceUri: subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6
          responses:
            "200":
              body:
                id: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting
                name: mysetting
                properties:
                  eventHubAuthorizationRuleId: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
                  eventHubName: myeventhub
                  logAnalyticsDestinationType: Dedicated
                  logs:
                    - category: WorkflowRuntime
                      enabled: true
                      retentionPolicy:
                        days: 0
                        enabled: false
                  metrics:
                    - category: WorkflowMetrics
                      enabled: true
                      retentionPolicy:
                        days: 0
                        enabled: false
                  storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                  workspaceId: ""
                type: ""
              headers: {}
definitions:
  DiagnosticSettings:
    description: The 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
      logAnalyticsDestinationType:
        description: "A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null (null is default.)"
        type: string
      logs:
        description: The list of logs settings.
        items:
          $ref: "#/definitions/LogSettings"
        type: array
      metrics:
        description: The list of metric settings.
        items:
          $ref: "#/definitions/MetricSettings"
        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
  DiagnosticSettingsResource:
    allOf:
      - $ref: "#/definitions/ProxyOnlyResource"
    description: The diagnostic setting resource.
    properties:
      properties:
        $ref: "#/definitions/DiagnosticSettings"
        description: Properties of a Diagnostic Settings Resource.
        x-ms-client-flatten: true
    type: object
  DiagnosticSettingsResourceCollection:
    description: Represents a collection of alert rule resources.
    properties:
      value:
        description: The collection of diagnostic settings resources;.
        items:
          $ref: "#/definitions/DiagnosticSettingsResource"
        type: array
  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
  LogSettings:
    description: Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log.
    properties:
      category:
        description: Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
        type: string
      enabled:
        description: a value indicating whether this log is enabled.
        type: boolean
      retentionPolicy:
        $ref: "#/definitions/RetentionPolicy"
        description: the retention policy for this log.
    required:
      - enabled
  MetricSettings:
    description: Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric.
    properties:
      category:
        description: Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
        type: string
      enabled:
        description: a value indicating whether this category is enabled.
        type: boolean
      retentionPolicy:
        $ref: "#/definitions/RetentionPolicy"
        description: the retention policy for this category.
      timeGrain:
        description: the timegrain of the metric in ISO8601 format.
        format: duration
        type: string
    required:
      - enabled
  ProxyOnlyResource:
    description: A proxy only azure resource object
    properties:
      id:
        description: Azure resource Id
        readOnly: true
        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
  RetentionPolicy:
    description: Specifies the retention policy for the log.
    properties:
      days:
        description: the number of days for the retention in days. A value of 0 will retain the events indefinitely.
        format: int32
        minimum: 0
        type: integer
      enabled:
        description: a value indicating whether the retention policy is enabled.
        type: boolean
    required:
      - enabled
      - days
