vectorize_client.models.bedrock_auth_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, StrictStr, 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 BEDROCKAuthConfig(BaseModel): 27 """ 28 Authentication configuration for Amazon Bedrock 29 """ # noqa: E501 30 access_key: Annotated[str, Field(strict=True)] = Field(description="Access Key. Example: Enter your Amazon Bedrock Access Key", alias="access-key") 31 key: Annotated[str, Field(strict=True)] = Field(description="Secret Key. Example: Enter your Amazon Bedrock Secret Key") 32 region: StrictStr = Field(description="Region. Example: Region Name") 33 __properties: ClassVar[List[str]] = ["access-key", "key", "region"] 34 35 @field_validator('access_key') 36 def access_key_validate_regular_expression(cls, value): 37 """Validates the regular expression""" 38 if not re.match(r"^\S.*\S$|^\S$", value): 39 raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/") 40 return value 41 42 @field_validator('key') 43 def key_validate_regular_expression(cls, value): 44 """Validates the regular expression""" 45 if not re.match(r"^\S.*\S$|^\S$", value): 46 raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/") 47 return value 48 49 model_config = ConfigDict( 50 populate_by_name=True, 51 validate_assignment=True, 52 protected_namespaces=(), 53 ) 54 55 56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True)) 59 60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 63 return json.dumps(self.to_dict()) 64 65 @classmethod 66 def from_json(cls, json_str: str) -> Optional[Self]: 67 """Create an instance of BEDROCKAuthConfig from a JSON string""" 68 return cls.from_dict(json.loads(json_str)) 69 70 def to_dict(self) -> Dict[str, Any]: 71 """Return the dictionary representation of the model using alias. 72 73 This has the following differences from calling pydantic's 74 `self.model_dump(by_alias=True)`: 75 76 * `None` is only added to the output dict for nullable fields that 77 were set at model initialization. Other fields with value `None` 78 are ignored. 79 """ 80 excluded_fields: Set[str] = set([ 81 ]) 82 83 _dict = self.model_dump( 84 by_alias=True, 85 exclude=excluded_fields, 86 exclude_none=True, 87 ) 88 return _dict 89 90 @classmethod 91 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 92 """Create an instance of BEDROCKAuthConfig from a dict""" 93 if obj is None: 94 return None 95 96 if not isinstance(obj, dict): 97 return cls.model_validate(obj) 98 99 _obj = cls.model_validate({ 100 "access-key": obj.get("access-key"), 101 "key": obj.get("key"), 102 "region": obj.get("region") 103 }) 104 return _obj
27class BEDROCKAuthConfig(BaseModel): 28 """ 29 Authentication configuration for Amazon Bedrock 30 """ # noqa: E501 31 access_key: Annotated[str, Field(strict=True)] = Field(description="Access Key. Example: Enter your Amazon Bedrock Access Key", alias="access-key") 32 key: Annotated[str, Field(strict=True)] = Field(description="Secret Key. Example: Enter your Amazon Bedrock Secret Key") 33 region: StrictStr = Field(description="Region. Example: Region Name") 34 __properties: ClassVar[List[str]] = ["access-key", "key", "region"] 35 36 @field_validator('access_key') 37 def access_key_validate_regular_expression(cls, value): 38 """Validates the regular expression""" 39 if not re.match(r"^\S.*\S$|^\S$", value): 40 raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/") 41 return value 42 43 @field_validator('key') 44 def key_validate_regular_expression(cls, value): 45 """Validates the regular expression""" 46 if not re.match(r"^\S.*\S$|^\S$", value): 47 raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/") 48 return value 49 50 model_config = ConfigDict( 51 populate_by_name=True, 52 validate_assignment=True, 53 protected_namespaces=(), 54 ) 55 56 57 def to_str(self) -> str: 58 """Returns the string representation of the model using alias""" 59 return pprint.pformat(self.model_dump(by_alias=True)) 60 61 def to_json(self) -> str: 62 """Returns the JSON representation of the model using alias""" 63 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 64 return json.dumps(self.to_dict()) 65 66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of BEDROCKAuthConfig from a JSON string""" 69 return cls.from_dict(json.loads(json_str)) 70 71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 """ 81 excluded_fields: Set[str] = set([ 82 ]) 83 84 _dict = self.model_dump( 85 by_alias=True, 86 exclude=excluded_fields, 87 exclude_none=True, 88 ) 89 return _dict 90 91 @classmethod 92 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 93 """Create an instance of BEDROCKAuthConfig from a dict""" 94 if obj is None: 95 return None 96 97 if not isinstance(obj, dict): 98 return cls.model_validate(obj) 99 100 _obj = cls.model_validate({ 101 "access-key": obj.get("access-key"), 102 "key": obj.get("key"), 103 "region": obj.get("region") 104 }) 105 return _obj
Authentication configuration for Amazon Bedrock
36 @field_validator('access_key') 37 def access_key_validate_regular_expression(cls, value): 38 """Validates the regular expression""" 39 if not re.match(r"^\S.*\S$|^\S$", value): 40 raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/") 41 return value
Validates the regular expression
43 @field_validator('key') 44 def key_validate_regular_expression(cls, value): 45 """Validates the regular expression""" 46 if not re.match(r"^\S.*\S$|^\S$", value): 47 raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/") 48 return value
Validates the regular expression
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
57 def to_str(self) -> str: 58 """Returns the string representation of the model using alias""" 59 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
61 def to_json(self) -> str: 62 """Returns the JSON representation of the model using alias""" 63 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 64 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of BEDROCKAuthConfig from a JSON string""" 69 return cls.from_dict(json.loads(json_str))
Create an instance of BEDROCKAuthConfig from a JSON string
71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 """ 81 excluded_fields: Set[str] = set([ 82 ]) 83 84 _dict = self.model_dump( 85 by_alias=True, 86 exclude=excluded_fields, 87 exclude_none=True, 88 ) 89 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.
91 @classmethod 92 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 93 """Create an instance of BEDROCKAuthConfig from a dict""" 94 if obj is None: 95 return None 96 97 if not isinstance(obj, dict): 98 return cls.model_validate(obj) 99 100 _obj = cls.model_validate({ 101 "access-key": obj.get("access-key"), 102 "key": obj.get("key"), 103 "region": obj.get("region") 104 }) 105 return _obj
Create an instance of BEDROCKAuthConfig from a dict