API Connection Model

Smarter API Connection Manifest Constants.

Smarter API Manifest - ApiConnection.spec.

class smarter.apps.connection.manifest.models.api_connection.spec.ApiConnection(*, baseUrl, apiKey=None, authMethod='none', timeout=30, proxyProtocol=None, proxyHost=None, proxyPort=None, proxyUsername=None, proxyPassword=None)[source]

Bases: SmarterBasePydanticModel

Smarter API - generic API Connection class.

apiKey: str | None
authMethod: str
baseUrl: str
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

proxyHost: str | None
proxyPassword: str | None
proxyPort: int | None
proxyProtocol: str | None
proxyUsername: str | None
timeout: int
classmethod validate_api_key(v)[source]

Accept apiKey as is: it is the name of a Secret, not the key itself.

Parameters:

v – The name of the Secret that holds the api key.

Returns:

The value, unchanged.

classmethod validate_auth_method(v)[source]

Validate that authMethod is one of the supported authentication methods.

Parameters:

v – The authentication method.

Returns:

The authentication method, unchanged.

Raises:

SAMValidationError – if it is not in AuthMethods.all().

classmethod validate_proxy_host(v)[source]

Validate that proxyHost, when set, is a valid domain.

Parameters:

v – The proxy host, or None.

Returns:

The proxy host, unchanged.

Raises:

SAMValidationError – if it is not a valid domain.

classmethod validate_proxy_password(v)[source]

Accept proxyPassword as is: it is the name of a Secret, not the password itself.

Parameters:

v – The name of the Secret that holds the proxy password, or None.

Returns:

The value, unchanged.

classmethod validate_proxy_port(v)[source]

Validate that proxyPort, when set, is between 1 and 65535.

Parameters:

v – The proxy port, or None.

Returns:

The proxy port, unchanged.

Raises:

SAMValidationError – if it is out of range.

classmethod validate_proxy_protocol(v)[source]

Validate that proxyProtocol, when set, is http or https.

Parameters:

v – The proxy protocol, or None.

Returns:

The proxy protocol, unchanged.

Raises:

SAMValidationError – if it is set to any other value.

classmethod validate_proxy_username(v)[source]

Validate that proxyUsername, when set, contains no illegal characters.

Parameters:

v – The proxy username, or None.

Returns:

The proxy username, unchanged.

Raises:

SAMValidationError – if it is not a clean string.

classmethod validate_root_domain(v)[source]

Validate that baseUrl is a valid http or https url.

Parameters:

v – The base url.

Returns:

The base url, unchanged.

Raises:

SAMValidationError – if the url is not valid.

classmethod validate_timeout(v)[source]

Validate that timeout is at least 1.

Parameters:

v – The timeout.

Returns:

The timeout, unchanged.

Raises:

SAMValidationError – if it is less than 1.

class smarter.apps.connection.manifest.models.api_connection.spec.SAMApiConnectionSpec(*, connection)[source]

Bases: AbstractSAMSpecBase

Smarter API Api Connection Manifest ApiConnection.spec.

class_identifier: ClassVar[str] = 'ApiConnection.spec'
connection: ApiConnection
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

Smarter Connection Manifest

class smarter.apps.connection.manifest.models.api_connection.model.SAMApiConnection(*, apiVersion, kind, metadata, spec, status=None)[source]

Bases: SAMConnectionCommon

Smarter API Connection Manifest - ApiConnection Model

class_identifier: ClassVar[str] = 'ApiConnection'
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

spec: SAMApiConnectionSpec