SAM Enumerations Classes

Smarter API Manifests Enumerations.

class smarter.lib.manifest.enum.SAMDataFormats(*values)[source]

Bases: SmarterEnumAbstract

Data format enumeration.

Used to specify the format of data being handled, such as JSON or YAML.

JSON

Represents data in JSON format.

YAML

Represents data in YAML format.

UNKNOWN

Represents an unknown or unsupported data format.

JSON = 'json'
UNKNOWN = 'unknown'
YAML = 'yaml'
exception smarter.lib.manifest.enum.SAMEnumException(message='')[source]

Bases: SAMExceptionBase

Base exception for Smarter API Manifest enumerations.

property get_formatted_err_message
class smarter.lib.manifest.enum.SAMKeys(*values)[source]

Bases: SmarterEnumAbstract

Smarter API required keys enumeration.

APIVERSION

The API version key.

KIND

The kind key.

METADATA

The metadata key.

SPEC

The specification key.

STATUS

The status key.

APIVERSION = 'apiVersion'
KIND = 'kind'
METADATA = 'metadata'
SPEC = 'spec'
STATUS = 'status'
class smarter.lib.manifest.enum.SAMMetadataKeys(*values)[source]

Bases: SmarterEnumAbstract

Smarter API Plugin Metadata keys enumeration.

AUTHOR

The author key.

NAME

The name key.

DESCRIPTION

The description key.

VERSION

The version key.

TAGS

The tags key.

ANNOTATIONS

The annotations key.

ANNOTATIONS = 'annotations'
AUTHOR = 'author'
DESCRIPTION = 'description'
NAME = 'name'
TAGS = 'tags'
VERSION = 'version'
class smarter.lib.manifest.enum.SAMSpecificationKeyOptions(*values)[source]

Bases: SmarterEnumAbstract

Key types enumeration. Used to specify whether a key in the specification is required, optional, or read-only.

REQUIRED

Indicates that the key is mandatory.

OPTIONAL

Indicates that the key is optional.

READONLY

Indicates that the key is read-only and cannot be modified.

OPTIONAL = 'optional'
READONLY = 'readonly'
REQUIRED = 'required'
class smarter.lib.manifest.enum.SCLIResponseGet(*values)[source]

Bases: SmarterEnumAbstract

CLI get response enumeration.

KWARGS

The kwargs key.

DATA

The data key.

DATA = 'data'
KWARGS = 'kwargs'
class smarter.lib.manifest.enum.SCLIResponseGetData(*values)[source]

Bases: SmarterEnumAbstract

CLI get response data enumeration.

TITLES

The titles key.

ITEMS

The items key.

ITEMS = 'items'
TITLES = 'titles'

CLI Broker Classes

Smarter API command-line interface Brokers. These are the broker classes that implement the broker service pattern for an underlying object. Brokers receive a Yaml manifest representation of a model, convert this to a Pydantic model, and then instantiate the appropriate Python class that performs the necessary operations to facilitate cli requests that include:

  • delete

  • deploy

  • describe

  • get

  • logs

  • manifest

  • undeploy

class smarter.apps.api.v1.cli.brokers.Brokers[source]

Bases: object

The Broker service pattern for the Smarter Broker Model.

This class provides the mapping and logic for selecting the correct Broker implementation based on the manifest Kind. Brokers are used throughout the api/v1/cli interface to process Smarter YAML manifests and to facilitate common CLI operations, including:

  • apply

  • delete

  • deploy

  • describe

  • get

  • manifest

  • example

  • status

  • undeploy

  • logs

  • schema

Each Broker is responsible for brokering the correct implementation class for a given operation by analyzing the manifest’s Kind field. This enables a unified interface for handling different resource types in the Smarter platform.

Key Methods

get_broker(kind: str) -> Optional[Type[AbstractBroker]]:

Returns the Broker class definition for the given manifest kind. The lookup is case-insensitive.

Usage

Brokers are primarily used for processing Smarter YAML manifests in CLI workflows. By calling get_broker(), you can retrieve the appropriate Broker class to handle a specific resource type.

Example

>>> broker_cls = Brokers.get_broker("Account")
>>> broker = broker_cls()
>>> broker.describe(...)
classmethod all_brokers()[source]
Return type:

list[str]

classmethod from_url(url)[source]

Returns the kind of broker from the given URL. This is used to determine the broker to use when the kind is not provided in the request.

example: http://localhost:9357/api/v1/cli/example_manifest/account/ returns: “Account”

Return type:

Optional[str]

classmethod get_broker(kind)[source]

Case insensitive broker getter.

Return type:

Optional[Type[AbstractBroker]]

classmethod get_broker_kind(kind)[source]

Case insensitive broker kind getter. Returns the original SAMKinds key string from cls._brokers for the given kind.

Return type:

Optional[str]

classmethod to_camel_case(snake_str)[source]