# 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, StrictStr

class V1ServiceAccountTokenProjection(BaseModel):
    """
    ServiceAccountTokenProjection represents a projected service account token volume. This projection can be used to insert a service account token into the pods runtime filesystem for use against APIs (Kubernetes API Server or otherwise).  # noqa: E501
    """
    audience: Optional[StrictStr] = Field(None, description="audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver.")
    expiration_seconds: Optional[StrictInt] = Field(None, alias="expirationSeconds", description="expirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes.")
    path: StrictStr = Field(..., description="path is the path relative to the mount point of the file to project the token into.")
    __properties = ["audience", "expirationSeconds", "path"]

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

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

        _obj = V1ServiceAccountTokenProjection.parse_obj({
            "audience": obj.get("audience"),
            "expiration_seconds": obj.get("expirationSeconds"),
            "path": obj.get("path")
        })
        return _obj


