github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/action_run.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  from datetime import datetime
    22  from typing import Optional
    23  try:
    24      from pydantic.v1 import BaseModel, Field, StrictStr, validator
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictStr, validator
    27  
    28  class ActionRun(BaseModel):
    29      """
    30      ActionRun
    31      """
    32      run_id: StrictStr = Field(...)
    33      branch: StrictStr = Field(...)
    34      start_time: datetime = Field(...)
    35      end_time: Optional[datetime] = None
    36      event_type: StrictStr = Field(...)
    37      status: StrictStr = Field(...)
    38      commit_id: StrictStr = Field(...)
    39      __properties = ["run_id", "branch", "start_time", "end_time", "event_type", "status", "commit_id"]
    40  
    41      @validator('status')
    42      def status_validate_enum(cls, value):
    43          """Validates the enum"""
    44          if value not in ('failed', 'completed'):
    45              raise ValueError("must be one of enum values ('failed', 'completed')")
    46          return value
    47  
    48      class Config:
    49          """Pydantic configuration"""
    50          allow_population_by_field_name = True
    51          validate_assignment = True
    52  
    53      def to_str(self) -> str:
    54          """Returns the string representation of the model using alias"""
    55          return pprint.pformat(self.dict(by_alias=True))
    56  
    57      def to_json(self) -> str:
    58          """Returns the JSON representation of the model using alias"""
    59          return json.dumps(self.to_dict())
    60  
    61      @classmethod
    62      def from_json(cls, json_str: str) -> ActionRun:
    63          """Create an instance of ActionRun from a JSON string"""
    64          return cls.from_dict(json.loads(json_str))
    65  
    66      def to_dict(self):
    67          """Returns the dictionary representation of the model using alias"""
    68          _dict = self.dict(by_alias=True,
    69                            exclude={
    70                            },
    71                            exclude_none=True)
    72          return _dict
    73  
    74      @classmethod
    75      def from_dict(cls, obj: dict) -> ActionRun:
    76          """Create an instance of ActionRun from a dict"""
    77          if obj is None:
    78              return None
    79  
    80          if not isinstance(obj, dict):
    81              return ActionRun.parse_obj(obj)
    82  
    83          _obj = ActionRun.parse_obj({
    84              "run_id": obj.get("run_id"),
    85              "branch": obj.get("branch"),
    86              "start_time": obj.get("start_time"),
    87              "end_time": obj.get("end_time"),
    88              "event_type": obj.get("event_type"),
    89              "status": obj.get("status"),
    90              "commit_id": obj.get("commit_id")
    91          })
    92          return _obj
    93  
    94