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

Authentication configuration for Amazon S3

access_key: typing.Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])]
secret_key: typing.Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])]
bucket_name: typing.Annotated[str, Strict(strict=True)]
endpoint: Optional[Annotated[str, Strict(strict=True)]]
region: Optional[Annotated[str, Strict(strict=True)]]
archiver: typing.Annotated[bool, Strict(strict=True)]
@field_validator('access_key')
def access_key_validate_regular_expression(cls, value):
39    @field_validator('access_key')
40    def access_key_validate_regular_expression(cls, value):
41        """Validates the regular expression"""
42        if not re.match(r"^\S.*\S$|^\S$", value):
43            raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/")
44        return value

Validates the regular expression

@field_validator('secret_key')
def secret_key_validate_regular_expression(cls, value):
46    @field_validator('secret_key')
47    def secret_key_validate_regular_expression(cls, value):
48        """Validates the regular expression"""
49        if not re.match(r"^\S.*\S$|^\S$", value):
50            raise ValueError(r"must validate the regular expression /^\S.*\S$|^\S$/")
51        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:
60    def to_str(self) -> str:
61        """Returns the string representation of the model using alias"""
62        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

def to_json(self) -> str:
64    def to_json(self) -> str:
65        """Returns the JSON representation of the model using alias"""
66        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67        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]:
69    @classmethod
70    def from_json(cls, json_str: str) -> Optional[Self]:
71        """Create an instance of AWSS3AuthConfig from a JSON string"""
72        return cls.from_dict(json.loads(json_str))

Create an instance of AWSS3AuthConfig from a JSON string

def to_dict(self) -> Dict[str, Any]:
74    def to_dict(self) -> Dict[str, Any]:
75        """Return the dictionary representation of the model using alias.
76
77        This has the following differences from calling pydantic's
78        `self.model_dump(by_alias=True)`:
79
80        * `None` is only added to the output dict for nullable fields that
81          were set at model initialization. Other fields with value `None`
82          are ignored.
83        """
84        excluded_fields: Set[str] = set([
85        ])
86
87        _dict = self.model_dump(
88            by_alias=True,
89            exclude=excluded_fields,
90            exclude_none=True,
91        )
92        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 value None are ignored.
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 94    @classmethod
 95    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 96        """Create an instance of AWSS3AuthConfig from a dict"""
 97        if obj is None:
 98            return None
 99
100        if not isinstance(obj, dict):
101            return cls.model_validate(obj)
102
103        _obj = cls.model_validate({
104            "access-key": obj.get("access-key"),
105            "secret-key": obj.get("secret-key"),
106            "bucket-name": obj.get("bucket-name"),
107            "endpoint": obj.get("endpoint"),
108            "region": obj.get("region"),
109            "archiver": obj.get("archiver") if obj.get("archiver") is not None else False
110        })
111        return _obj

Create an instance of AWSS3AuthConfig from a dict