github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/login_config.py (about)

     1  # coding: utf-8
     2  
     3  """
     4      lakeFS API
     5  
     6      lakeFS HTTP API
     7  
     8      The version of the OpenAPI document: 1.0.0
     9      Contact: services@treeverse.io
    10      Generated by OpenAPI Generator (https://openapi-generator.tech)
    11  
    12      Do not edit the class manually.
    13  """  # noqa: E501
    14  
    15  
    16  from __future__ import annotations
    17  import pprint
    18  import re  # noqa: F401
    19  import json
    20  
    21  
    22  from typing import List, Optional
    23  try:
    24      from pydantic.v1 import BaseModel, Field, StrictStr, conlist, validator
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictStr, conlist, validator
    27  
    28  class LoginConfig(BaseModel):
    29      """
    30      LoginConfig
    31      """
    32      rbac: Optional[StrictStr] = Field(None, alias="RBAC", description="RBAC will remain enabled on GUI if \"external\".  That only works with an external auth service. ")
    33      login_url: StrictStr = Field(..., description="primary URL to use for login.")
    34      login_failed_message: Optional[StrictStr] = Field(None, description="message to display to users who fail to login; a full sentence that is rendered in HTML and may contain a link to a secondary login method ")
    35      fallback_login_url: Optional[StrictStr] = Field(None, description="secondary URL to offer users to use for login.")
    36      fallback_login_label: Optional[StrictStr] = Field(None, description="label to place on fallback_login_url.")
    37      login_cookie_names: conlist(StrictStr) = Field(..., description="cookie names used to store JWT")
    38      logout_url: StrictStr = Field(..., description="URL to use for logging out.")
    39      __properties = ["RBAC", "login_url", "login_failed_message", "fallback_login_url", "fallback_login_label", "login_cookie_names", "logout_url"]
    40  
    41      @validator('rbac')
    42      def rbac_validate_enum(cls, value):
    43          """Validates the enum"""
    44          if value is None:
    45              return value
    46  
    47          if value not in ('simplified', 'external'):
    48              raise ValueError("must be one of enum values ('simplified', 'external')")
    49          return value
    50  
    51      class Config:
    52          """Pydantic configuration"""
    53          allow_population_by_field_name = True
    54          validate_assignment = True
    55  
    56      def to_str(self) -> str:
    57          """Returns the string representation of the model using alias"""
    58          return pprint.pformat(self.dict(by_alias=True))
    59  
    60      def to_json(self) -> str:
    61          """Returns the JSON representation of the model using alias"""
    62          return json.dumps(self.to_dict())
    63  
    64      @classmethod
    65      def from_json(cls, json_str: str) -> LoginConfig:
    66          """Create an instance of LoginConfig from a JSON string"""
    67          return cls.from_dict(json.loads(json_str))
    68  
    69      def to_dict(self):
    70          """Returns the dictionary representation of the model using alias"""
    71          _dict = self.dict(by_alias=True,
    72                            exclude={
    73                            },
    74                            exclude_none=True)
    75          return _dict
    76  
    77      @classmethod
    78      def from_dict(cls, obj: dict) -> LoginConfig:
    79          """Create an instance of LoginConfig from a dict"""
    80          if obj is None:
    81              return None
    82  
    83          if not isinstance(obj, dict):
    84              return LoginConfig.parse_obj(obj)
    85  
    86          _obj = LoginConfig.parse_obj({
    87              "rbac": obj.get("RBAC"),
    88              "login_url": obj.get("login_url"),
    89              "login_failed_message": obj.get("login_failed_message"),
    90              "fallback_login_url": obj.get("fallback_login_url"),
    91              "fallback_login_label": obj.get("fallback_login_label"),
    92              "login_cookie_names": obj.get("login_cookie_names"),
    93              "logout_url": obj.get("logout_url")
    94          })
    95          return _obj
    96  
    97