{
  "swagger": "2.0",
  "schemes": [
    "https"
  ],
  "host": "management.azure.com",
  "info": {
    "description": "Use these REST APIs for performing operations on Diagnostic entity associated with your Azure API Management deployment. Diagnostics are used to log requests/responses in the APIM proxy.",
    "title": "ApiManagementClient",
    "version": "2019-01-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/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimdiagnostics.json",
        "version": "2.0"
      }
    ],
    "x-preferred": false,
    "x-providerName": "azure.com",
    "x-serviceName": "apimanagement-apimdiagnostics",
    "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": {},
  "paths": {
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics": {
      "get": {
        "description": "Lists all diagnostics of the API Management service instance.",
        "operationId": "Diagnostic_ListByService",
        "parameters": [
          {
            "description": "The name of the resource group.",
            "in": "path",
            "name": "resourceGroupName",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "The name of the API Management service.",
            "in": "path",
            "maxLength": 50,
            "minLength": 1,
            "name": "serviceName",
            "pattern": "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "|   Field     |     Usage     |     Supported operators     |     Supported functions     |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>",
            "in": "query",
            "name": "$filter",
            "required": false,
            "type": "string"
          },
          {
            "description": "Number of records to return.",
            "format": "int32",
            "in": "query",
            "minimum": 1,
            "name": "$top",
            "required": false,
            "type": "integer",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Number of records to skip.",
            "format": "int32",
            "in": "query",
            "minimum": 0,
            "name": "$skip",
            "required": false,
            "type": "integer",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Version of the API to be used with the client request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string"
          },
          {
            "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Paged Result response of diagnostics.",
            "schema": {
              "description": "Paged Diagnostic list representation.",
              "properties": {
                "nextLink": {
                  "description": "Next page link if any.",
                  "type": "string"
                },
                "value": {
                  "description": "Page values.",
                  "items": {
                    "allOf": [
                      {
                        "description": "The Resource definition.",
                        "properties": {
                          "id": {
                            "description": "Resource ID.",
                            "readOnly": true,
                            "type": "string"
                          },
                          "name": {
                            "description": "Resource name.",
                            "readOnly": true,
                            "type": "string"
                          },
                          "type": {
                            "description": "Resource type for API Management resource.",
                            "readOnly": true,
                            "type": "string"
                          }
                        },
                        "x-ms-azure-resource": true
                      }
                    ],
                    "description": "Diagnostic details.",
                    "properties": {
                      "properties": {
                        "description": "Diagnostic Entity Properties",
                        "properties": {
                          "alwaysLog": {
                            "description": "Specifies for what type of messages sampling settings should not apply.",
                            "enum": [
                              "allErrors"
                            ],
                            "type": "string",
                            "x-ms-enum": {
                              "modelAsString": true,
                              "name": "AlwaysLog",
                              "values": [
                                {
                                  "description": "Always log all erroneous request regardless of sampling settings.",
                                  "value": "allErrors"
                                }
                              ]
                            }
                          },
                          "backend": {
                            "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                            "properties": {
                              "request": {
                                "description": "Http message diagnostic settings.",
                                "properties": {
                                  "body": {
                                    "description": "Body logging settings.",
                                    "properties": {
                                      "bytes": {
                                        "description": "Number of request body bytes to log.",
                                        "format": "int32",
                                        "maximum": 8192,
                                        "type": "integer"
                                      }
                                    }
                                  },
                                  "headers": {
                                    "description": "Array of HTTP Headers to log.",
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                }
                              },
                              "response": {
                                "description": "Http message diagnostic settings.",
                                "properties": {
                                  "body": {
                                    "description": "Body logging settings.",
                                    "properties": {
                                      "bytes": {
                                        "description": "Number of request body bytes to log.",
                                        "format": "int32",
                                        "maximum": 8192,
                                        "type": "integer"
                                      }
                                    }
                                  },
                                  "headers": {
                                    "description": "Array of HTTP Headers to log.",
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                }
                              }
                            }
                          },
                          "enableHttpCorrelationHeaders": {
                            "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true.",
                            "type": "boolean"
                          },
                          "frontend": {
                            "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                            "properties": {
                              "request": {
                                "description": "Http message diagnostic settings.",
                                "properties": {
                                  "body": {
                                    "description": "Body logging settings.",
                                    "properties": {
                                      "bytes": {
                                        "description": "Number of request body bytes to log.",
                                        "format": "int32",
                                        "maximum": 8192,
                                        "type": "integer"
                                      }
                                    }
                                  },
                                  "headers": {
                                    "description": "Array of HTTP Headers to log.",
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                }
                              },
                              "response": {
                                "description": "Http message diagnostic settings.",
                                "properties": {
                                  "body": {
                                    "description": "Body logging settings.",
                                    "properties": {
                                      "bytes": {
                                        "description": "Number of request body bytes to log.",
                                        "format": "int32",
                                        "maximum": 8192,
                                        "type": "integer"
                                      }
                                    }
                                  },
                                  "headers": {
                                    "description": "Array of HTTP Headers to log.",
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                }
                              }
                            }
                          },
                          "httpCorrelationProtocol": {
                            "description": "Sets correlation protocol to use for Application Insights diagnostics.",
                            "enum": [
                              "None",
                              "Legacy",
                              "W3C"
                            ],
                            "type": "string",
                            "x-ms-enum": {
                              "modelAsString": true,
                              "name": "HttpCorrelationProtocol",
                              "values": [
                                {
                                  "description": "Do not read and inject correlation headers.",
                                  "value": "None"
                                },
                                {
                                  "description": "Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.",
                                  "value": "Legacy"
                                },
                                {
                                  "description": "Inject Trace Context headers. See https://w3c.github.io/trace-context.",
                                  "value": "W3C"
                                }
                              ]
                            }
                          },
                          "loggerId": {
                            "description": "Resource Id of a target logger.",
                            "type": "string"
                          },
                          "sampling": {
                            "description": "Sampling settings for Diagnostic.",
                            "properties": {
                              "percentage": {
                                "description": "Rate of sampling for fixed-rate sampling.",
                                "format": "double",
                                "maximum": 100,
                                "minimum": 0,
                                "type": "number"
                              },
                              "samplingType": {
                                "description": "Sampling type.",
                                "enum": [
                                  "fixed"
                                ],
                                "type": "string",
                                "x-ms-enum": {
                                  "modelAsString": true,
                                  "name": "SamplingType",
                                  "values": [
                                    {
                                      "description": "Fixed-rate sampling.",
                                      "value": "fixed"
                                    }
                                  ]
                                }
                              }
                            }
                          },
                          "verbosity": {
                            "description": "The verbosity level applied to traces emitted by trace policies.",
                            "enum": [
                              "verbose",
                              "information",
                              "error"
                            ],
                            "type": "string",
                            "x-ms-enum": {
                              "modelAsString": true,
                              "name": "Verbosity",
                              "values": [
                                {
                                  "description": "All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance.",
                                  "value": "verbose"
                                },
                                {
                                  "description": "Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance.",
                                  "value": "information"
                                },
                                {
                                  "description": "Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance.",
                                  "value": "error"
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "loggerId"
                        ]
                      }
                    }
                  },
                  "type": "array"
                }
              }
            }
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "description": "Error Response.",
              "properties": {
                "error": {
                  "description": "Error Body contract.",
                  "properties": {
                    "code": {
                      "description": "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.",
                      "type": "string"
                    },
                    "details": {
                      "description": "The list of invalid fields send in request, in case of validation error.",
                      "items": {
                        "description": "Error Field contract.",
                        "properties": {
                          "code": {
                            "description": "Property level error code.",
                            "type": "string"
                          },
                          "message": {
                            "description": "Human-readable representation of property-level error.",
                            "type": "string"
                          },
                          "target": {
                            "description": "Property name.",
                            "type": "string"
                          }
                        }
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "Human-readable representation of the error.",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Diagnostic"
        ],
        "x-ms-examples": {
          "ApiManagementListDiagnostics": {
            "parameters": {
              "api-version": "2019-01-01",
              "resourceGroupName": "rg1",
              "serviceName": "apimService1",
              "subscriptionId": "subid"
            },
            "responses": {
              "200": {
                "body": {
                  "nextLink": "",
                  "value": [
                    {
                      "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights",
                      "name": "applicationinsights",
                      "properties": {
                        "alwaysLog": "allErrors",
                        "backend": {
                          "request": {
                            "body": {
                              "bytes": 512
                            },
                            "headers": [
                              "Content-type"
                            ]
                          },
                          "response": {
                            "body": {
                              "bytes": 512
                            },
                            "headers": [
                              "Content-type"
                            ]
                          }
                        },
                        "frontend": {
                          "request": {
                            "body": {
                              "bytes": 512
                            },
                            "headers": [
                              "Content-type"
                            ]
                          },
                          "response": {
                            "body": {
                              "bytes": 512
                            },
                            "headers": [
                              "Content-type"
                            ]
                          }
                        },
                        "loggerId": "/loggers/applicationinsights",
                        "sampling": {
                          "percentage": 50,
                          "samplingType": "fixed"
                        }
                      },
                      "type": "Microsoft.ApiManagement/service/diagnostics"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-ms-odata": "./definitions.json#/definitions/DiagnosticContract",
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}": {
      "delete": {
        "description": "Deletes the specified Diagnostic.",
        "operationId": "Diagnostic_Delete",
        "parameters": [
          {
            "description": "The name of the resource group.",
            "in": "path",
            "name": "resourceGroupName",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "The name of the API Management service.",
            "in": "path",
            "maxLength": 50,
            "minLength": 1,
            "name": "serviceName",
            "pattern": "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Diagnostic identifier. Must be unique in the current API Management service instance.",
            "in": "path",
            "maxLength": 80,
            "minLength": 1,
            "name": "diagnosticId",
            "pattern": "^[^*#&+:<>?]+$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Version of the API to be used with the client request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string"
          },
          {
            "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "The Diagnostic was successfully deleted."
          },
          "204": {
            "description": "The Diagnostic was successfully deleted."
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "description": "Error Response.",
              "properties": {
                "error": {
                  "description": "Error Body contract.",
                  "properties": {
                    "code": {
                      "description": "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.",
                      "type": "string"
                    },
                    "details": {
                      "description": "The list of invalid fields send in request, in case of validation error.",
                      "items": {
                        "description": "Error Field contract.",
                        "properties": {
                          "code": {
                            "description": "Property level error code.",
                            "type": "string"
                          },
                          "message": {
                            "description": "Human-readable representation of property-level error.",
                            "type": "string"
                          },
                          "target": {
                            "description": "Property name.",
                            "type": "string"
                          }
                        }
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "Human-readable representation of the error.",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Diagnostic"
        ],
        "x-ms-examples": {
          "ApiManagementDeleteDiagnostic": {
            "parameters": {
              "If-Match": "*",
              "api-version": "2019-01-01",
              "diagnosticId": "applicationinsights",
              "resourceGroupName": "rg1",
              "serviceName": "apimService1",
              "subscriptionId": "subid"
            },
            "responses": {
              "200": {},
              "204": {}
            }
          }
        }
      },
      "get": {
        "description": "Gets the details of the Diagnostic specified by its identifier.",
        "operationId": "Diagnostic_Get",
        "parameters": [
          {
            "description": "The name of the resource group.",
            "in": "path",
            "name": "resourceGroupName",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "The name of the API Management service.",
            "in": "path",
            "maxLength": 50,
            "minLength": 1,
            "name": "serviceName",
            "pattern": "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Diagnostic identifier. Must be unique in the current API Management service instance.",
            "in": "path",
            "maxLength": 80,
            "minLength": 1,
            "name": "diagnosticId",
            "pattern": "^[^*#&+:<>?]+$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Version of the API to be used with the client request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string"
          },
          {
            "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "The response body contains the specified Diagnostic entity.",
            "headers": {
              "ETag": {
                "description": "Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.",
                "type": "string"
              }
            },
            "schema": {
              "allOf": [
                {
                  "description": "The Resource definition.",
                  "properties": {
                    "id": {
                      "description": "Resource ID.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "name": {
                      "description": "Resource name.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "type": {
                      "description": "Resource type for API Management resource.",
                      "readOnly": true,
                      "type": "string"
                    }
                  },
                  "x-ms-azure-resource": true
                }
              ],
              "description": "Diagnostic details.",
              "properties": {
                "properties": {
                  "description": "Diagnostic Entity Properties",
                  "properties": {
                    "alwaysLog": {
                      "description": "Specifies for what type of messages sampling settings should not apply.",
                      "enum": [
                        "allErrors"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "AlwaysLog",
                        "values": [
                          {
                            "description": "Always log all erroneous request regardless of sampling settings.",
                            "value": "allErrors"
                          }
                        ]
                      }
                    },
                    "backend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "enableHttpCorrelationHeaders": {
                      "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true.",
                      "type": "boolean"
                    },
                    "frontend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "httpCorrelationProtocol": {
                      "description": "Sets correlation protocol to use for Application Insights diagnostics.",
                      "enum": [
                        "None",
                        "Legacy",
                        "W3C"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "HttpCorrelationProtocol",
                        "values": [
                          {
                            "description": "Do not read and inject correlation headers.",
                            "value": "None"
                          },
                          {
                            "description": "Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.",
                            "value": "Legacy"
                          },
                          {
                            "description": "Inject Trace Context headers. See https://w3c.github.io/trace-context.",
                            "value": "W3C"
                          }
                        ]
                      }
                    },
                    "loggerId": {
                      "description": "Resource Id of a target logger.",
                      "type": "string"
                    },
                    "sampling": {
                      "description": "Sampling settings for Diagnostic.",
                      "properties": {
                        "percentage": {
                          "description": "Rate of sampling for fixed-rate sampling.",
                          "format": "double",
                          "maximum": 100,
                          "minimum": 0,
                          "type": "number"
                        },
                        "samplingType": {
                          "description": "Sampling type.",
                          "enum": [
                            "fixed"
                          ],
                          "type": "string",
                          "x-ms-enum": {
                            "modelAsString": true,
                            "name": "SamplingType",
                            "values": [
                              {
                                "description": "Fixed-rate sampling.",
                                "value": "fixed"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "verbosity": {
                      "description": "The verbosity level applied to traces emitted by trace policies.",
                      "enum": [
                        "verbose",
                        "information",
                        "error"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "Verbosity",
                        "values": [
                          {
                            "description": "All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance.",
                            "value": "verbose"
                          },
                          {
                            "description": "Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "information"
                          },
                          {
                            "description": "Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "error"
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "loggerId"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "description": "Error Response.",
              "properties": {
                "error": {
                  "description": "Error Body contract.",
                  "properties": {
                    "code": {
                      "description": "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.",
                      "type": "string"
                    },
                    "details": {
                      "description": "The list of invalid fields send in request, in case of validation error.",
                      "items": {
                        "description": "Error Field contract.",
                        "properties": {
                          "code": {
                            "description": "Property level error code.",
                            "type": "string"
                          },
                          "message": {
                            "description": "Human-readable representation of property-level error.",
                            "type": "string"
                          },
                          "target": {
                            "description": "Property name.",
                            "type": "string"
                          }
                        }
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "Human-readable representation of the error.",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Diagnostic"
        ],
        "x-ms-examples": {
          "ApiManagementGetDiagnostic": {
            "parameters": {
              "api-version": "2019-01-01",
              "diagnosticId": "applicationinsights",
              "resourceGroupName": "rg1",
              "serviceName": "apimService1",
              "subscriptionId": "subid"
            },
            "responses": {
              "200": {
                "body": {
                  "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights",
                  "name": "applicationinsights",
                  "properties": {
                    "alwaysLog": "allErrors",
                    "backend": {
                      "request": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      },
                      "response": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      }
                    },
                    "frontend": {
                      "request": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      },
                      "response": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      }
                    },
                    "loggerId": "/loggers/applicationinsights",
                    "sampling": {
                      "percentage": 50,
                      "samplingType": "fixed"
                    }
                  },
                  "type": "Microsoft.ApiManagement/service/diagnostics"
                }
              }
            }
          }
        }
      },
      "head": {
        "description": "Gets the entity state (Etag) version of the Diagnostic specified by its identifier.",
        "operationId": "Diagnostic_GetEntityTag",
        "parameters": [
          {
            "description": "The name of the resource group.",
            "in": "path",
            "name": "resourceGroupName",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "The name of the API Management service.",
            "in": "path",
            "maxLength": 50,
            "minLength": 1,
            "name": "serviceName",
            "pattern": "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Diagnostic identifier. Must be unique in the current API Management service instance.",
            "in": "path",
            "maxLength": 80,
            "minLength": 1,
            "name": "diagnosticId",
            "pattern": "^[^*#&+:<>?]+$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Version of the API to be used with the client request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string"
          },
          {
            "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Gets the entity tag of the diagnostic",
            "headers": {
              "ETag": {
                "description": "Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.",
                "type": "string"
              }
            }
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "description": "Error Response.",
              "properties": {
                "error": {
                  "description": "Error Body contract.",
                  "properties": {
                    "code": {
                      "description": "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.",
                      "type": "string"
                    },
                    "details": {
                      "description": "The list of invalid fields send in request, in case of validation error.",
                      "items": {
                        "description": "Error Field contract.",
                        "properties": {
                          "code": {
                            "description": "Property level error code.",
                            "type": "string"
                          },
                          "message": {
                            "description": "Human-readable representation of property-level error.",
                            "type": "string"
                          },
                          "target": {
                            "description": "Property name.",
                            "type": "string"
                          }
                        }
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "Human-readable representation of the error.",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Diagnostic"
        ],
        "x-ms-examples": {
          "ApiManagementHeadDiagnostic": {
            "parameters": {
              "api-version": "2019-01-01",
              "diagnosticId": "applicationinsights",
              "resourceGroupName": "rg1",
              "serviceName": "apimService1",
              "subscriptionId": "subid"
            },
            "responses": {
              "200": {
                "headers": {
                  "etag": "AAAAAAAAAAa="
                }
              }
            }
          }
        }
      },
      "patch": {
        "description": "Updates the details of the Diagnostic specified by its identifier.",
        "operationId": "Diagnostic_Update",
        "parameters": [
          {
            "description": "The name of the resource group.",
            "in": "path",
            "name": "resourceGroupName",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "The name of the API Management service.",
            "in": "path",
            "maxLength": 50,
            "minLength": 1,
            "name": "serviceName",
            "pattern": "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Diagnostic identifier. Must be unique in the current API Management service instance.",
            "in": "path",
            "maxLength": 80,
            "minLength": 1,
            "name": "diagnosticId",
            "pattern": "^[^*#&+:<>?]+$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Diagnostic Update parameters.",
            "in": "body",
            "name": "parameters",
            "required": true,
            "schema": {
              "allOf": [
                {
                  "description": "The Resource definition.",
                  "properties": {
                    "id": {
                      "description": "Resource ID.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "name": {
                      "description": "Resource name.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "type": {
                      "description": "Resource type for API Management resource.",
                      "readOnly": true,
                      "type": "string"
                    }
                  },
                  "x-ms-azure-resource": true
                }
              ],
              "description": "Diagnostic details.",
              "properties": {
                "properties": {
                  "description": "Diagnostic Entity Properties",
                  "properties": {
                    "alwaysLog": {
                      "description": "Specifies for what type of messages sampling settings should not apply.",
                      "enum": [
                        "allErrors"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "AlwaysLog",
                        "values": [
                          {
                            "description": "Always log all erroneous request regardless of sampling settings.",
                            "value": "allErrors"
                          }
                        ]
                      }
                    },
                    "backend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "enableHttpCorrelationHeaders": {
                      "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true.",
                      "type": "boolean"
                    },
                    "frontend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "httpCorrelationProtocol": {
                      "description": "Sets correlation protocol to use for Application Insights diagnostics.",
                      "enum": [
                        "None",
                        "Legacy",
                        "W3C"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "HttpCorrelationProtocol",
                        "values": [
                          {
                            "description": "Do not read and inject correlation headers.",
                            "value": "None"
                          },
                          {
                            "description": "Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.",
                            "value": "Legacy"
                          },
                          {
                            "description": "Inject Trace Context headers. See https://w3c.github.io/trace-context.",
                            "value": "W3C"
                          }
                        ]
                      }
                    },
                    "loggerId": {
                      "description": "Resource Id of a target logger.",
                      "type": "string"
                    },
                    "sampling": {
                      "description": "Sampling settings for Diagnostic.",
                      "properties": {
                        "percentage": {
                          "description": "Rate of sampling for fixed-rate sampling.",
                          "format": "double",
                          "maximum": 100,
                          "minimum": 0,
                          "type": "number"
                        },
                        "samplingType": {
                          "description": "Sampling type.",
                          "enum": [
                            "fixed"
                          ],
                          "type": "string",
                          "x-ms-enum": {
                            "modelAsString": true,
                            "name": "SamplingType",
                            "values": [
                              {
                                "description": "Fixed-rate sampling.",
                                "value": "fixed"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "verbosity": {
                      "description": "The verbosity level applied to traces emitted by trace policies.",
                      "enum": [
                        "verbose",
                        "information",
                        "error"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "Verbosity",
                        "values": [
                          {
                            "description": "All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance.",
                            "value": "verbose"
                          },
                          {
                            "description": "Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "information"
                          },
                          {
                            "description": "Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "error"
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "loggerId"
                  ]
                }
              }
            }
          },
          {
            "description": "ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Version of the API to be used with the client request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string"
          },
          {
            "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "204": {
            "description": "The Diagnostic was successfully updated."
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "description": "Error Response.",
              "properties": {
                "error": {
                  "description": "Error Body contract.",
                  "properties": {
                    "code": {
                      "description": "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.",
                      "type": "string"
                    },
                    "details": {
                      "description": "The list of invalid fields send in request, in case of validation error.",
                      "items": {
                        "description": "Error Field contract.",
                        "properties": {
                          "code": {
                            "description": "Property level error code.",
                            "type": "string"
                          },
                          "message": {
                            "description": "Human-readable representation of property-level error.",
                            "type": "string"
                          },
                          "target": {
                            "description": "Property name.",
                            "type": "string"
                          }
                        }
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "Human-readable representation of the error.",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Diagnostic"
        ],
        "x-ms-examples": {
          "ApiManagementUpdateDiagnostic": {
            "parameters": {
              "If-Match": "*",
              "api-version": "2019-01-01",
              "diagnosticId": "applicationinsights",
              "parameters": {
                "properties": {
                  "alwaysLog": "allErrors",
                  "backend": {
                    "request": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    },
                    "response": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    }
                  },
                  "frontend": {
                    "request": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    },
                    "response": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    }
                  },
                  "loggerId": "/loggers/applicationinsights",
                  "sampling": {
                    "percentage": 50,
                    "samplingType": "fixed"
                  }
                }
              },
              "resourceGroupName": "rg1",
              "serviceName": "apimService1",
              "subscriptionId": "subid"
            },
            "responses": {
              "204": {}
            }
          }
        }
      },
      "put": {
        "description": "Creates a new Diagnostic or updates an existing one.",
        "operationId": "Diagnostic_CreateOrUpdate",
        "parameters": [
          {
            "description": "The name of the resource group.",
            "in": "path",
            "name": "resourceGroupName",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "The name of the API Management service.",
            "in": "path",
            "maxLength": 50,
            "minLength": 1,
            "name": "serviceName",
            "pattern": "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Diagnostic identifier. Must be unique in the current API Management service instance.",
            "in": "path",
            "maxLength": 80,
            "minLength": 1,
            "name": "diagnosticId",
            "pattern": "^[^*#&+:<>?]+$",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Create parameters.",
            "in": "body",
            "name": "parameters",
            "required": true,
            "schema": {
              "allOf": [
                {
                  "description": "The Resource definition.",
                  "properties": {
                    "id": {
                      "description": "Resource ID.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "name": {
                      "description": "Resource name.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "type": {
                      "description": "Resource type for API Management resource.",
                      "readOnly": true,
                      "type": "string"
                    }
                  },
                  "x-ms-azure-resource": true
                }
              ],
              "description": "Diagnostic details.",
              "properties": {
                "properties": {
                  "description": "Diagnostic Entity Properties",
                  "properties": {
                    "alwaysLog": {
                      "description": "Specifies for what type of messages sampling settings should not apply.",
                      "enum": [
                        "allErrors"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "AlwaysLog",
                        "values": [
                          {
                            "description": "Always log all erroneous request regardless of sampling settings.",
                            "value": "allErrors"
                          }
                        ]
                      }
                    },
                    "backend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "enableHttpCorrelationHeaders": {
                      "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true.",
                      "type": "boolean"
                    },
                    "frontend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "httpCorrelationProtocol": {
                      "description": "Sets correlation protocol to use for Application Insights diagnostics.",
                      "enum": [
                        "None",
                        "Legacy",
                        "W3C"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "HttpCorrelationProtocol",
                        "values": [
                          {
                            "description": "Do not read and inject correlation headers.",
                            "value": "None"
                          },
                          {
                            "description": "Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.",
                            "value": "Legacy"
                          },
                          {
                            "description": "Inject Trace Context headers. See https://w3c.github.io/trace-context.",
                            "value": "W3C"
                          }
                        ]
                      }
                    },
                    "loggerId": {
                      "description": "Resource Id of a target logger.",
                      "type": "string"
                    },
                    "sampling": {
                      "description": "Sampling settings for Diagnostic.",
                      "properties": {
                        "percentage": {
                          "description": "Rate of sampling for fixed-rate sampling.",
                          "format": "double",
                          "maximum": 100,
                          "minimum": 0,
                          "type": "number"
                        },
                        "samplingType": {
                          "description": "Sampling type.",
                          "enum": [
                            "fixed"
                          ],
                          "type": "string",
                          "x-ms-enum": {
                            "modelAsString": true,
                            "name": "SamplingType",
                            "values": [
                              {
                                "description": "Fixed-rate sampling.",
                                "value": "fixed"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "verbosity": {
                      "description": "The verbosity level applied to traces emitted by trace policies.",
                      "enum": [
                        "verbose",
                        "information",
                        "error"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "Verbosity",
                        "values": [
                          {
                            "description": "All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance.",
                            "value": "verbose"
                          },
                          {
                            "description": "Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "information"
                          },
                          {
                            "description": "Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "error"
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "loggerId"
                  ]
                }
              }
            }
          },
          {
            "description": "ETag of the Entity. Not required when creating an entity, but required when updating an entity.",
            "in": "header",
            "name": "If-Match",
            "required": false,
            "type": "string",
            "x-ms-parameter-location": "method"
          },
          {
            "description": "Version of the API to be used with the client request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string"
          },
          {
            "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Diagnostic successfully updated",
            "headers": {
              "ETag": {
                "description": "Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.",
                "type": "string"
              }
            },
            "schema": {
              "allOf": [
                {
                  "description": "The Resource definition.",
                  "properties": {
                    "id": {
                      "description": "Resource ID.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "name": {
                      "description": "Resource name.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "type": {
                      "description": "Resource type for API Management resource.",
                      "readOnly": true,
                      "type": "string"
                    }
                  },
                  "x-ms-azure-resource": true
                }
              ],
              "description": "Diagnostic details.",
              "properties": {
                "properties": {
                  "description": "Diagnostic Entity Properties",
                  "properties": {
                    "alwaysLog": {
                      "description": "Specifies for what type of messages sampling settings should not apply.",
                      "enum": [
                        "allErrors"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "AlwaysLog",
                        "values": [
                          {
                            "description": "Always log all erroneous request regardless of sampling settings.",
                            "value": "allErrors"
                          }
                        ]
                      }
                    },
                    "backend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "enableHttpCorrelationHeaders": {
                      "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true.",
                      "type": "boolean"
                    },
                    "frontend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "httpCorrelationProtocol": {
                      "description": "Sets correlation protocol to use for Application Insights diagnostics.",
                      "enum": [
                        "None",
                        "Legacy",
                        "W3C"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "HttpCorrelationProtocol",
                        "values": [
                          {
                            "description": "Do not read and inject correlation headers.",
                            "value": "None"
                          },
                          {
                            "description": "Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.",
                            "value": "Legacy"
                          },
                          {
                            "description": "Inject Trace Context headers. See https://w3c.github.io/trace-context.",
                            "value": "W3C"
                          }
                        ]
                      }
                    },
                    "loggerId": {
                      "description": "Resource Id of a target logger.",
                      "type": "string"
                    },
                    "sampling": {
                      "description": "Sampling settings for Diagnostic.",
                      "properties": {
                        "percentage": {
                          "description": "Rate of sampling for fixed-rate sampling.",
                          "format": "double",
                          "maximum": 100,
                          "minimum": 0,
                          "type": "number"
                        },
                        "samplingType": {
                          "description": "Sampling type.",
                          "enum": [
                            "fixed"
                          ],
                          "type": "string",
                          "x-ms-enum": {
                            "modelAsString": true,
                            "name": "SamplingType",
                            "values": [
                              {
                                "description": "Fixed-rate sampling.",
                                "value": "fixed"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "verbosity": {
                      "description": "The verbosity level applied to traces emitted by trace policies.",
                      "enum": [
                        "verbose",
                        "information",
                        "error"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "Verbosity",
                        "values": [
                          {
                            "description": "All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance.",
                            "value": "verbose"
                          },
                          {
                            "description": "Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "information"
                          },
                          {
                            "description": "Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "error"
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "loggerId"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Diagnostic was successfully created.",
            "headers": {
              "ETag": {
                "description": "Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.",
                "type": "string"
              }
            },
            "schema": {
              "allOf": [
                {
                  "description": "The Resource definition.",
                  "properties": {
                    "id": {
                      "description": "Resource ID.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "name": {
                      "description": "Resource name.",
                      "readOnly": true,
                      "type": "string"
                    },
                    "type": {
                      "description": "Resource type for API Management resource.",
                      "readOnly": true,
                      "type": "string"
                    }
                  },
                  "x-ms-azure-resource": true
                }
              ],
              "description": "Diagnostic details.",
              "properties": {
                "properties": {
                  "description": "Diagnostic Entity Properties",
                  "properties": {
                    "alwaysLog": {
                      "description": "Specifies for what type of messages sampling settings should not apply.",
                      "enum": [
                        "allErrors"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "AlwaysLog",
                        "values": [
                          {
                            "description": "Always log all erroneous request regardless of sampling settings.",
                            "value": "allErrors"
                          }
                        ]
                      }
                    },
                    "backend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "enableHttpCorrelationHeaders": {
                      "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true.",
                      "type": "boolean"
                    },
                    "frontend": {
                      "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.",
                      "properties": {
                        "request": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        },
                        "response": {
                          "description": "Http message diagnostic settings.",
                          "properties": {
                            "body": {
                              "description": "Body logging settings.",
                              "properties": {
                                "bytes": {
                                  "description": "Number of request body bytes to log.",
                                  "format": "int32",
                                  "maximum": 8192,
                                  "type": "integer"
                                }
                              }
                            },
                            "headers": {
                              "description": "Array of HTTP Headers to log.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          }
                        }
                      }
                    },
                    "httpCorrelationProtocol": {
                      "description": "Sets correlation protocol to use for Application Insights diagnostics.",
                      "enum": [
                        "None",
                        "Legacy",
                        "W3C"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "HttpCorrelationProtocol",
                        "values": [
                          {
                            "description": "Do not read and inject correlation headers.",
                            "value": "None"
                          },
                          {
                            "description": "Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.",
                            "value": "Legacy"
                          },
                          {
                            "description": "Inject Trace Context headers. See https://w3c.github.io/trace-context.",
                            "value": "W3C"
                          }
                        ]
                      }
                    },
                    "loggerId": {
                      "description": "Resource Id of a target logger.",
                      "type": "string"
                    },
                    "sampling": {
                      "description": "Sampling settings for Diagnostic.",
                      "properties": {
                        "percentage": {
                          "description": "Rate of sampling for fixed-rate sampling.",
                          "format": "double",
                          "maximum": 100,
                          "minimum": 0,
                          "type": "number"
                        },
                        "samplingType": {
                          "description": "Sampling type.",
                          "enum": [
                            "fixed"
                          ],
                          "type": "string",
                          "x-ms-enum": {
                            "modelAsString": true,
                            "name": "SamplingType",
                            "values": [
                              {
                                "description": "Fixed-rate sampling.",
                                "value": "fixed"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "verbosity": {
                      "description": "The verbosity level applied to traces emitted by trace policies.",
                      "enum": [
                        "verbose",
                        "information",
                        "error"
                      ],
                      "type": "string",
                      "x-ms-enum": {
                        "modelAsString": true,
                        "name": "Verbosity",
                        "values": [
                          {
                            "description": "All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance.",
                            "value": "verbose"
                          },
                          {
                            "description": "Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "information"
                          },
                          {
                            "description": "Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance.",
                            "value": "error"
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "loggerId"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "description": "Error Response.",
              "properties": {
                "error": {
                  "description": "Error Body contract.",
                  "properties": {
                    "code": {
                      "description": "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.",
                      "type": "string"
                    },
                    "details": {
                      "description": "The list of invalid fields send in request, in case of validation error.",
                      "items": {
                        "description": "Error Field contract.",
                        "properties": {
                          "code": {
                            "description": "Property level error code.",
                            "type": "string"
                          },
                          "message": {
                            "description": "Human-readable representation of property-level error.",
                            "type": "string"
                          },
                          "target": {
                            "description": "Property name.",
                            "type": "string"
                          }
                        }
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "Human-readable representation of the error.",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Diagnostic"
        ],
        "x-ms-examples": {
          "ApiManagementCreateDiagnostic": {
            "parameters": {
              "api-version": "2019-01-01",
              "diagnosticId": "applicationinsights",
              "parameters": {
                "properties": {
                  "alwaysLog": "allErrors",
                  "backend": {
                    "request": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    },
                    "response": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    }
                  },
                  "frontend": {
                    "request": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    },
                    "response": {
                      "body": {
                        "bytes": 512
                      },
                      "headers": [
                        "Content-type"
                      ]
                    }
                  },
                  "loggerId": "/loggers/azuremonitor",
                  "sampling": {
                    "percentage": 50,
                    "samplingType": "fixed"
                  }
                }
              },
              "resourceGroupName": "rg1",
              "serviceName": "apimService1",
              "subscriptionId": "subid"
            },
            "responses": {
              "200": {
                "body": {
                  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights",
                  "name": "applicationinsights",
                  "properties": {
                    "alwaysLog": "allErrors",
                    "backend": {
                      "request": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      },
                      "response": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      }
                    },
                    "frontend": {
                      "request": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      },
                      "response": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      }
                    },
                    "loggerId": "/loggers/applicationinsights",
                    "sampling": {
                      "percentage": 50,
                      "samplingType": "fixed"
                    }
                  },
                  "type": "Microsoft.ApiManagement/service/diagnostics"
                }
              },
              "201": {
                "body": {
                  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights",
                  "name": "applicationinsights",
                  "properties": {
                    "alwaysLog": "allErrors",
                    "backend": {
                      "request": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      },
                      "response": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      }
                    },
                    "frontend": {
                      "request": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      },
                      "response": {
                        "body": {
                          "bytes": 512
                        },
                        "headers": [
                          "Content-type"
                        ]
                      }
                    },
                    "loggerId": "/loggers/azuremonitor",
                    "sampling": {
                      "percentage": 50,
                      "samplingType": "fixed"
                    }
                  },
                  "type": "Microsoft.ApiManagement/service/diagnostics"
                }
              }
            }
          }
        }
      }
    }
  },
  "definitions": {}
}