runway.module.serverless module¶
Serverless module.
-
runway.module.serverless.
gen_sls_config_files
(stage, region)[source]¶ Generate possible SLS config files names.
-
runway.module.serverless.
deploy_package
(sls_opts, bucketname, context, path, logger=<RunwayLogger runway.module.serverless (WARNING)>)[source]¶ Run sls package command.
- Parameters
sls_opts (List[str]) – List of options for Serverless CLI.
bucketname (str) – S3 Bucket name.
context (Context) – Runway context object.
path (str) – Module path.
logger (Optional[logging.Logger]) – A more granular logger for log messages.
-
class
runway.module.serverless.
Serverless
(context, path, options=None)[source]¶ Bases:
runway.module.RunwayModuleNpm
Serverless Runway Module.
Instantiate class.
- Parameters
-
property
cli_args
¶ Generate CLI args from self used in all Serverless commands.
- Returns
List[str]
-
env_file
¶ Decorator for creating cached properties.
A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
-
property
skip
¶ Determine if the module should be skipped.
- Returns
To skip, or not to skip, that is the question.
- Return type
-
extend_serverless_yml
(func)[source]¶ Extend the Serverless config file with additional YAML from options.
- Parameters
func (Callable) – Callable to use after handling the Serverless config file.
-
gen_cmd
(command, args_list=None)[source]¶ Generate and log a Serverless command.
This does not execute the command, only prepares it for use.
-
sls_deploy
(skip_install=False)[source]¶ Execute
sls deploy
command.- Parameters
skip_install (bool) – Skip
npm install
before running the Serverless command. (default:False
)
-
sls_print
(item_path=None, skip_install=False)[source]¶ Execute
sls print
command.- Keyword Arguments
- Returns
Resolved Serverless config file.
- Return type
Dict[str, Any]
- Raises
SystemExit – If a runway-tmp.serverless.yml file already exists.
-
class
runway.module.serverless.
ServerlessOptions
(args, extend_serverless_yml, promotezip, skip_npm_ci=False)[source]¶ Bases:
runway.module.ModuleOptions
Module options for Serverless.
Instantiate class.
- Keyword Arguments
args (List[str]) – Arguments to append to Serverless CLI commands. These will always be placed after the default arguments provided by Runway.
extend_serverless_yml (Dict[str, Any]) – If provided, a temporary Serverless config will be created will be created from what exists in the module directory then the value of this option will be merged into it. The temporary file will be deleted at the end of execution.
promotezip (Dict[str, str]) – If provided, promote Serverless generated zip files between environments from a build AWS account.
skip_npm_ci (bool) – Skip the
npm ci
Runway executes at the begining of each Serverless module run.
-
classmethod
parse
(**kwargs)[source]¶ Parse the options definition and return an options object.
- Keyword Arguments
args (Optional[List[str]]) – Arguments to append to Serverless CLI commands. These will always be placed after the default arguments provided by Runway.
extend_serverless_yml (Optional[Dict[str, Any]]) – If provided, a temporary Serverless config will be created will be created from what exists in the module directory then the value of this option will be merged into it. The temporary file will be deleted at the end of execution.
promotezip (Optional[Dict[str, str]]) – If provided, promote Serverless generated zip files between environments from a build AWS account.
skip_npm_ci (bool) – Skip the
npm ci
Runway executes at the begining of each Serverless module run.
- Returns
ServerlessOptions
- Raises
ValueError – promotezip was provided but missing bucketname.