# coding: utf-8

"""
    Kubernetes

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: release-1.29
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Optional
from pydantic import BaseModel, Field, StrictInt

class V1beta3QueuingConfiguration(BaseModel):
    """
    QueuingConfiguration holds the configuration parameters for queuing  # noqa: E501
    """
    hand_size: Optional[StrictInt] = Field(None, alias="handSize", description="`handSize` is a small positive number that configures the shuffle sharding of requests into queues.  When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here.  The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues).  See the user-facing documentation for more extensive guidance on setting this field.  This field has a default value of 8.")
    queue_length_limit: Optional[StrictInt] = Field(None, alias="queueLengthLimit", description="`queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; excess requests are rejected.  This value must be positive.  If not specified, it will be defaulted to 50.")
    queues: Optional[StrictInt] = Field(None, description="`queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive.  Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant.  This field has a default value of 64.")
    __properties = ["handSize", "queueLengthLimit", "queues"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> V1beta3QueuingConfiguration:
        """Create an instance of V1beta3QueuingConfiguration from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> V1beta3QueuingConfiguration:
        """Create an instance of V1beta3QueuingConfiguration from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return V1beta3QueuingConfiguration.parse_obj(obj)

        _obj = V1beta3QueuingConfiguration.parse_obj({
            "hand_size": obj.get("handSize"),
            "queue_length_limit": obj.get("queueLengthLimit"),
            "queues": obj.get("queues")
        })
        return _obj


