botocraft configuration Models
These Pydantic models are used to parse and validate the YAML files in our data
directory and generate the service and manager classes that are used by the
botocraft library. They are used directly by botocraft sync to generate the
service and manager classes.
For a maintainer-oriented walkthrough of adding a new AWS service and choosing between models, managers, properties, relations, mixins, and decorators, see How to add a new service to botocraft and Service authoring reference.
Important
These models are not intended to be used directly in your code. They are intended to be used by the botocraft code generator to generate the service and manager classes.
Utility models
These models may be used as types for the fields in other models on this page.
- pydantic model botocraft.sync.models.Importable[source]
Bases:
BaseModelA configuration object for a mixin class to add to a model.
Show JSON schema
{ "title": "Importable", "description": "A configuration object for a mixin class to add to a model.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "import_path": { "title": "Import Path", "type": "string" } }, "required": [ "name", "import_path" ] }
- Fields:
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- class botocraft.sync.models.MethodDocstringDefinition(method: str | None = None, args: ~collections.OrderedDict[str, str | None] = <factory>, kwargs: ~collections.OrderedDict[str, str | None] = <factory>, return_value: str | None = None)[source]
Bases:
objectA class to hold the different parts of the docstring for a method, and render them into a single sphinx-napoleon style docstring.
- Args(formatter: DocumentationFormatter) → str[source]
Return the docstring for the positional arguments.
- Keyword_Args(formatter: DocumentationFormatter) → str[source]
Return the docstring for the keyword arguments.
- args: OrderedDict[str, str | None]
The docstrings for our positional arguments
- kwargs: OrderedDict[str, str | None]
The docstrings for our keyword arguments
Service related models
A service represents an AWS service, like ec2, ecs, s3, etc.
- pydantic model botocraft.sync.models.ServiceDefinition[source]
Bases:
BaseModelOur definition of a single AWS service, e.g.
ecs,ec2, etc.Show JSON schema
{ "$defs": { "AttributeTransformerDefinition": { "properties": { "regex": { "anyOf": [ { "$ref": "#/$defs/RegexTransformer" }, { "type": "null" } ], "default": null }, "mapping": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Mapping" }, "alias": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Alias" }, "code": { "anyOf": [ { "$ref": "#/$defs/CodeTransformerDefinition" }, { "type": "null" } ], "default": null } }, "title": "AttributeTransformerDefinition", "type": "object" }, "BotocraftInterface": { "properties": { "services": { "additionalProperties": { "$ref": "#/$defs/ServiceDefinition" }, "default": {}, "title": "Services", "type": "object" }, "models": { "additionalProperties": { "type": "string" }, "default": { "Tag": "botocraft.services.common", "Filter": "botocraft.services.common" }, "title": "Models", "type": "object" } }, "title": "BotocraftInterface", "type": "object" }, "CodeTransformerDefinition": { "description": "Used when generating a property on a model that is a verbatim expression\nto return.", "properties": { "code": { "title": "Code", "type": "string" }, "return_type": { "title": "Return Type", "type": "string" } }, "required": [ "code", "return_type" ], "title": "CodeTransformerDefinition", "type": "object" }, "Importable": { "description": "A configuration object for a mixin class to add to a model.", "properties": { "name": { "title": "Name", "type": "string" }, "import_path": { "title": "Import Path", "type": "string" } }, "required": [ "name", "import_path" ], "title": "Importable", "type": "object" }, "ManagerDefinition": { "description": "The definition of a single manager on a :py:class:`ServiceDefinition`.\n\nExample:\n .. code-block:: yaml\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true\n delete:\n boto3_name: delete_repository\n args:\n repositoryName:\n required: true\n force:\n default: false", "properties": { "name": { "title": "Name", "type": "string" }, "methods": { "additionalProperties": { "$ref": "#/$defs/ManagerMethodDefinition" }, "default": {}, "title": "Methods", "type": "object" }, "readonly": { "default": false, "title": "Readonly", "type": "boolean" }, "mixins": { "default": [], "items": { "$ref": "#/$defs/Importable" }, "title": "Mixins", "type": "array" } }, "required": [ "name" ], "title": "ManagerDefinition", "type": "object" }, "ManagerMethodDefinition": { "description": "The definition of a single method on a :py:class:`ManagerDefinition`.\n\nExample:\n\n .. code-block:: yaml\n :emphasize-lines: 3,4,5,6,7\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true", "properties": { "boto3_name": { "title": "Boto3 Name", "type": "string" }, "args": { "additionalProperties": { "$ref": "#/$defs/MethodArgumentDefinition" }, "default": {}, "title": "Args", "type": "object" }, "response_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Response Attr" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "return_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Return Type" }, "extra_args": { "additionalProperties": { "$ref": "#/$defs/MethodArgumentDefinition" }, "default": {}, "title": "Extra Args", "type": "object" }, "decorators": { "default": [], "items": { "$ref": "#/$defs/Importable" }, "title": "Decorators", "type": "array" } }, "required": [ "boto3_name" ], "title": "ManagerMethodDefinition", "type": "object" }, "MethodArgumentDefinition": { "description": "The definition of a single argument on a :py:class:`ManagerMethodDefinition`.\n\nExample:\n\n .. code-block:: yaml\n :emphasize-lines: 6,7\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true", "properties": { "attribute": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attribute" }, "rename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rename" }, "source_arg": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source Arg" }, "value": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Value" }, "raw_value": { "default": false, "title": "Raw Value", "type": "boolean" }, "explicit": { "default": false, "title": "Explicit", "type": "boolean" }, "required": { "default": false, "title": "Required", "type": "boolean" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" }, "hidden": { "default": false, "title": "Hidden", "type": "boolean" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "python_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Python Type" }, "imports": { "items": { "type": "string" }, "title": "Imports", "type": "array" } }, "title": "MethodArgumentDefinition", "type": "object" }, "ModelAttributeDefinition": { "description": "The definition of a single attribute on a :py:class:`ModelDefinition`.\n\nWe use this to override the default configuration of a model attribute\nthat we generate from the botocore model.", "properties": { "rename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rename" }, "readonly": { "default": false, "title": "Readonly", "type": "boolean" }, "required": { "default": false, "title": "Required", "type": "boolean" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "python_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Python Type" }, "imports": { "default": [], "items": { "type": "string" }, "title": "Imports", "type": "array" }, "botocore_shape": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Botocore Shape" } }, "title": "ModelAttributeDefinition", "type": "object" }, "ModelDefinition": { "description": "The definition of a single model for a :py:class:`ServiceDefinition`.", "properties": { "name": { "title": "Name", "type": "string" }, "imports": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Imports" }, "mixins": { "items": { "$ref": "#/$defs/Importable" }, "title": "Mixins", "type": "array" }, "readonly": { "default": false, "title": "Readonly", "type": "boolean" }, "plural": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Plural" }, "base_class": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Base Class" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "alternate_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Alternate Name" }, "primary_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Primary Key" }, "arn_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Arn Key" }, "name_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Name Key" }, "fields": { "additionalProperties": { "$ref": "#/$defs/ModelAttributeDefinition" }, "title": "Fields", "type": "object" }, "extra_fields": { "additionalProperties": { "$ref": "#/$defs/ModelAttributeDefinition" }, "title": "Extra Fields", "type": "object" }, "output_shape": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Output Shape" }, "input_shapes": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Input Shapes" }, "properties": { "type": "object", "additionalProperties": { "$ref": "#/$defs/ModelPropertyDefinition" }, "title": "Properties" }, "relations": { "additionalProperties": { "$ref": "#/$defs/ModelRelationshipDefinition" }, "title": "Relations", "type": "object" }, "manager_methods": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodDefinition" }, "title": "Manager Methods", "type": "object" }, "bespoke": { "default": false, "title": "Bespoke", "type": "boolean" }, "force_create": { "default": false, "title": "Force Create", "type": "boolean" } }, "required": [ "name" ], "title": "ModelDefinition", "type": "object" }, "ModelManagerMethodArgDefinition": { "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" } }, "required": [ "name" ], "title": "ModelManagerMethodArgDefinition", "type": "object" }, "ModelManagerMethodDefinition": { "description": "Used to provide methods on a model that call methods on the manager for the\nmodel.", "properties": { "manager_method": { "title": "Manager Method", "type": "string" }, "cached": { "default": false, "title": "Cached", "type": "boolean" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "args": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodArgDefinition" }, "title": "Args", "type": "object" }, "user_args": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodArgDefinition" }, "title": "User Args", "type": "object" }, "keyword_args": { "items": { "$ref": "#/$defs/ModelManagerMethodKwargDefinition" }, "title": "Keyword Args", "type": "array" }, "user_keyword_args": { "items": { "$ref": "#/$defs/ModelManagerMethodKwargDefinition" }, "title": "User Keyword Args", "type": "array" }, "decorators": { "items": { "$ref": "#/$defs/Importable" }, "title": "Decorators", "type": "array" } }, "required": [ "manager_method" ], "title": "ModelManagerMethodDefinition", "type": "object" }, "ModelManagerMethodKwargDefinition": { "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" } }, "required": [ "name" ], "title": "ModelManagerMethodKwargDefinition", "type": "object" }, "ModelPropertyDefinition": { "description": "The definition of a single property on a :py:class:`ModelDefinition`.\n\nOne of ``regex``, ``mapping`` or ``alias`` must be specified.\n\nIf :py:attr:`cached` is ``True``, we'll cache the value of this property\nusing :py:func:`functools.cached_property`.", "properties": { "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "cached": { "default": false, "title": "Cached", "type": "boolean" }, "transformer": { "$ref": "#/$defs/AttributeTransformerDefinition" } }, "required": [ "transformer" ], "title": "ModelPropertyDefinition", "type": "object" }, "ModelRelationshipDefinition": { "description": "Defines a property on a model that is a relationship to another model.", "properties": { "imports": { "items": { "$ref": "#/$defs/Importable" }, "title": "Imports", "type": "array" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "cached": { "default": true, "title": "Cached", "type": "boolean" }, "transformer": { "$ref": "#/$defs/AttributeTransformerDefinition" }, "primary_model_name": { "title": "Primary Model Name", "type": "string" }, "many": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Many" }, "method": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Method" } }, "required": [ "transformer", "primary_model_name" ], "title": "ModelRelationshipDefinition", "type": "object" }, "RegexTransformer": { "description": "Used when generating a property on a model that is a regular expression\ntransformation of an attribute on the model.\n\nIf the regular expression has named groups, we'll return a dictionary\nof the named groups. Otherwise, we'll return the value of the first\ngroup.", "properties": { "attribute": { "title": "Attribute", "type": "string" }, "regex": { "title": "Regex", "type": "string" } }, "required": [ "attribute", "regex" ], "title": "RegexTransformer", "type": "object" }, "ServiceDefinition": { "description": "Our definition of a single AWS service, e.g. ``ecs``, ``ec2``, etc.", "properties": { "interface": { "$ref": "#/$defs/BotocraftInterface" }, "name": { "title": "Name", "type": "string" }, "primary_models": { "additionalProperties": { "$ref": "#/$defs/ModelDefinition" }, "default": {}, "title": "Primary Models", "type": "object" }, "secondary_models": { "additionalProperties": { "$ref": "#/$defs/ModelDefinition" }, "default": {}, "title": "Secondary Models", "type": "object" }, "managers": { "additionalProperties": { "$ref": "#/$defs/ManagerDefinition" }, "default": {}, "title": "Managers", "type": "object" } }, "required": [ "interface", "name" ], "title": "ServiceDefinition", "type": "object" } }, "$ref": "#/$defs/ServiceDefinition" }
- Fields:
- field interface: BotocraftInterface [Required]
The global botocraft interface model
- field managers: dict[str, botocraft.sync.models.ManagerDefinition] = {}
The managers to generate for this service
- field primary_models: dict[str, botocraft.sync.models.ModelDefinition] = {}
The models to generate for this service. These are specifically models that have managers.
- field secondary_models: dict[str, botocraft.sync.models.ModelDefinition] = {}
These are models that are used as attributes on other models, or as response or request classes. These models don’t have managers, but we sometimes define them to override the default botocore model configuration, making them readonly or to rename them, for instance.
- classmethod load(name: str, interface: BotocraftInterface) → ServiceDefinition[source]
Load a service definition from its YAML files.
- Parameters:
name – The name of the AWS service to load
interface – The global botocraft interface model
- Returns:
The loaded service definition
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) → Self
- classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) → Self
- resolve_model_name(model_name: str) → str[source]
Resolve a model name to its botocore shape name. We need to do this because we can define
ModelDefinition.alternate_nameto change the botocraft name for a model.- Parameters:
model_name – The botocraft model name
- Raises:
KeyError – If the model name is not defined in this service
- Returns:
The botocore shape name
- property models: dict[str, botocraft.sync.models.ModelDefinition]
Return all of the models we’ve specifically named in the definition for this service, both primary and secondary.
Important
This does not include models that we generate on the fly, like dependent models for primary models, or models for the request and response classes for methods on managers.
Manager related models
A manager is a class that provides CRUDL functionality for a service resource, as well as any additional methods that are needed to interact with the resource.
Only resources that have at least some of the CRUDL functionality are given a
manager. For example, the botocraft.service.ecs.Service resource
has a manager, but the botocraft.service.ecs.LoadBalancerConfiguration class,
which is used to compose the botocraft.service.ecs.Service resource,
does not.
Hint
botocraft.service.ecs.ServiceManager is a manager for the
botocraft.service.ecs.Service resource in the ecs service.
- pydantic model botocraft.sync.models.ManagerDefinition[source]
Bases:
BaseModelThe definition of a single manager on a
ServiceDefinition.Example
Repository: methods: create: boto3_name: create_repository args: repositoryName: required: true delete: boto3_name: delete_repository args: repositoryName: required: true force: default: false
Show JSON schema
{ "title": "ManagerDefinition", "description": "The definition of a single manager on a :py:class:`ServiceDefinition`.\n\nExample:\n .. code-block:: yaml\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true\n delete:\n boto3_name: delete_repository\n args:\n repositoryName:\n required: true\n force:\n default: false", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "methods": { "additionalProperties": { "$ref": "#/$defs/ManagerMethodDefinition" }, "default": {}, "title": "Methods", "type": "object" }, "readonly": { "default": false, "title": "Readonly", "type": "boolean" }, "mixins": { "default": [], "items": { "$ref": "#/$defs/Importable" }, "title": "Mixins", "type": "array" } }, "$defs": { "Importable": { "description": "A configuration object for a mixin class to add to a model.", "properties": { "name": { "title": "Name", "type": "string" }, "import_path": { "title": "Import Path", "type": "string" } }, "required": [ "name", "import_path" ], "title": "Importable", "type": "object" }, "ManagerMethodDefinition": { "description": "The definition of a single method on a :py:class:`ManagerDefinition`.\n\nExample:\n\n .. code-block:: yaml\n :emphasize-lines: 3,4,5,6,7\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true", "properties": { "boto3_name": { "title": "Boto3 Name", "type": "string" }, "args": { "additionalProperties": { "$ref": "#/$defs/MethodArgumentDefinition" }, "default": {}, "title": "Args", "type": "object" }, "response_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Response Attr" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "return_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Return Type" }, "extra_args": { "additionalProperties": { "$ref": "#/$defs/MethodArgumentDefinition" }, "default": {}, "title": "Extra Args", "type": "object" }, "decorators": { "default": [], "items": { "$ref": "#/$defs/Importable" }, "title": "Decorators", "type": "array" } }, "required": [ "boto3_name" ], "title": "ManagerMethodDefinition", "type": "object" }, "MethodArgumentDefinition": { "description": "The definition of a single argument on a :py:class:`ManagerMethodDefinition`.\n\nExample:\n\n .. code-block:: yaml\n :emphasize-lines: 6,7\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true", "properties": { "attribute": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attribute" }, "rename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rename" }, "source_arg": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source Arg" }, "value": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Value" }, "raw_value": { "default": false, "title": "Raw Value", "type": "boolean" }, "explicit": { "default": false, "title": "Explicit", "type": "boolean" }, "required": { "default": false, "title": "Required", "type": "boolean" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" }, "hidden": { "default": false, "title": "Hidden", "type": "boolean" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "python_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Python Type" }, "imports": { "items": { "type": "string" }, "title": "Imports", "type": "array" } }, "title": "MethodArgumentDefinition", "type": "object" } }, "required": [ "name" ] }
- Fields:
- field methods: dict[str, botocraft.sync.models.ManagerMethodDefinition] = {}
The methods to generate on this manager
- field mixins: list[botocraft.sync.models.Importable] = []
Mixin classes to add to the manager
- field readonly: bool = False
If
True, make this manager use theReadonlyBoto3ModelManagersuperclass
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.ManagerMethodDefinition[source]
Bases:
BaseModelThe definition of a single method on a
ManagerDefinition.Example
Repository: methods: create: boto3_name: create_repository args: repositoryName: required: true
Show JSON schema
{ "title": "ManagerMethodDefinition", "description": "The definition of a single method on a :py:class:`ManagerDefinition`.\n\nExample:\n\n .. code-block:: yaml\n :emphasize-lines: 3,4,5,6,7\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true", "type": "object", "properties": { "boto3_name": { "title": "Boto3 Name", "type": "string" }, "args": { "additionalProperties": { "$ref": "#/$defs/MethodArgumentDefinition" }, "default": {}, "title": "Args", "type": "object" }, "response_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Response Attr" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "return_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Return Type" }, "extra_args": { "additionalProperties": { "$ref": "#/$defs/MethodArgumentDefinition" }, "default": {}, "title": "Extra Args", "type": "object" }, "decorators": { "default": [], "items": { "$ref": "#/$defs/Importable" }, "title": "Decorators", "type": "array" } }, "$defs": { "Importable": { "description": "A configuration object for a mixin class to add to a model.", "properties": { "name": { "title": "Name", "type": "string" }, "import_path": { "title": "Import Path", "type": "string" } }, "required": [ "name", "import_path" ], "title": "Importable", "type": "object" }, "MethodArgumentDefinition": { "description": "The definition of a single argument on a :py:class:`ManagerMethodDefinition`.\n\nExample:\n\n .. code-block:: yaml\n :emphasize-lines: 6,7\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true", "properties": { "attribute": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attribute" }, "rename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rename" }, "source_arg": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source Arg" }, "value": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Value" }, "raw_value": { "default": false, "title": "Raw Value", "type": "boolean" }, "explicit": { "default": false, "title": "Explicit", "type": "boolean" }, "required": { "default": false, "title": "Required", "type": "boolean" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" }, "hidden": { "default": false, "title": "Hidden", "type": "boolean" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "python_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Python Type" }, "imports": { "items": { "type": "string" }, "title": "Imports", "type": "array" } }, "title": "MethodArgumentDefinition", "type": "object" } }, "required": [ "boto3_name" ] }
- Fields:
- field args: dict[str, botocraft.sync.models.MethodArgumentDefinition] = {}
A list of argument overrides for this method. If an argument name is not specified as a key in this dict, it will be generated as is appropriate for the operation type
- field decorators: list[botocraft.sync.models.Importable] = []
Decorators to wrap the method in
- field docstring: str | None = None
If specified, use this as the docstring for the method itself (not the args, kwargs or return type). If not specified, we’ll use the docstring from the botocore operation.
- field extra_args: dict[str, botocraft.sync.models.MethodArgumentDefinition] = {}
Extra arguments for the method call
- field response_attr: str | None = None
The attribute name on the response class to use in building our method return object(s). If not specified, we’ll use the lowercased model name, pluralizing if necessary.
If you want to just return the whole response from the boto3 call, set this to literal
"None".Important
If you’ve renamed the model attribute you want to use on the response class using
ModelAttributeDefinition.rename, put the name of the botocore here, not the value of therenameattribute.
- field return_type: str | None = None
If specified, use this as the return type for the method. If not set, we’ll use the model name, pluralizing if necessary.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) → Self
- classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) → Self
- property explicit_args: list[str]
Return a list of positional arguments that should be explicitly included in the method signature. This is useful for methods that take a model instance as an argument, but some of the arguments are not model attributes.
- Returns:
A list of explicit positional arguments
- pydantic model botocraft.sync.models.MethodArgumentDefinition[source]
Bases:
BaseModelThe definition of a single argument on a
ManagerMethodDefinition.Example
Repository: methods: create: boto3_name: create_repository args: repositoryName: required: true
Show JSON schema
{ "title": "MethodArgumentDefinition", "description": "The definition of a single argument on a :py:class:`ManagerMethodDefinition`.\n\nExample:\n\n .. code-block:: yaml\n :emphasize-lines: 6,7\n\n Repository:\n methods:\n create:\n boto3_name: create_repository\n args:\n repositoryName:\n required: true", "type": "object", "properties": { "attribute": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attribute" }, "rename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rename" }, "source_arg": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source Arg" }, "value": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Value" }, "raw_value": { "default": false, "title": "Raw Value", "type": "boolean" }, "explicit": { "default": false, "title": "Explicit", "type": "boolean" }, "required": { "default": false, "title": "Required", "type": "boolean" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" }, "hidden": { "default": false, "title": "Hidden", "type": "boolean" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "python_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Python Type" }, "imports": { "items": { "type": "string" }, "title": "Imports", "type": "array" } } }
- Fields:
- field attribute: str | None = None
If specified, when constructing the boto3 call invocation, set the value of this argument to the value of the model attribute specified here. This is only useful for methods that take a model instance as an argument.
- field docstring: str | None = None
If specified, use this as the docstring for the argument. Otherwise, we’ll use the docstring from the botocore operation.
- field explicit: bool = False
If
True, force the argument to be in in the method signature. This is only useful for methods that take a model instance as an argument.
- field hidden: bool = False
If
True, don’t include this argument in the method signature. or in the boto3 call invocation.
- field imports: list[str] [Optional]
If supplied, this is a list of import strings to add to the top of the of the file to support the python type.
- field raw_value: bool = False
If
True, take value as the raw value to pass to the boto3 call instead of wrapping it in self.serialize()
- field rename: str | None = None
If specified, in the method signature, use this as the argument name. Otherwise, we’ll use the name of the boto3 argument.
- field required: bool = False
If
True, make this a postional argument. IfFalse, make this a keyword argument.
- field source_arg: str | None = None
If specified, when constructing the boto3 call invocation, set the value of this argument to the value of this method argument
- field value: Any | None = None
If specified, in the boto3 call invocation, set the value of this argument to this specifically. If this is set, we hide the argument from the method signature.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
Model related models
A Model is either a resource that can be managed in the AWS API, or a model that is necessary to compose a resource (like a tag, or a sub-structure of a resource).
- Primary models
Primary models are the models that represent the resources that can be managed in the AWS API.
- Secondary models
Secondary models are the models that are necessary to compose a primary model, but are not themselves resources that can be managed in the AWS API. Secondary models may also be the Request/Response models for an AWS API operation.
Hint
botocraft.service.ecs.Service is a primary model for the
AWS::ECS::Service resource in the ecs service, and
botocraft.service.ecs.LoadBalancerConfiguration is a secondary
model used to compose the botocraft.service.ecs.Service resource.
- pydantic model botocraft.sync.models.ModelDefinition[source]
Bases:
BaseModelThe definition of a single model for a
ServiceDefinition.Show JSON schema
{ "title": "ModelDefinition", "description": "The definition of a single model for a :py:class:`ServiceDefinition`.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "imports": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Imports" }, "mixins": { "items": { "$ref": "#/$defs/Importable" }, "title": "Mixins", "type": "array" }, "readonly": { "default": false, "title": "Readonly", "type": "boolean" }, "plural": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Plural" }, "base_class": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Base Class" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "alternate_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Alternate Name" }, "primary_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Primary Key" }, "arn_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Arn Key" }, "name_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Name Key" }, "fields": { "additionalProperties": { "$ref": "#/$defs/ModelAttributeDefinition" }, "title": "Fields", "type": "object" }, "extra_fields": { "additionalProperties": { "$ref": "#/$defs/ModelAttributeDefinition" }, "title": "Extra Fields", "type": "object" }, "output_shape": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Output Shape" }, "input_shapes": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Input Shapes" }, "properties": { "type": "object", "additionalProperties": { "$ref": "#/$defs/ModelPropertyDefinition" }, "title": "Properties" }, "relations": { "additionalProperties": { "$ref": "#/$defs/ModelRelationshipDefinition" }, "title": "Relations", "type": "object" }, "manager_methods": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodDefinition" }, "title": "Manager Methods", "type": "object" }, "bespoke": { "default": false, "title": "Bespoke", "type": "boolean" }, "force_create": { "default": false, "title": "Force Create", "type": "boolean" } }, "$defs": { "AttributeTransformerDefinition": { "properties": { "regex": { "anyOf": [ { "$ref": "#/$defs/RegexTransformer" }, { "type": "null" } ], "default": null }, "mapping": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Mapping" }, "alias": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Alias" }, "code": { "anyOf": [ { "$ref": "#/$defs/CodeTransformerDefinition" }, { "type": "null" } ], "default": null } }, "title": "AttributeTransformerDefinition", "type": "object" }, "CodeTransformerDefinition": { "description": "Used when generating a property on a model that is a verbatim expression\nto return.", "properties": { "code": { "title": "Code", "type": "string" }, "return_type": { "title": "Return Type", "type": "string" } }, "required": [ "code", "return_type" ], "title": "CodeTransformerDefinition", "type": "object" }, "Importable": { "description": "A configuration object for a mixin class to add to a model.", "properties": { "name": { "title": "Name", "type": "string" }, "import_path": { "title": "Import Path", "type": "string" } }, "required": [ "name", "import_path" ], "title": "Importable", "type": "object" }, "ModelAttributeDefinition": { "description": "The definition of a single attribute on a :py:class:`ModelDefinition`.\n\nWe use this to override the default configuration of a model attribute\nthat we generate from the botocore model.", "properties": { "rename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rename" }, "readonly": { "default": false, "title": "Readonly", "type": "boolean" }, "required": { "default": false, "title": "Required", "type": "boolean" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "python_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Python Type" }, "imports": { "default": [], "items": { "type": "string" }, "title": "Imports", "type": "array" }, "botocore_shape": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Botocore Shape" } }, "title": "ModelAttributeDefinition", "type": "object" }, "ModelManagerMethodArgDefinition": { "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" } }, "required": [ "name" ], "title": "ModelManagerMethodArgDefinition", "type": "object" }, "ModelManagerMethodDefinition": { "description": "Used to provide methods on a model that call methods on the manager for the\nmodel.", "properties": { "manager_method": { "title": "Manager Method", "type": "string" }, "cached": { "default": false, "title": "Cached", "type": "boolean" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "args": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodArgDefinition" }, "title": "Args", "type": "object" }, "user_args": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodArgDefinition" }, "title": "User Args", "type": "object" }, "keyword_args": { "items": { "$ref": "#/$defs/ModelManagerMethodKwargDefinition" }, "title": "Keyword Args", "type": "array" }, "user_keyword_args": { "items": { "$ref": "#/$defs/ModelManagerMethodKwargDefinition" }, "title": "User Keyword Args", "type": "array" }, "decorators": { "items": { "$ref": "#/$defs/Importable" }, "title": "Decorators", "type": "array" } }, "required": [ "manager_method" ], "title": "ModelManagerMethodDefinition", "type": "object" }, "ModelManagerMethodKwargDefinition": { "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" } }, "required": [ "name" ], "title": "ModelManagerMethodKwargDefinition", "type": "object" }, "ModelPropertyDefinition": { "description": "The definition of a single property on a :py:class:`ModelDefinition`.\n\nOne of ``regex``, ``mapping`` or ``alias`` must be specified.\n\nIf :py:attr:`cached` is ``True``, we'll cache the value of this property\nusing :py:func:`functools.cached_property`.", "properties": { "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "cached": { "default": false, "title": "Cached", "type": "boolean" }, "transformer": { "$ref": "#/$defs/AttributeTransformerDefinition" } }, "required": [ "transformer" ], "title": "ModelPropertyDefinition", "type": "object" }, "ModelRelationshipDefinition": { "description": "Defines a property on a model that is a relationship to another model.", "properties": { "imports": { "items": { "$ref": "#/$defs/Importable" }, "title": "Imports", "type": "array" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "cached": { "default": true, "title": "Cached", "type": "boolean" }, "transformer": { "$ref": "#/$defs/AttributeTransformerDefinition" }, "primary_model_name": { "title": "Primary Model Name", "type": "string" }, "many": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Many" }, "method": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Method" } }, "required": [ "transformer", "primary_model_name" ], "title": "ModelRelationshipDefinition", "type": "object" }, "RegexTransformer": { "description": "Used when generating a property on a model that is a regular expression\ntransformation of an attribute on the model.\n\nIf the regular expression has named groups, we'll return a dictionary\nof the named groups. Otherwise, we'll return the value of the first\ngroup.", "properties": { "attribute": { "title": "Attribute", "type": "string" }, "regex": { "title": "Regex", "type": "string" } }, "required": [ "attribute", "regex" ], "title": "RegexTransformer", "type": "object" } }, "required": [ "name" ] }
- Fields:
extra_fields (dict[str, botocraft.sync.models.ModelAttributeDefinition])fields (dict[str, botocraft.sync.models.ModelAttributeDefinition])manager_methods (dict[str, botocraft.sync.models.ModelManagerMethodDefinition])properties (dict[str, botocraft.sync.models.ModelPropertyDefinition])relations (dict[str, botocraft.sync.models.ModelRelationshipDefinition])
- field alternate_name: str | None = None
If defined, use this as the model name instead of what botocore supplies. We use this if some submodels have a ame conflict with a model in another service or an attribute on a model in this service.
- field arn_key: str | None = None
The
ARNkey for this model attribute if any. Some AWS models have an ARN, a name, and an ID. Some have no ARN.
- field base_class: str | None = None
The name of the base class for this model. If not specified, we’ll use the default base class for the use case.
- field bespoke: bool = False
If
True, this is a bespoke model. This means that we don’t have a botocore shape for it and are buiding it out of many AWS API calls. This is used for things like S3 buckets and SQS queues, which have no full shapes in botocore.
- field docstring: str | None = None
A different docstring for the model. If not specified, we’ll use the docstring from the botocore model.
- field extra_fields: dict[str, botocraft.sync.models.ModelAttributeDefinition] [Optional]
A list of extra fields for this model. These are fields that are not in the botocore model, but are either are needed at create time or because they turn into something else in the response. This is pretty rarely used.
- field fields: dict[str, botocraft.sync.models.ModelAttributeDefinition] [Optional]
A list of field overrides for this model. If a field name is not specified in this list, it will be generated verbatim from the botocore model attribute definition.
- field force_create: bool = False
If
True, this is a secondary model that we want to force to be created during sync. This is used for things like S3 buckets and SQS queues, which have no full shapes in botocore.
- field imports: list[str] | None = None
A list of imports to add to the top of the file to support the model.
- field input_shapes: list[str] | None = None
The names of the request shapes for the writable methods for this model. We use these to determine which fields on the model are writable.
- field manager_methods: dict[str, botocraft.sync.models.ModelManagerMethodDefinition] [Optional]
Methods on the model that call methods on the manager for the model.
- field mixins: list[botocraft.sync.models.Importable] [Optional]
A list of mixin classes to add to the model
- field name_key: str | None = None
The
namekey for this model attribute if any. Some AWS models have an ARN, a name, and an ID. Some have no name.
- field output_shape: str | None = None
The name of the output shape for the get method for this model. We use this to add to the model any fields that appear in the get method response, but which are not present in the create method response.
- field plural: str | None = None
The plural form of our model name, if different from what the inflect library would generate.
- field primary_key: str | None = None
The primary key for this model. This is the field that will be used to determine whether we need to create a new model instance or update an existing one. This can be the name of a property.
- field properties: dict[str, botocraft.sync.models.ModelPropertyDefinition] [Optional]
Computed properties. These are all defined by us in the botocraft config.
- field relations: dict[str, botocraft.sync.models.ModelRelationshipDefinition] [Optional]
Relationships to other models. These are all defined by us in the botocraft config.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) → Self
- pydantic model botocraft.sync.models.ModelAttributeDefinition[source]
Bases:
BaseModelThe definition of a single attribute on a
ModelDefinition.We use this to override the default configuration of a model attribute that we generate from the botocore model.
Show JSON schema
{ "title": "ModelAttributeDefinition", "description": "The definition of a single attribute on a :py:class:`ModelDefinition`.\n\nWe use this to override the default configuration of a model attribute\nthat we generate from the botocore model.", "type": "object", "properties": { "rename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rename" }, "readonly": { "default": false, "title": "Readonly", "type": "boolean" }, "required": { "default": false, "title": "Required", "type": "boolean" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "python_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Python Type" }, "imports": { "default": [], "items": { "type": "string" }, "title": "Imports", "type": "array" }, "botocore_shape": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Botocore Shape" } } }
- Fields:
- field botocore_shape: Any | None = None
This is not defined in the YAML file, but is set by
ModelGenerator.fieldsduring generation.
- field imports: list[str] = []
If specified, the list of imports to add to the top of the to support the python type.
- field rename: str | None = None
If specified, use this as the name of the field in the model. Set the original name of the field as a pydantic field alias.
- field required: bool = False
If
True, force the field to be required, even if the underlying botocore field is not required.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.ModelPropertyDefinition[source]
Bases:
BaseModelThe definition of a single property on a
ModelDefinition.One of
regex,mappingoraliasmust be specified.If
cachedisTrue, we’ll cache the value of this property usingfunctools.cached_property.Show JSON schema
{ "title": "ModelPropertyDefinition", "description": "The definition of a single property on a :py:class:`ModelDefinition`.\n\nOne of ``regex``, ``mapping`` or ``alias`` must be specified.\n\nIf :py:attr:`cached` is ``True``, we'll cache the value of this property\nusing :py:func:`functools.cached_property`.", "type": "object", "properties": { "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "cached": { "default": false, "title": "Cached", "type": "boolean" }, "transformer": { "$ref": "#/$defs/AttributeTransformerDefinition" } }, "$defs": { "AttributeTransformerDefinition": { "properties": { "regex": { "anyOf": [ { "$ref": "#/$defs/RegexTransformer" }, { "type": "null" } ], "default": null }, "mapping": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Mapping" }, "alias": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Alias" }, "code": { "anyOf": [ { "$ref": "#/$defs/CodeTransformerDefinition" }, { "type": "null" } ], "default": null } }, "title": "AttributeTransformerDefinition", "type": "object" }, "CodeTransformerDefinition": { "description": "Used when generating a property on a model that is a verbatim expression\nto return.", "properties": { "code": { "title": "Code", "type": "string" }, "return_type": { "title": "Return Type", "type": "string" } }, "required": [ "code", "return_type" ], "title": "CodeTransformerDefinition", "type": "object" }, "RegexTransformer": { "description": "Used when generating a property on a model that is a regular expression\ntransformation of an attribute on the model.\n\nIf the regular expression has named groups, we'll return a dictionary\nof the named groups. Otherwise, we'll return the value of the first\ngroup.", "properties": { "attribute": { "title": "Attribute", "type": "string" }, "regex": { "title": "Regex", "type": "string" } }, "required": [ "attribute", "regex" ], "title": "RegexTransformer", "type": "object" } }, "required": [ "transformer" ] }
- Fields:
- field transformer: AttributeTransformerDefinition [Required]
If specified, use this definition to build the property output from the model fields
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.ModelRelationshipDefinition[source]
Bases:
BaseModelDefines a property on a model that is a relationship to another model.
Show JSON schema
{ "title": "ModelRelationshipDefinition", "description": "Defines a property on a model that is a relationship to another model.", "type": "object", "properties": { "imports": { "items": { "$ref": "#/$defs/Importable" }, "title": "Imports", "type": "array" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "cached": { "default": true, "title": "Cached", "type": "boolean" }, "transformer": { "$ref": "#/$defs/AttributeTransformerDefinition" }, "primary_model_name": { "title": "Primary Model Name", "type": "string" }, "many": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Many" }, "method": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Method" } }, "$defs": { "AttributeTransformerDefinition": { "properties": { "regex": { "anyOf": [ { "$ref": "#/$defs/RegexTransformer" }, { "type": "null" } ], "default": null }, "mapping": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Mapping" }, "alias": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Alias" }, "code": { "anyOf": [ { "$ref": "#/$defs/CodeTransformerDefinition" }, { "type": "null" } ], "default": null } }, "title": "AttributeTransformerDefinition", "type": "object" }, "CodeTransformerDefinition": { "description": "Used when generating a property on a model that is a verbatim expression\nto return.", "properties": { "code": { "title": "Code", "type": "string" }, "return_type": { "title": "Return Type", "type": "string" } }, "required": [ "code", "return_type" ], "title": "CodeTransformerDefinition", "type": "object" }, "Importable": { "description": "A configuration object for a mixin class to add to a model.", "properties": { "name": { "title": "Name", "type": "string" }, "import_path": { "title": "Import Path", "type": "string" } }, "required": [ "name", "import_path" ], "title": "Importable", "type": "object" }, "RegexTransformer": { "description": "Used when generating a property on a model that is a regular expression\ntransformation of an attribute on the model.\n\nIf the regular expression has named groups, we'll return a dictionary\nof the named groups. Otherwise, we'll return the value of the first\ngroup.", "properties": { "attribute": { "title": "Attribute", "type": "string" }, "regex": { "title": "Regex", "type": "string" } }, "required": [ "attribute", "regex" ], "title": "RegexTransformer", "type": "object" } }, "required": [ "transformer", "primary_model_name" ] }
- Fields:
- Validators:
check_alias_transformer»all fieldscheck_regex_transformer»all fields
- field imports: list[botocraft.sync.models.Importable] [Optional]
If specified, import these modules into the generated file.
- Validated by:
- field many: bool | None = None
If
True, force this to be a many-to-many relationship. Otherwise, try to figure it out from our transformer.- Validated by:
- field method: str | None = None
If specified, use this as the name of the method on the related model’s manager to get the related model instance. This defaults to
getifmanyisFalseandlistifmanyisTrue.- Validated by:
- field primary_model_name: str [Required]
The name of the botocraft primary model to use for this relationship
Important
This needs to be the name of a primary model, not a secondary model. Only primary models have managers.
- Validated by:
- field transformer: AttributeTransformerDefinition [Required]
If specified, use this definition to build the primary key for the related model from data from this model
Important
If you are using a regex transformer, you must use named groups.
- Example::
r’arn:aws:ecs:(?P<region>[^:]+):(?P<account_id>[^:]+):(?P<resource_type>[^:]+)/(?P<resource_id>[^:]+)’ # noqa: E501
- Validated by:
- validator check_alias_transformer » all fields[source]
Don’t allow alias transformers for relations – we need to know the argument name for the related model, and alias types don’t support that.
- Parameters:
data – the input data for this model
- Raises:
ValueError – an alias transformer is specified
- Returns:
The input data for this model
- validator check_regex_transformer » all fields[source]
If we have a regex transformer, make sure that it only uses named groups.
- Parameters:
data – the input data for this model
- Raises:
ValueError – if the regex transformer has no named groups or has unnamed groups
- Returns:
The input data for this model
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.ModelManagerMethodDefinition[source]
Bases:
BaseModelUsed to provide methods on a model that call methods on the manager for the model.
Show JSON schema
{ "title": "ModelManagerMethodDefinition", "description": "Used to provide methods on a model that call methods on the manager for the\nmodel.", "type": "object", "properties": { "manager_method": { "title": "Manager Method", "type": "string" }, "cached": { "default": false, "title": "Cached", "type": "boolean" }, "docstring": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Docstring" }, "args": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodArgDefinition" }, "title": "Args", "type": "object" }, "user_args": { "additionalProperties": { "$ref": "#/$defs/ModelManagerMethodArgDefinition" }, "title": "User Args", "type": "object" }, "keyword_args": { "items": { "$ref": "#/$defs/ModelManagerMethodKwargDefinition" }, "title": "Keyword Args", "type": "array" }, "user_keyword_args": { "items": { "$ref": "#/$defs/ModelManagerMethodKwargDefinition" }, "title": "User Keyword Args", "type": "array" }, "decorators": { "items": { "$ref": "#/$defs/Importable" }, "title": "Decorators", "type": "array" } }, "$defs": { "Importable": { "description": "A configuration object for a mixin class to add to a model.", "properties": { "name": { "title": "Name", "type": "string" }, "import_path": { "title": "Import Path", "type": "string" } }, "required": [ "name", "import_path" ], "title": "Importable", "type": "object" }, "ModelManagerMethodArgDefinition": { "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" } }, "required": [ "name" ], "title": "ModelManagerMethodArgDefinition", "type": "object" }, "ModelManagerMethodKwargDefinition": { "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" } }, "required": [ "name" ], "title": "ModelManagerMethodKwargDefinition", "type": "object" } }, "required": [ "manager_method" ] }
- Fields:
args (dict[int, botocraft.sync.models.ModelManagerMethodArgDefinition])keyword_args (list[botocraft.sync.models.ModelManagerMethodKwargDefinition])user_args (dict[int, botocraft.sync.models.ModelManagerMethodArgDefinition])user_keyword_args (list[botocraft.sync.models.ModelManagerMethodKwargDefinition])
- field args: dict[int, botocraft.sync.models.ModelManagerMethodArgDefinition] [Optional]
The arguments for the method. These should refer to attributes : on the model and map them to args on the manager method in the proper : order. The key is the position of the argument in the manager method signature, value is the name of the attribute on the model.
- field decorators: list[botocraft.sync.models.Importable] [Optional]
A list of decorators to wrap the method in
- field keyword_args: list[botocraft.sync.models.ModelManagerMethodKwargDefinition] [Optional]
The keyword arguments for the method. These should refer to attributes on the model and map them to kwargs on the manager method with the proper keyword.
- field user_args: dict[int, botocraft.sync.models.ModelManagerMethodArgDefinition] [Optional]
Args the users must supply. The key is the position of the argument in the manager method signature, and the value is the name of the argument to add to the model method signature.
- field user_keyword_args: list[botocraft.sync.models.ModelManagerMethodKwargDefinition] [Optional]
Keyword arguments the users can supply
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.ModelManagerMethodArgDefinition[source]
Bases:
BaseModelShow JSON schema
{ "title": "ModelManagerMethodArgDefinition", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" } }, "required": [ "name" ] }
- field value: str | None = None
The value of the argument. If
None, we’ll use the value of the attribute on the model with the same name.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.ModelManagerMethodKwargDefinition[source]
Bases:
BaseModelShow JSON schema
{ "title": "ModelManagerMethodKwargDefinition", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "value": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "attr_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Attr Type" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default" } }, "required": [ "name" ] }
- field value: str | None = None
The value of the argument. if
None, we’ll use the value of the attribute on the model with the same name.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.AttributeTransformerDefinition[source]
Bases:
BaseModelShow JSON schema
{ "title": "AttributeTransformerDefinition", "type": "object", "properties": { "regex": { "anyOf": [ { "$ref": "#/$defs/RegexTransformer" }, { "type": "null" } ], "default": null }, "mapping": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Mapping" }, "alias": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Alias" }, "code": { "anyOf": [ { "$ref": "#/$defs/CodeTransformerDefinition" }, { "type": "null" } ], "default": null } }, "$defs": { "CodeTransformerDefinition": { "description": "Used when generating a property on a model that is a verbatim expression\nto return.", "properties": { "code": { "title": "Code", "type": "string" }, "return_type": { "title": "Return Type", "type": "string" } }, "required": [ "code", "return_type" ], "title": "CodeTransformerDefinition", "type": "object" }, "RegexTransformer": { "description": "Used when generating a property on a model that is a regular expression\ntransformation of an attribute on the model.\n\nIf the regular expression has named groups, we'll return a dictionary\nof the named groups. Otherwise, we'll return the value of the first\ngroup.", "properties": { "attribute": { "title": "Attribute", "type": "string" }, "regex": { "title": "Regex", "type": "string" } }, "required": [ "attribute", "regex" ], "title": "RegexTransformer", "type": "object" } } }
- Fields:
- Validators:
check_transformer»all fields
- field alias: str | None = None
If specified, use this property as an alias for this attribute. This may be an alias on another related model
- Validated by:
- field code: CodeTransformerDefinition | None = None
If specified, use this property as a verbatim expression to return attribute. This may be an alias on another related model
- Validated by:
- field mapping: dict[str, str] | None = None
If specified, use this mapping of attribute values to output keys to generate the output
- Validated by:
- field regex: RegexTransformer | None = None
If specified, use this regular expression to build the property output
- Validated by:
- validator check_transformer » all fields[source]
Validate that only one of a regex, a mapping or an alias is specified, but not more than one.
- Parameters:
data – the input data for this model
- Raises:
ValueError – both a regex and a mapping are specified
- Returns:
The input data for this model
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- pydantic model botocraft.sync.models.RegexTransformer[source]
Bases:
BaseModelUsed when generating a property on a model that is a regular expression transformation of an attribute on the model.
If the regular expression has named groups, we’ll return a dictionary of the named groups. Otherwise, we’ll return the value of the first group.
Show JSON schema
{ "title": "RegexTransformer", "description": "Used when generating a property on a model that is a regular expression\ntransformation of an attribute on the model.\n\nIf the regular expression has named groups, we'll return a dictionary\nof the named groups. Otherwise, we'll return the value of the first\ngroup.", "type": "object", "properties": { "attribute": { "title": "Attribute", "type": "string" }, "regex": { "title": "Regex", "type": "string" } }, "required": [ "attribute", "regex" ] }
- Fields:
- Validators:
- field attribute: str [Required]
The name of the attribute on our model to use as the input to the regular expression.
- field regex: str [Required]
Use this regular expression to transform the attribute value.
- Validated by:
- validator check_valid_regexp » regex[source]
Validate that the transformer is a valid regular expression.
- Parameters:
v – the value of field
info – pydantic field validation info
- Raises:
ValueError – if the transformer is not a valid regular expression
- Returns:
The value of the field
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) → Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) → Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) → str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) → Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.