vectorize_client.models.confluence_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 CONFLUENCEAuthConfig(BaseModel): 27 """ 28 Authentication configuration for Confluence 29 """ # noqa: E501 30 username: StrictStr = Field(description="Username. Example: Enter your Confluence username") 31 api_token: Annotated[str, Field(strict=True)] = Field(description="API Token. Example: Enter your Confluence API token", alias="api-token") 32 domain: StrictStr = Field(description="Domain. Example: Enter your Confluence domain (e.g. my-domain.atlassian.net or confluence.<my-company>.com)") 33 __properties: ClassVar[List[str]] = ["username", "api-token", "domain"] 34 35 @field_validator('api_token') 36 def api_token_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 model_config = ConfigDict( 43 populate_by_name=True, 44 validate_assignment=True, 45 protected_namespaces=(), 46 ) 47 48 49 def to_str(self) -> str: 50 """Returns the string representation of the model using alias""" 51 return pprint.pformat(self.model_dump(by_alias=True)) 52 53 def to_json(self) -> str: 54 """Returns the JSON representation of the model using alias""" 55 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 return json.dumps(self.to_dict()) 57 58 @classmethod 59 def from_json(cls, json_str: str) -> Optional[Self]: 60 """Create an instance of CONFLUENCEAuthConfig from a JSON string""" 61 return cls.from_dict(json.loads(json_str)) 62 63 def to_dict(self) -> Dict[str, Any]: 64 """Return the dictionary representation of the model using alias. 65 66 This has the following differences from calling pydantic's 67 `self.model_dump(by_alias=True)`: 68 69 * `None` is only added to the output dict for nullable fields that 70 were set at model initialization. Other fields with value `None` 71 are ignored. 72 """ 73 excluded_fields: Set[str] = set([ 74 ]) 75 76 _dict = self.model_dump( 77 by_alias=True, 78 exclude=excluded_fields, 79 exclude_none=True, 80 ) 81 return _dict 82 83 @classmethod 84 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 85 """Create an instance of CONFLUENCEAuthConfig from a dict""" 86 if obj is None: 87 return None 88 89 if not isinstance(obj, dict): 90 return cls.model_validate(obj) 91 92 _obj = cls.model_validate({ 93 "username": obj.get("username"), 94 "api-token": obj.get("api-token"), 95 "domain": obj.get("domain") 96 }) 97 return _obj
class
CONFLUENCEAuthConfig(pydantic.main.BaseModel):
27class CONFLUENCEAuthConfig(BaseModel): 28 """ 29 Authentication configuration for Confluence 30 """ # noqa: E501 31 username: StrictStr = Field(description="Username. Example: Enter your Confluence username") 32 api_token: Annotated[str, Field(strict=True)] = Field(description="API Token. Example: Enter your Confluence API token", alias="api-token") 33 domain: StrictStr = Field(description="Domain. Example: Enter your Confluence domain (e.g. my-domain.atlassian.net or confluence.<my-company>.com)") 34 __properties: ClassVar[List[str]] = ["username", "api-token", "domain"] 35 36 @field_validator('api_token') 37 def api_token_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 model_config = ConfigDict( 44 populate_by_name=True, 45 validate_assignment=True, 46 protected_namespaces=(), 47 ) 48 49 50 def to_str(self) -> str: 51 """Returns the string representation of the model using alias""" 52 return pprint.pformat(self.model_dump(by_alias=True)) 53 54 def to_json(self) -> str: 55 """Returns the JSON representation of the model using alias""" 56 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 57 return json.dumps(self.to_dict()) 58 59 @classmethod 60 def from_json(cls, json_str: str) -> Optional[Self]: 61 """Create an instance of CONFLUENCEAuthConfig from a JSON string""" 62 return cls.from_dict(json.loads(json_str)) 63 64 def to_dict(self) -> Dict[str, Any]: 65 """Return the dictionary representation of the model using alias. 66 67 This has the following differences from calling pydantic's 68 `self.model_dump(by_alias=True)`: 69 70 * `None` is only added to the output dict for nullable fields that 71 were set at model initialization. Other fields with value `None` 72 are ignored. 73 """ 74 excluded_fields: Set[str] = set([ 75 ]) 76 77 _dict = self.model_dump( 78 by_alias=True, 79 exclude=excluded_fields, 80 exclude_none=True, 81 ) 82 return _dict 83 84 @classmethod 85 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 86 """Create an instance of CONFLUENCEAuthConfig from a dict""" 87 if obj is None: 88 return None 89 90 if not isinstance(obj, dict): 91 return cls.model_validate(obj) 92 93 _obj = cls.model_validate({ 94 "username": obj.get("username"), 95 "api-token": obj.get("api-token"), 96 "domain": obj.get("domain") 97 }) 98 return _obj
Authentication configuration for Confluence
api_token: typing.Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])]
@field_validator('api_token')
def
api_token_validate_regular_expression(cls, value):
36 @field_validator('api_token') 37 def api_token_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
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:
50 def to_str(self) -> str: 51 """Returns the string representation of the model using alias""" 52 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
def
to_json(self) -> str:
54 def to_json(self) -> str: 55 """Returns the JSON representation of the model using alias""" 56 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 57 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]:
59 @classmethod 60 def from_json(cls, json_str: str) -> Optional[Self]: 61 """Create an instance of CONFLUENCEAuthConfig from a JSON string""" 62 return cls.from_dict(json.loads(json_str))
Create an instance of CONFLUENCEAuthConfig from a JSON string
def
to_dict(self) -> Dict[str, Any]:
64 def to_dict(self) -> Dict[str, Any]: 65 """Return the dictionary representation of the model using alias. 66 67 This has the following differences from calling pydantic's 68 `self.model_dump(by_alias=True)`: 69 70 * `None` is only added to the output dict for nullable fields that 71 were set at model initialization. Other fields with value `None` 72 are ignored. 73 """ 74 excluded_fields: Set[str] = set([ 75 ]) 76 77 _dict = self.model_dump( 78 by_alias=True, 79 exclude=excluded_fields, 80 exclude_none=True, 81 ) 82 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]:
84 @classmethod 85 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 86 """Create an instance of CONFLUENCEAuthConfig from a dict""" 87 if obj is None: 88 return None 89 90 if not isinstance(obj, dict): 91 return cls.model_validate(obj) 92 93 _obj = cls.model_validate({ 94 "username": obj.get("username"), 95 "api-token": obj.get("api-token"), 96 "domain": obj.get("domain") 97 }) 98 return _obj
Create an instance of CONFLUENCEAuthConfig from a dict