# 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 datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field, StrictInt

class V1HorizontalPodAutoscalerStatus(BaseModel):
    """
    current status of a horizontal pod autoscaler  # noqa: E501
    """
    current_cpu_utilization_percentage: Optional[StrictInt] = Field(None, alias="currentCPUUtilizationPercentage", description="currentCPUUtilizationPercentage is the current average CPU utilization over all pods, represented as a percentage of requested CPU, e.g. 70 means that an average pod is using now 70% of its requested CPU.")
    current_replicas: StrictInt = Field(..., alias="currentReplicas", description="currentReplicas is the current number of replicas of pods managed by this autoscaler.")
    desired_replicas: StrictInt = Field(..., alias="desiredReplicas", description="desiredReplicas is the  desired number of replicas of pods managed by this autoscaler.")
    last_scale_time: Optional[datetime] = Field(None, alias="lastScaleTime", description="lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods; used by the autoscaler to control how often the number of pods is changed.")
    observed_generation: Optional[StrictInt] = Field(None, alias="observedGeneration", description="observedGeneration is the most recent generation observed by this autoscaler.")
    __properties = ["currentCPUUtilizationPercentage", "currentReplicas", "desiredReplicas", "lastScaleTime", "observedGeneration"]

    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) -> V1HorizontalPodAutoscalerStatus:
        """Create an instance of V1HorizontalPodAutoscalerStatus 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) -> V1HorizontalPodAutoscalerStatus:
        """Create an instance of V1HorizontalPodAutoscalerStatus from a dict"""
        if obj is None:
            return None

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

        _obj = V1HorizontalPodAutoscalerStatus.parse_obj({
            "current_cpu_utilization_percentage": obj.get("currentCPUUtilizationPercentage"),
            "current_replicas": obj.get("currentReplicas"),
            "desired_replicas": obj.get("desiredReplicas"),
            "last_scale_time": obj.get("lastScaleTime"),
            "observed_generation": obj.get("observedGeneration")
        })
        return _obj


