swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: MonitorManagementClient
  version: 2016-09-01
  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/monitor/resource-manager/Microsoft.Insights/stable/2016-09-01/serviceDiagnosticsSettings_API.json
      version: "2.0"
  x-preferred: true
  x-providerName: azure.com
  x-serviceName: monitor-serviceDiagnosticsSettings_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
  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/service":
    get:
      description: "Gets the active diagnostic settings for the specified resource. **WARNING**: This method will be deprecated in future releases."
      operationId: ServiceDiagnosticSettings_Get
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request to get more information about service diagnostic setting
          examples:
            application/json:
              id: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service
              location: ""
              name: service
              properties:
                logs:
                  - category: WorkflowRuntime
                    enabled: true
                    retentionPolicy:
                      days: 0
                      enabled: false
                metrics:
                  - enabled: true
                    retentionPolicy:
                      days: 0
                      enabled: false
                    timeGrain: PT1M
                serviceBusRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                workspaceId: ""
              tags: null
              type: ""
          schema:
            $ref: "#/definitions/ServiceDiagnosticSettingsResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ServiceDiagnosticSettings
      x-ms-examples:
        Get service diagnostic setting:
          parameters:
            api-version: 2016-09-01
            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
                location: ""
                name: service
                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:
                    - enabled: true
                      retentionPolicy:
                        days: 0
                        enabled: false
                      timeGrain: PT1M
                  serviceBusRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                  storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                  workspaceId: ""
                tags: null
                type: ""
              headers: {}
    patch:
      description: "Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the CreateOrUpdate method. **WARNING**: This method will be deprecated in future releases."
      operationId: ServiceDiagnosticSettings_Update
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Parameters supplied to the operation.
          in: body
          name: serviceDiagnosticSettingsResource
          required: true
          schema:
            $ref: "#/definitions/ServiceDiagnosticSettingsResourcePatch"
      responses:
        "200":
          description: An existing service diagnostics setting resource was successfully updated.
          schema:
            $ref: "#/definitions/ServiceDiagnosticSettingsResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Update a service diagnostic setting:
          parameters:
            api-version: 2016-09-01
            parameters:
              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: 5
                      enabled: false
                metrics:
                  - enabled: true
                    retentionPolicy:
                      days: 3
                      enabled: false
                    timeGrain: PT1M
                serviceBusRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                workspaceId: ""
              tags: null
            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
                location: ""
                name: service
                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: 5
                        enabled: false
                  metrics:
                    - enabled: true
                      retentionPolicy:
                        days: 3
                        enabled: false
                      timeGrain: PT1M
                  serviceBusRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                  storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                  workspaceId: ""
                tags: null
                type: ""
              headers: {}
    put:
      description: "Create or update new diagnostic settings for the specified resource. **WARNING**: This method will be deprecated in future releases."
      operationId: ServiceDiagnosticSettings_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Parameters supplied to the operation.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ServiceDiagnosticSettingsResource"
      responses:
        "200":
          description: Successful request to create a service diagnostic setting
          examples:
            application/json:
              id: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service
              location: ""
              name: service
              properties:
                eventHubAuthorizationRuleId: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule
                logs:
                  - category: WorkflowRuntime
                    enabled: true
                    retentionPolicy:
                      days: 0
                      enabled: false
                metrics:
                  - enabled: true
                    retentionPolicy:
                      days: 0
                      enabled: false
                    timeGrain: PT1M
                serviceBusRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                workspaceId: ""
              tags: null
              type: ""
          schema:
            $ref: "#/definitions/ServiceDiagnosticSettingsResource"
      tags:
        - ServiceDiagnosticSettings
      x-ms-examples:
        Create or update a service diagnostic setting:
          parameters:
            api-version: 2016-09-01
            parameters:
              location: ""
              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:
                  - enabled: true
                    retentionPolicy:
                      days: 0
                      enabled: false
                    timeGrain: PT1M
                serviceBusRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                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/service
                location: ""
                name: service
                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:
                    - enabled: true
                      retentionPolicy:
                        days: 0
                        enabled: false
                      timeGrain: PT1M
                  serviceBusRuleId: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey
                  storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
                  workspaceId: ""
                tags: null
                type: ""
              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
  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:
      enabled:
        description: a value indicating whether this timegrain is enabled.
        type: boolean
      retentionPolicy:
        $ref: "#/definitions/RetentionPolicy"
        description: the retention policy for this timegrain.
      timeGrain:
        description: the timegrain of the metric in ISO8601 format.
        format: duration
        type: string
    required:
      - enabled
      - timeGrain
  Resource:
    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
  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
  ServiceDiagnosticSettings:
    description: The diagnostic settings for service.
    properties:
      eventHubAuthorizationRuleId:
        description: The resource Id for the event hub namespace authorization rule.
        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 service bus namespace in which you would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'."
        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 workspace ID (resource ID of a Log Analytics workspace) for a 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
  ServiceDiagnosticSettingsResource:
    allOf:
      - $ref: "#/definitions/Resource"
    description: Description of a service diagnostic setting
    properties:
      properties:
        $ref: "#/definitions/ServiceDiagnosticSettings"
        description: The service diagnostics settings of the resource.
        x-ms-client-flatten: true
    type: object
  ServiceDiagnosticSettingsResourcePatch:
    description: Service diagnostic setting resource for patch operations
    properties:
      properties:
        $ref: "#/definitions/ServiceDiagnosticSettings"
        description: The service diagnostics settings for an update operation.
        x-ms-client-flatten: true
      tags:
        additionalProperties:
          type: string
        description: Resource tags
