class_docstr: Client for interacting with the MLflow Gateway API.
  
  :param gateway_uri: Optional URI of the gateway. If not provided, attempts to resolve from
      first the stored result of `set_gateway_uri()`, then the  environment variable
      `MLFLOW_GATEWAY_URI`.
class_docstr_tok: ["Client","for","interacting","with","the","MLflow","Gateway","API",".",":","param","gateway_uri",":","Optional","URI","of","the","gateway",".","If","not","provided",",","attempts","to","resolve","from","first","the","stored","result","of","`","set_gateway_uri","(",")","`",",","then","the","environment","variable","`","MLFLOW_GATEWAY_URI","`","."]
docstr: Set limits on an existing route in the Gateway.
  
  .. warning::
  
      This API is **only available** when running within Databricks.
  
  Args:
      route: The name of the route to set limits on.
      limits: Limits (Array of dictionary) to set on the route. Each limit is defined by a
          dictionary representing the limit details to be associated with the route. This
          dictionary should define:
          - renewal_period: a string representing the length of the window to enforce limit on (only supports "minute" for now). # pylint: disable=line-too-long
          - calls: a non-negative integer representing the number of calls allowed per  renewal_period (e.g., 10, 0, 55). # pylint: disable=line-too-long
          - key: an optional string represents per route limit or per user limit ("user" for per user limit, "route" for per route limit, if not supplied, default to per route limit). # pylint: disable=line-too-long
  
  Returns:
      The returned data structure is a serialized representation of the `Limit`
      data structure, giving information about the renewal_period, key, and calls.
  
  Example usage:
  
  .. code-block:: python
  
      from mlflow.gateway import MlflowGatewayClient
  
      gateway_client = MlflowGatewayClient("databricks")
  
      gateway_client.set_limits(
          "my-new-route", [{"key": "user", "renewal_period": "minute", "calls": 50}]
      )
docstr_tok: ["Set","limits","on","an","existing","route","in","the","Gateway",".","..","warning",":",":","This","API","is","*","*","only","available","*","*","when","running","within","Databricks",".","Args",":","route",":","The","name","of","the","route","to","set","limits","on",".","limits",":","Limits","(","Array","of","dictionary",")","to","set","on","the","route",".","Each","limit","is","defined","by","a","dictionary","representing","the","limit","details","to","be","associated","with","the","route",".","This","dictionary","should","define",":","-","renewal_period",":","a","string","representing","the","length","of","the","window","to","enforce","limit","on","(","only","supports","``","minute","''","for","now",")",".","#","pylint",":","disable=line-too-long","-","calls",":","a","non-negative","integer","representing","the","number","of","calls","allowed","per","renewal_period","(","e.g.",",","10",",","0",",","55",")",".","#","pylint",":","disable=line-too-long","-","key",":","an","optional","string","represents","per","route","limit","or","per","user","limit","(","``","user","''","for","per","user","limit",",","``","route","''","for","per","route","limit",",","if","not","supplied",",","default","to","per","route","limit",")",".","#","pylint",":","disable=line-too-long","Returns",":","The","returned","data","structure","is","a","serialized","representation","of","the","`","Limit","`","data","structure",",","giving","information","about","the","renewal_period",",","key",",","and","calls",".","Example","usage",":","..","code-block",":",":","python","from","mlflow.gateway","import","MlflowGatewayClient","gateway_client","=","MlflowGatewayClient","(","``","databricks","''",")","gateway_client.set_limits","(","``","my-new-route","''",",","[","{","``","key","''",":","``","user","''",",","``","renewal_period","''",":","``","minute","''",",","``","calls","''",":","50","}","]",")"]
code: def set_limits(
      self, route: str, limits: List[Dict[str, Any]]
  ) -> LimitsConfig:
      """
      Set limits on an existing route in the Gateway.
  
      .. warning::
  
          This API is **only available** when running within Databricks.
  
      Args:
          route: The name of the route to set limits on.
          limits: Limits (Array of dictionary) to set on the route. Each limit is defined by a
              dictionary representing the limit details to be associated with the route. This
              dictionary should define:
              - renewal_period: a string representing the length of the window to enforce limit on (only supports "minute" for now). # pylint: disable=line-too-long
              - calls: a non-negative integer representing the number of calls allowed per  renewal_period (e.g., 10, 0, 55). # pylint: disable=line-too-long
              - key: an optional string represents per route limit or per user limit ("user" for per user limit, "route" for per route limit, if not supplied, default to per route limit). # pylint: disable=line-too-long
  
      Returns:
          The returned data structure is a serialized representation of the `Limit`
          data structure, giving information about the renewal_period, key, and calls.
  
      Example usage:
  
      .. code-block:: python
  
          from mlflow.gateway import MlflowGatewayClient
  
          gateway_client = MlflowGatewayClient("databricks")
  
          gateway_client.set_limits(
              "my-new-route", [{"key": "user", "renewal_period": "minute", "calls": 50}]
          )
      """
      payload = {
          "route": route,
          "limits": limits,
      }
  
      response = self._call_endpoint(
          "POST", MLFLOW_GATEWAY_LIMITS_BASE, json.dumps(payload)
      ).json()
      return LimitsConfig(**response)
  
imports: import json
  import logging
  from typing import Any, Dict, List, Optional
  import requests.exceptions
  from mlflow import MlflowException
  from mlflow.gateway.config import LimitsConfig, Route
  from mlflow.gateway.constants import MLFLOW_GATEWAY_CLIENT_QUERY_RETRY_CODES, MLFLOW_GATEWAY_CLIENT_QUERY_TIMEOUT_SECONDS, MLFLOW_GATEWAY_CRUD_ROUTE_BASE, MLFLOW_GATEWAY_LIMITS_BASE, MLFLOW_GATEWAY_ROUTE_BASE, MLFLOW_QUERY_SUFFIX
  from mlflow.gateway.utils import assemble_uri_path, gateway_deprecated, get_gateway_uri, resolve_route_url
  from mlflow.protos.databricks_pb2 import BAD_REQUEST
  from mlflow.store.entities.paged_list import PagedList
  from mlflow.tracking._tracking_service.utils import _get_default_host_creds
  from mlflow.utils.databricks_utils import get_databricks_host_creds
  from mlflow.utils.rest_utils import augmented_raise_for_status, http_request
  from mlflow.utils.uri import get_uri_scheme
label_desc: Use image node_id 11 for calling the MlflowGatewayClient obj's underlying member method code with example usage: obj.set_limits(route, limits) and returns: LimitsConfig