{
  "openapi": "3.0.0",
  "info": {
    "title": "MonitorManagementClient",
    "version": "2017-05-01-preview",
    "x-ms-code-generation-settings": {
      "name": "MonitorManagementClient"
    },
    "x-jentic-source-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"
  },
  "servers": [
    {
      "url": "https://management.azure.com/"
    }
  ],
  "paths": {
    "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceUriParameter"
          },
          {
            "$ref": "../../../../../common-types/resource-management/v2/types.json#/components/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiagnosticSettingsResourceCollection"
                }
              }
            },
            "description": "Successful request to get more information about diagnostic setting"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "tags": [
          "DiagnosticSettings"
        ],
        "description": "Gets the active diagnostic settings list for the specified resource.",
        "operationId": "DiagnosticSettings_List",
        "x-ms-examples": {
          "Gets the diagnostic setting": {
            "$ref": "./examples/listDiagnosticSettings.json"
          }
        }
      }
    },
    "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}": {
      "delete": {
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceUriParameter"
          },
          {
            "$ref": "../../../../../common-types/resource-management/v2/types.json#/components/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/components/parameters/NameParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful request to remove a diagnostic setting"
          },
          "204": {
            "description": "Successful request to remove a diagnostic setting"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "tags": [
          "DiagnosticSettings"
        ],
        "description": "Deletes existing diagnostic settings for the specified resource.",
        "operationId": "DiagnosticSettings_Delete",
        "x-ms-examples": {
          "Deletes the diagnostic setting": {
            "$ref": "./examples/deleteDiagnosticSetting.json"
          }
        }
      },
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceUriParameter"
          },
          {
            "$ref": "../../../../../common-types/resource-management/v2/types.json#/components/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/components/parameters/NameParameter"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiagnosticSettingsResource"
                }
              }
            },
            "description": "Successful request to get more information about diagnostic setting"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "tags": [
          "DiagnosticSettings"
        ],
        "description": "Gets the active diagnostic settings for the specified resource.",
        "operationId": "DiagnosticSettings_Get",
        "x-ms-examples": {
          "Gets the diagnostic setting": {
            "$ref": "./examples/getDiagnosticSetting.json"
          }
        }
      },
      "put": {
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceUriParameter"
          },
          {
            "$ref": "../../../../../common-types/resource-management/v2/types.json#/components/parameters/ApiVersionParameter"
          },
          {
            "$ref": "#/components/parameters/NameParameter"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiagnosticSettingsResource"
                }
              }
            },
            "description": "Successful request to create a diagnostic setting"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "tags": [
          "DiagnosticSettings"
        ],
        "description": "Creates or updates diagnostic settings for the specified resource.",
        "operationId": "DiagnosticSettings_CreateOrUpdate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiagnosticSettingsResource"
              }
            }
          },
          "description": "Parameters supplied to the operation.",
          "required": true
        },
        "x-ms-examples": {
          "Creates or Updates the diagnostic setting": {
            "$ref": "./examples/createOrUpdateDiagnosticSetting.json"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "NameParameter": {
        "description": "The name of the diagnostic setting.",
        "in": "path",
        "name": "name",
        "required": true,
        "schema": {
          "type": "string"
        },
        "x-ms-parameter-location": "method"
      },
      "ResourceUriParameter": {
        "allowReserved": true,
        "description": "The identifier of the resource.",
        "in": "path",
        "name": "resourceUri",
        "required": true,
        "schema": {
          "type": "string"
        },
        "x-ms-parameter-location": "method",
        "x-ms-skip-url-encoding": true
      }
    },
    "schemas": {
      "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": "#/components/schemas/LogSettings"
            },
            "type": "array",
            "x-ms-identifiers": [
              "category"
            ]
          },
          "metrics": {
            "description": "The list of metric settings.",
            "items": {
              "$ref": "#/components/schemas/MetricSettings"
            },
            "type": "array",
            "x-ms-identifiers": [
              "category"
            ]
          },
          "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"
          }
        },
        "type": "object"
      },
      "DiagnosticSettingsResource": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProxyOnlyResource"
          }
        ],
        "description": "The diagnostic setting resource.",
        "properties": {
          "properties": {
            "$ref": "#/components/schemas/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": "#/components/schemas/DiagnosticSettingsResource"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "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": "#/components/schemas/RetentionPolicy",
            "description": "the retention policy for this log."
          }
        },
        "required": [
          "enabled"
        ],
        "type": "object"
      },
      "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": "#/components/schemas/RetentionPolicy",
            "description": "the retention policy for this category."
          },
          "timeGrain": {
            "description": "the timegrain of the metric in ISO8601 format.",
            "format": "duration",
            "type": "string"
          }
        },
        "required": [
          "enabled"
        ],
        "type": "object"
      },
      "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"
          }
        },
        "type": "object",
        "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"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "azure_auth": {
        "description": "Azure Active Directory OAuth2 Flow",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
            "scopes": {
              "user_impersonation": "impersonate your user account"
            }
          }
        },
        "type": "oauth2"
      }
    }
  },
  "security": [
    {
      "azure_auth": [
        "user_impersonation"
      ]
    }
  ]
}