:py:mod:`aws_codeseeder.codeseeder` =================================== .. py:module:: aws_codeseeder.codeseeder Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: aws_codeseeder.codeseeder.CodeSeederConfig aws_codeseeder.codeseeder.ModuleImporterEnum Functions ~~~~~~~~~ .. autoapisummary:: aws_codeseeder.codeseeder.configure aws_codeseeder.codeseeder.deploy_seedkit aws_codeseeder.codeseeder.remote_function aws_codeseeder.codeseeder.seedkit_deployed Attributes ~~~~~~~~~~ .. autoapisummary:: aws_codeseeder.codeseeder.ConfigureDecorator aws_codeseeder.codeseeder.RemoteFunctionDecorator .. py:class:: CodeSeederConfig Configuration dataclass :param timeout: Set the CodeBuild execution timeout, by default 30 :type timeout: Optional[int], optional :param python_modules: List of python modules to install during CodeBuild execution, by default None :type python_modules: Optional[List[str]], optional :param pythonpipx_modules: List of python modules that leverage CLI to install during CodeBuild execution, by default None :type pythonpipx_modules: Optional[List[str]], optional :param local_modules: Name and Location of local python modules to bundle and install during CodeBuild execution, by default None :type local_modules: Optional[Dict[str, str]], optional :param requirements_files: Local requirements.txt files to bundle and install during CodeBuild execution, by default None :type requirements_files: Optional[Dict[str, str]], optional :param codebuild_image: Alternative container image to use during CodeBuild execution, by default None :type codebuild_image: Optional[str], optional :param codebuild_role: Alternative IAM Role to use during CodeBuild execution, by default None :type codebuild_role: Optional[str], optional :param codebuild_environment_type: Alternative Environment to use for the CodeBuild execution (e.g. LINUX_CONTAINER), by default None :type codebuild_environment_type: Optional[str], optional :param codebuild_compute_type: Alternative Compute to use for the CodeBuild execution (e.g. BUILD_GENERAL1_SMALL), by default None :type codebuild_compute_type: Optional[str], optional :param npm_mirror: Global config for the npm mirror to use, by default None :type npm_mirror: Optional[str] :param pypi_mirror: Global config for the pypi mirror to use, by default None :type pypi_mirror: Optional[str] :param install_commands: Commands to execute during the Install phase of the CodeBuild execution, by default None :type install_commands: Optional[List[str]], optional :param pre_build_commands: Commands to execute during the PreBuild phase of the CodeBuild execution, by default None :type pre_build_commands: Optional[List[str]], optional :param pre_execution_commands: Commands to execute during the Build phase of the CodeBuild execution prior to calling the remote_function, by default None :type pre_execution_commands: Optional[List[str]], optional :param build_commands: Commands to execute during the Build phase of the CodeBuild execution after calling the remote_functin, by default None :type build_commands: Optional[List[str]], optional :param post_build_commands: Commands to execute during the PostBuild phase of the CodeBuild execution, by default None :type post_build_commands: Optional[List[str]], optional :param dirs: Name and Location of local directories to bundle and include in the CodeBuild exeuction,by default None :type dirs: Optional[Dict[str, str]], optional :param files: Name and Location of local files to bundle and include in the CodeBuild execution, by default None :type files: Optional[Dict[str, str]], optional :param env_vars: Environment variables to set in the CodeBuild execution, by default None :type env_vars: Optional[Dict[str, Union[str, EnvVar]]], optional :param exported_env_vars: Environment variables to export from the CodeBuild execution, by default None :type exported_env_vars: Optional[List[str], optional :param abort_phases_on_failure: Toggle aborting CodeBuild Phases when an execution failure occurs, by default True :type abort_phases_on_failure: bool :param runtime_versions: Runtime versions (e.g. python, nodejs) to install, by default ``{"python": "3.7", "nodejs": "12", "docker": "19"}`` :type runtime_versions: Optional[Dict[str, str]], optional :param prebuilt_bundle: Provide S3 path to a prebuild bundle to use to deploy :type prebuilt_bundle: Optional[str] .. py:attribute:: abort_phases_on_failure :type: bool :value: True .. py:attribute:: build_commands :type: Optional[List[str]] .. py:attribute:: codebuild_compute_type :type: Optional[str] .. py:attribute:: codebuild_environment_type :type: Optional[str] .. py:attribute:: codebuild_image :type: Optional[str] .. py:attribute:: codebuild_role :type: Optional[str] .. py:attribute:: dirs :type: Optional[Dict[str, str]] .. py:attribute:: env_vars :type: Optional[Dict[str, Union[str, EnvVar]]] .. py:attribute:: exported_env_vars :type: Optional[List[str]] .. py:attribute:: files :type: Optional[Dict[str, str]] .. py:attribute:: install_commands :type: Optional[List[str]] .. py:attribute:: local_modules :type: Optional[Dict[str, str]] .. py:attribute:: npm_mirror :type: Optional[str] .. py:attribute:: post_build_commands :type: Optional[List[str]] .. py:attribute:: pre_build_commands :type: Optional[List[str]] .. py:attribute:: pre_execution_commands :type: Optional[List[str]] .. py:attribute:: prebuilt_bundle :type: Optional[str] .. py:attribute:: pypi_mirror :type: Optional[str] .. py:attribute:: python_modules :type: Optional[List[str]] .. py:attribute:: pythonpipx_modules :type: Optional[List[str]] .. py:attribute:: requirements_files :type: Optional[Dict[str, str]] .. py:attribute:: runtime_versions :type: Optional[Dict[str, str]] .. py:attribute:: timeout :type: Optional[int] :value: 30 .. py:class:: ModuleImporterEnum Bases: :py:obj:`str`, :py:obj:`enum.Enum` str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'. .. py:attribute:: CODESEEDER_CLI :value: 'codeseeder-cli' .. py:attribute:: OTHER :value: 'other' .. py:function:: configure(seedkit_name: str, deploy_if_not_exists: bool = False) -> aws_codeseeder._classes.ConfigureDecorator Decorator marking a Configuration Function Decorated Configuration Functions are executed lazily when a ``remote_function`` for a particular Seedkit is called. The Configuration Function sets the default configuration for the Seedkit. :param seedkit_name: The name of the previously deployed Seedkit to associate this configuration with :type seedkit_name: str :param deploy_if_not_exists: Deploy a Seedkit of ``seedkit_name`` if it does not exist, by default False :type deploy_if_not_exists: bool :returns: The decorated function :rtype: ConfigureDecorator .. py:function:: deploy_seedkit(seedkit_name: str, managed_policy_arns: Optional[List[str]] = None, deploy_codeartifact: bool = False, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None, vpc_id: Optional[str] = None, subnet_ids: Optional[List[str]] = None, security_group_ids: Optional[List[str]] = None, permissions_boundary_arn: Optional[str] = None, synthesize: bool = False, **kwargs: Dict[str, Any]) -> None Deploys the seedkit resources into the environment. Resources deployed include: S3 Bucket, CodeArtifact Domain, CodeArtifact Repository, CodeBuild Project, IAM Role, IAM Managed Policy, and KMS Key. All resource names will include the seedkit_name and IAM Role and Policy grant least privilege access to only the resources associated with this Seedkit. Seedkits are deployed to an AWS Region, names on global resources (S3, IAM) include a region identifier to avoid conflicts and ensure the same Seedkit name can be deployed to multiple regions. :param seedkit_name: Name of the seedkit to deploy. All resources will include this in their naming conventions :type seedkit_name: str :param managed_policy_arns: List of Managed Policy to ARNs to attach to the default IAM Role created and used by the CodeBuild Project :type managed_policy_arns: Optional[List[str]] :param deploy_codeartifact: Trigger optional deployment of CodeArtifact Domain and Repository for use by the Seedkit and its libraries :type deploy_codeartifact: bool :param session: Optional Session or function returning a Session to use for all boto3 operations, by default None :type session: Optional[Union[Callable[[], Session], Session]], optional :param vpc_id: If deploying codebuild in a VPC, the VPC-ID to use (must have vpc-id, subnets, and security_group_ids) :type vpc_id: Optional[str] :param subnet_ids: If deploying codebuild in a VPC, a list of Subnets to use (must have vpc-id, subnets, and security_group_ids) :type subnet_ids: Optional[List[str]] :param security_group_ids: If deploying codebuild in a VPC, a list of Security Group IDs to use (must have vpc-id, subnets, and security_group_ids) :type security_group_ids: Optional[List[str]] :param synthesize: Synthesize seedkit template only. Do not deploy. False by default. :type synthesize: bool .. py:function:: remote_function(seedkit_name: str, *, function_module: Optional[str] = None, function_name: Optional[str] = None, timeout: Optional[int] = None, codebuild_log_callback: Optional[Callable[[str], None]] = None, extra_python_modules: Optional[List[str]] = None, extra_pythonpipx_modules: Optional[List[str]] = None, extra_local_modules: Optional[Dict[str, str]] = None, extra_requirements_files: Optional[Dict[str, str]] = None, codebuild_image: Optional[str] = None, codebuild_role: Optional[str] = None, codebuild_environment_type: Optional[str] = None, codebuild_compute_type: Optional[str] = None, npm_mirror: Optional[str] = None, pypi_mirror: Optional[str] = None, extra_install_commands: Optional[List[str]] = None, extra_pre_build_commands: Optional[List[str]] = None, extra_pre_execution_commands: Optional[List[str]] = None, extra_build_commands: Optional[List[str]] = None, extra_post_build_commands: Optional[List[str]] = None, extra_dirs: Optional[Dict[str, str]] = None, extra_files: Optional[Dict[str, str]] = None, extra_env_vars: Optional[Dict[str, Union[str, aws_codeseeder._classes.EnvVar]]] = None, extra_exported_env_vars: Optional[List[str]] = None, prebuilt_bundle: Optional[str] = None, abort_phases_on_failure: Optional[bool] = None, runtime_versions: Optional[Dict[str, str]] = None, bundle_id: Optional[str] = None, boto3_session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) -> aws_codeseeder._classes.RemoteFunctionDecorator Decorator marking a Remote Function Decorated Remote Functions are intercepted on execution and seeded to a CodeBuild Project for remote execution. :param seedkit_name: The name of the previously deployed Seedkit to seed execution to. :type seedkit_name: str :param function_module: Name of the module in the seeded code to execute. If None, then inferred from the decorated function's module, by default None :type function_module: Optional[str], optional :param function_name: Name of the function in the seeded code to execute. If None, the inferred from the decorated function's name, by default None :type function_name: Optional[str], optional :param timeout: Override the CodeBuild execution timeout, by default None :type timeout: Optional[int], optional :param codebuild_log_callback: Callback function executed as CodeBuild execution logs are pulled, by default None :type codebuild_log_callback: Optional[Callable[[str], None]], optional :param extra_python_modules: List of additional python modules to install during CodeBuild exection, by default None :type extra_python_modules: Optional[List[str]], optional :param extra_local_modules: Name and Location of additional local python modules to bundle and install during CodeBuild execution, by default None :type extra_local_modules: Optional[Dict[str, str]], optional :param extra_requirements_files: Additional local requirements.txt files to bundle and install during CodeBuild execution, by default None :type extra_requirements_files: Optional[Dict[str, str]], optional :param codebuild_image: Alternative container image to use during CodeBuild execution, by default None :type codebuild_image: Optional[str], optional :param codebuild_role: Alternative IAM Role to use during CodeBuild execution, by default None :type codebuild_role: Optional[str], optional :param codebuild_environment_type: Alternative Environment to use for the CodeBuild execution (e.g. LINUX_CONTAINER), by default None :type codebuild_environment_type: Optional[str], optional :param codebuild_compute_type: Alternative Compute to use for the CodeBuild execution (e.g. BUILD_GENERAL1_SMALL), by default None :type codebuild_compute_type: Optional[str], optional :param npm_mirror: Global config for the npm mirror to use :type npm_mirror: Optional[str] :param pypi_mirror: Global config for the pypi mirror to use :type pypi_mirror: Optional[str] :param extra_install_commands: Additional commands to execute during the Install phase of the CodeBuild execution, by default None :type extra_install_commands: Optional[List[str]], optional :param extra_pre_build_commands: Additional commands to execute during the PreBuild phase of the CodeBuild execution, by default None :type extra_pre_build_commands: Optional[List[str]], optional :param extra_pre_execution_commands: Additional commands to execute during the Build phase of the CodeBuild execution prior to calling the remote_function, by default None :type extra_pre_execution_commands: Optional[List[str]], optional :param extra_build_commands: Additional commands to execute during the Build phase of the CodeBuild execution after calling the remote_function, by default None :type extra_build_commands: Optional[List[str]], optional :param extra_post_build_commands: Additional commands to execute during the PostBuild phase of the CodeBuild execution, by default None :type extra_post_build_commands: Optional[List[str]], optional :param extra_dirs: Name and Location of additional local directories to bundle and include in the CodeBuild exeuction, by default None :type extra_dirs: Optional[Dict[str, str]], optional :param extra_files: Name and Location of additional local files to bundle and include in the CodeBuild execution, by default None :type extra_files: Optional[Dict[str, str]], optional :param extra_env_vars: Additional environment variables to set in the CodeBuild execution, by default None :type extra_env_vars: Optional[Dict[str, Union[str, EnvVar]]], optional :param extra_exported_env_vars: Additional environment variables to export from the CodeBuild execution, by default None :type extra_exported_env_vars: Optional[List[str]], optional :param abort_phases_on_failure: Override default abort of CodeBuild Phases when an execution failure occurs, by default None :type abort_phases_on_failure: Optional[bool], optional :param runtime_versions: Override default runtime versions (e.g. python, nodejs) to install, by default None :type runtime_versions: Optional[Dict[str, str]], optional :param bundle_id: Optional identifier to uniquely identify a bundle locally when multiple ``remote_functions`` are executed concurrently, by default None :type bundle_id: Optional[str], optional :param boto3_session: Optional Session or function returning a Session to use for all boto3 operations, by default None :type boto3_session: Optional[Union[Callable[[], Session], Session]], optional :returns: The decorated function :rtype: RemoteFunctionDecorator .. py:function:: seedkit_deployed(seedkit_name: str, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) -> Tuple[bool, str, Dict[str, str]] Checks for existence of the Seedkit CloudFormation Stack If the Stack exists, then the Stack Outputs are also returned to eliminate need for another roundtrip call to CloudFormation. :param seedkit_name: Named of the seedkit to check. :type seedkit_name: str :param session: Optional Session or function returning a Session to use for all boto3 operations, by default None :type session: Optional[Union[Callable[[], Session], Session]], optional :returns: Returns a Tuple with a bool indicating existence of the Stack, the Stack name, and a dict with the Stack Outputs :rtype: Tuple[bool, str, Dict[str, str]] .. py:data:: ConfigureDecorator .. py:data:: RemoteFunctionDecorator