{
  "openapi": "3.0.0",
  "info": {
    "description": "Provides create, read, update and delete functionality for Azure SQL Database resources including servers, databases, elastic pools, recommendations, operations, and usage metrics.",
    "title": "Azure SQL Database",
    "version": "2014-04-01",
    "x-jentic-source-url": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/usages.json"
  },
  "servers": [
    {
      "url": "https://management.azure.com/"
    }
  ],
  "paths": {
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages": {
      "get": {
        "parameters": [
          {
            "$ref": "../../../common/v1/types.json#/components/parameters/ApiVersionParameter"
          },
          {
            "$ref": "../../../common/v1/types.json#/components/parameters/SubscriptionIdParameter"
          },
          {
            "$ref": "../../../common/v1/types.json#/components/parameters/ResourceGroupParameter"
          },
          {
            "$ref": "#/components/parameters/ServerNameParameter"
          },
          {
            "description": "The name of the database.",
            "in": "path",
            "name": "databaseName",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatabaseUsageListResult"
                }
              }
            },
            "description": "OK"
          }
        },
        "tags": [
          "Databases"
        ],
        "description": "Returns database usages.",
        "operationId": "DatabaseUsages_ListByDatabase",
        "x-ms-examples": {
          "List database usage metrics": {
            "$ref": "./examples/DatabaseUsageMetricsList.json"
          }
        },
        "x-ms-pageable": {
          "nextLinkName": null
        }
      }
    },
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages": {
      "get": {
        "parameters": [
          {
            "$ref": "../../../common/v1/types.json#/components/parameters/ApiVersionParameter"
          },
          {
            "$ref": "../../../common/v1/types.json#/components/parameters/SubscriptionIdParameter"
          },
          {
            "$ref": "../../../common/v1/types.json#/components/parameters/ResourceGroupParameter"
          },
          {
            "$ref": "#/components/parameters/ServerNameParameter"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerUsageListResult"
                }
              }
            },
            "description": "OK"
          }
        },
        "tags": [
          "Servers"
        ],
        "description": "Returns server usages.",
        "operationId": "ServerUsages_ListByServer",
        "x-ms-examples": {
          "List servers usages": {
            "$ref": "./examples/ServerUsageMetricsList.json"
          }
        },
        "x-ms-pageable": {
          "nextLinkName": null
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ServerNameParameter": {
        "description": "The name of the server.",
        "in": "path",
        "name": "serverName",
        "required": true,
        "schema": {
          "type": "string"
        },
        "x-ms-parameter-location": "method"
      }
    },
    "schemas": {
      "DatabaseUsage": {
        "description": "The database usages.",
        "properties": {
          "currentValue": {
            "description": "The current value of the usage metric.",
            "format": "double",
            "readOnly": true,
            "type": "number"
          },
          "displayName": {
            "description": "The usage metric display name.",
            "readOnly": true,
            "type": "string"
          },
          "limit": {
            "description": "The current limit of the usage metric.",
            "format": "double",
            "readOnly": true,
            "type": "number"
          },
          "name": {
            "description": "The name of the usage metric.",
            "readOnly": true,
            "type": "string"
          },
          "nextResetTime": {
            "description": "The next reset time for the usage metric (ISO8601 format).",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
          },
          "resourceName": {
            "description": "The name of the resource.",
            "readOnly": true,
            "type": "string"
          },
          "unit": {
            "description": "The units of the usage metric.",
            "readOnly": true,
            "type": "string"
          }
        },
        "type": "object"
      },
      "DatabaseUsageListResult": {
        "description": "The response to a list database metrics request.",
        "properties": {
          "value": {
            "description": "The list of database usages for the database.",
            "items": {
              "$ref": "#/components/schemas/DatabaseUsage"
            },
            "type": "array"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "ServerUsage": {
        "description": "Represents server metrics.",
        "properties": {
          "currentValue": {
            "description": "The current value of the metric.",
            "format": "double",
            "readOnly": true,
            "type": "number"
          },
          "displayName": {
            "description": "The metric display name.",
            "readOnly": true,
            "type": "string"
          },
          "limit": {
            "description": "The current limit of the metric.",
            "format": "double",
            "readOnly": true,
            "type": "number"
          },
          "name": {
            "description": "Name of the server usage metric.",
            "readOnly": true,
            "type": "string"
          },
          "nextResetTime": {
            "description": "The next reset time for the metric (ISO8601 format).",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
          },
          "resourceName": {
            "description": "The name of the resource.",
            "readOnly": true,
            "type": "string"
          },
          "unit": {
            "description": "The units of the metric.",
            "readOnly": true,
            "type": "string"
          }
        },
        "type": "object"
      },
      "ServerUsageListResult": {
        "description": "Represents the response to a list server metrics request.",
        "properties": {
          "value": {
            "description": "The list of server metrics for the server.",
            "items": {
              "$ref": "#/components/schemas/ServerUsage"
            },
            "type": "array"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "azure_auth": {
        "description": "Azure Active Directory OAuth2 Flow",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
            "scopes": {
              "user_impersonation": "impersonate your user account"
            }
          }
        },
        "type": "oauth2"
      }
    }
  }
}