vectorize_client.models.elastic_config
Vectorize API
API for Vectorize services (Beta)
The version of the OpenAPI document: 0.1.2 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4 Vectorize API 5 6 API for Vectorize services (Beta) 7 8 The version of the OpenAPI document: 0.1.2 9 Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11 Do not edit the class manually. 12""" # noqa: E501 13 14 15from __future__ import annotations 16import pprint 17import re # noqa: F401 18import json 19 20from pydantic import BaseModel, ConfigDict, Field, field_validator 21from typing import Any, ClassVar, Dict, List 22from typing_extensions import Annotated 23from typing import Optional, Set 24from typing_extensions import Self 25 26class ELASTICConfig(BaseModel): 27 """ 28 Configuration for Elasticsearch connector 29 """ # noqa: E501 30 index: Annotated[str, Field(strict=True, max_length=255)] = Field(description="Index Name. Example: Enter index name") 31 __properties: ClassVar[List[str]] = ["index"] 32 33 @field_validator('index') 34 def index_validate_regular_expression(cls, value): 35 """Validates the regular expression""" 36 if not re.match(r"^(?!.*(--|\.\.))(?!^[\-.])(?!.*[\-.]$)[a-z0-9-.]*$", value): 37 raise ValueError(r"must validate the regular expression /^(?!.*(--|\.\.))(?!^[\-.])(?!.*[\-.]$)[a-z0-9-.]*$/") 38 return value 39 40 model_config = ConfigDict( 41 populate_by_name=True, 42 validate_assignment=True, 43 protected_namespaces=(), 44 ) 45 46 47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True)) 50 51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 54 return json.dumps(self.to_dict()) 55 56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of ELASTICConfig from a JSON string""" 59 return cls.from_dict(json.loads(json_str)) 60 61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 """ 71 excluded_fields: Set[str] = set([ 72 ]) 73 74 _dict = self.model_dump( 75 by_alias=True, 76 exclude=excluded_fields, 77 exclude_none=True, 78 ) 79 return _dict 80 81 @classmethod 82 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 83 """Create an instance of ELASTICConfig from a dict""" 84 if obj is None: 85 return None 86 87 if not isinstance(obj, dict): 88 return cls.model_validate(obj) 89 90 _obj = cls.model_validate({ 91 "index": obj.get("index") 92 }) 93 return _obj
class
ELASTICConfig(pydantic.main.BaseModel):
27class ELASTICConfig(BaseModel): 28 """ 29 Configuration for Elasticsearch connector 30 """ # noqa: E501 31 index: Annotated[str, Field(strict=True, max_length=255)] = Field(description="Index Name. Example: Enter index name") 32 __properties: ClassVar[List[str]] = ["index"] 33 34 @field_validator('index') 35 def index_validate_regular_expression(cls, value): 36 """Validates the regular expression""" 37 if not re.match(r"^(?!.*(--|\.\.))(?!^[\-.])(?!.*[\-.]$)[a-z0-9-.]*$", value): 38 raise ValueError(r"must validate the regular expression /^(?!.*(--|\.\.))(?!^[\-.])(?!.*[\-.]$)[a-z0-9-.]*$/") 39 return value 40 41 model_config = ConfigDict( 42 populate_by_name=True, 43 validate_assignment=True, 44 protected_namespaces=(), 45 ) 46 47 48 def to_str(self) -> str: 49 """Returns the string representation of the model using alias""" 50 return pprint.pformat(self.model_dump(by_alias=True)) 51 52 def to_json(self) -> str: 53 """Returns the JSON representation of the model using alias""" 54 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 return json.dumps(self.to_dict()) 56 57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of ELASTICConfig from a JSON string""" 60 return cls.from_dict(json.loads(json_str)) 61 62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 """ 72 excluded_fields: Set[str] = set([ 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 return _dict 81 82 @classmethod 83 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 84 """Create an instance of ELASTICConfig from a dict""" 85 if obj is None: 86 return None 87 88 if not isinstance(obj, dict): 89 return cls.model_validate(obj) 90 91 _obj = cls.model_validate({ 92 "index": obj.get("index") 93 }) 94 return _obj
Configuration for Elasticsearch connector
index: typing.Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), MaxLen(max_length=255)])]
@field_validator('index')
def
index_validate_regular_expression(cls, value):
34 @field_validator('index') 35 def index_validate_regular_expression(cls, value): 36 """Validates the regular expression""" 37 if not re.match(r"^(?!.*(--|\.\.))(?!^[\-.])(?!.*[\-.]$)[a-z0-9-.]*$", value): 38 raise ValueError(r"must validate the regular expression /^(?!.*(--|\.\.))(?!^[\-.])(?!.*[\-.]$)[a-z0-9-.]*$/") 39 return value
Validates the regular expression
model_config =
{'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': (), 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
def
to_str(self) -> str:
48 def to_str(self) -> str: 49 """Returns the string representation of the model using alias""" 50 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
def
to_json(self) -> str:
52 def to_json(self) -> str: 53 """Returns the JSON representation of the model using alias""" 54 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
@classmethod
def
from_json(cls, json_str: str) -> Optional[Self]:
57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of ELASTICConfig from a JSON string""" 60 return cls.from_dict(json.loads(json_str))
Create an instance of ELASTICConfig from a JSON string
def
to_dict(self) -> Dict[str, Any]:
62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 """ 72 excluded_fields: Set[str] = set([ 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True)
:
None
is only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNone
are ignored.
@classmethod
def
from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82 @classmethod 83 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 84 """Create an instance of ELASTICConfig from a dict""" 85 if obj is None: 86 return None 87 88 if not isinstance(obj, dict): 89 return cls.model_validate(obj) 90 91 _obj = cls.model_validate({ 92 "index": obj.get("index") 93 }) 94 return _obj
Create an instance of ELASTICConfig from a dict