diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9af2f5e4a..50de9abd7e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,7 @@ jobs: runs-on: ubuntu-latest needs: - make-pr + - validate-schema - integration-tests - smoke-and-functional-tests - docker-disabled @@ -32,6 +33,7 @@ jobs: - name: report-failure if : | needs.make-pr.result != 'success' || + needs.validate-schema.result != 'success' || needs.integration-tests.result != 'success' || needs.smoke-and-functional-tests.result != 'success' || needs.docker-disabled.result != 'success' @@ -64,6 +66,27 @@ jobs: - run: make init - run: make pr + validate-schema: + name: Validate JSON schema + if: github.repository_owner == 'aws' + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + name: Install Python 3.11 + with: + python-version: 3.11 + - run: make init + - run: | + diff <( cat schema/samcli.json ) <( python schema/make_schema.py; cat schema/samcli.json ) && exit 0 # exit if schema is unchanged + echo "The generated schema differs from that in the PR. Please run 'make schema'." + exit 1 + name: Generate and compare the schema + shell: bash + integration-tests: name: Integration Tests / ${{ matrix.os }} / ${{ matrix.python }} / ${{ matrix.tests_folder }} if: github.repository_owner == 'aws' diff --git a/Makefile b/Makefile index c65a27de88..081f22d6ae 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,19 @@ # environment variable. SAM_CLI_TELEMETRY ?= 0 +.PHONY: schema + init: SAM_CLI_DEV=1 pip install -e '.[dev]' test: # Run unit tests # Fail if coverage falls below 95% - pytest --cov samcli --cov-report term-missing --cov-fail-under 94 tests/unit + pytest --cov samcli --cov schema --cov-report term-missing --cov-fail-under 94 tests/unit test-cov-report: # Run unit tests with html coverage report - pytest --cov samcli --cov-report html --cov-fail-under 94 tests/unit + pytest --cov samcli --cov schema --cov-report html --cov-fail-under 94 tests/unit integ-test: # Integration tests don't need code coverage @@ -34,24 +36,27 @@ smoke-test: lint: # Linter performs static analysis to catch latent bugs - ruff samcli + ruff samcli schema # mypy performs type check - mypy --exclude /testdata/ --exclude /init/templates/ --no-incremental setup.py samcli tests + mypy --exclude /testdata/ --exclude /init/templates/ --no-incremental setup.py samcli tests schema # Command to run everytime you make changes to verify everything works dev: lint test black: - black setup.py samcli tests + black setup.py samcli tests schema black-check: - black --check setup.py samcli tests + black --check setup.py samcli tests schema format: black ruff samcli --fix +schema: + python schema/make_schema.py + # Verifications to run before sending a pull request -pr: init dev black-check +pr: init dev schema black-check # (jfuss) We updated to have two requirement files, one for mac and one for linux. This # is meant to be a short term fix when upgrading the Linux installer to be python3.11 from diff --git a/samcli/cli/types.py b/samcli/cli/types.py index 5f12f72b31..5cc77df1ec 100644 --- a/samcli/cli/types.py +++ b/samcli/cli/types.py @@ -85,8 +85,7 @@ class CfnParameterOverridesType(click.ParamType): ordered_pattern_match = [_pattern_1, _pattern_2] - # NOTE(TheSriram): name needs to be added to click.ParamType requires it. - name = "" + name = "string,list" def convert(self, value, param, ctx): result = {} @@ -140,8 +139,7 @@ class CfnMetadataType(click.ParamType): _pattern = r"(?:{key}={value})".format(key=PARAM_AND_METADATA_KEY_REGEX, value=VALUE_REGEX_COMMA_DELIM) - # NOTE(TheSriram): name needs to be added to click.ParamType requires it. - name = "" + name = "string" def convert(self, value, param, ctx): result = {} @@ -196,8 +194,7 @@ def __init__(self, multiple_values_per_key=False): _pattern = r"{tag}={tag}".format(tag=_generate_match_regex(match_pattern=TAG_REGEX, delim=" ")) - # NOTE(TheSriram): name needs to be added to click.ParamType requires it. - name = "" + name = "list" def convert(self, value, param, ctx): result = {} @@ -301,8 +298,7 @@ class SigningProfilesOptionType(click.ParamType): pattern = r"(?:(?: )([A-Za-z0-9\"]+)=(\"(?:\\.|[^\"\\]+)*\"|(?:\\.|[^ \"\\]+)+))" - # Note: this is required, otherwise it is failing when running help - name = "" + name = "string" def convert(self, value, param, ctx): """ @@ -393,7 +389,7 @@ def transform(self, *args, **kwargs): # Transformation callback function checks if the received option value is a valid ECR url. transformer = Transformer(converter=click.STRING, transformation=is_ecr_url) - name = "" + name = "string" def convert(self, value, param, ctx): """ @@ -410,7 +406,7 @@ class ImageRepositoriesType(click.ParamType): Custom Parameter Type for Multi valued Image Repositories option. """ - name = "" + name = "list" KEY_VALUE_PAIR_LENGTH = 2 def convert(self, value, param, ctx): @@ -431,7 +427,7 @@ class RemoteInvokeBotoApiParameterType(click.ParamType): Custom Parameter Type for Multi valued Boto API parameter option of remote invoke command. """ - name = "" + name = "list" MIN_KEY_VALUE_PAIR_LENGTH = 2 def convert(self, value, param, ctx): diff --git a/samcli/commands/_utils/options.py b/samcli/commands/_utils/options.py index 24f5eef3a6..aa57f65f2c 100644 --- a/samcli/commands/_utils/options.py +++ b/samcli/commands/_utils/options.py @@ -367,13 +367,6 @@ def common_observability_click_options(): help="Fetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or " "formatted timestamp like '2018-01-01 10:10:10'", ), - click.option( - "--tail", - "-t", - is_flag=True, - help="Tail events. This will ignore the end time argument and continue to fetch events as they " - "become available. If option --tail without a --name will pull from all possible resources", - ), click.option( "--output", help=""" @@ -827,7 +820,7 @@ def _space_separated_list_func_type(value): raise ValueError() -_space_separated_list_func_type.__name__ = "LIST" +_space_separated_list_func_type.__name__ = "list,string" def generate_next_command_recommendation(command_tuples: List[Tuple[str, str]]) -> str: diff --git a/samcli/commands/build/command.py b/samcli/commands/build/command.py index 80463d9d6b..17c177a1e1 100644 --- a/samcli/commands/build/command.py +++ b/samcli/commands/build/command.py @@ -83,7 +83,7 @@ multiple=True, # Can pass in multiple env vars required=False, help="Environment variables to be passed into build containers" - "Resource format (FuncName.VarName=Value) or Global format (VarName=Value)." + "\nResource format (FuncName.VarName=Value) or Global format (VarName=Value)." "\n\n Example: --container-env-var Func1.VAR1=value1 --container-env-var VAR2=value2", cls=ContainerOptions, ) diff --git a/samcli/commands/init/command.py b/samcli/commands/init/command.py index f31e967a04..6a416f3119 100644 --- a/samcli/commands/init/command.py +++ b/samcli/commands/init/command.py @@ -106,6 +106,7 @@ def wrapped(*args, **kwargs): @click.command( "init", + help=HELP_TEXT, short_help=HELP_TEXT, context_settings={"max_content_width": 120}, cls=InitCommand, diff --git a/samcli/commands/local/cli_common/options.py b/samcli/commands/local/cli_common/options.py index 050e6201e8..75aeb23314 100644 --- a/samcli/commands/local/cli_common/options.py +++ b/samcli/commands/local/cli_common/options.py @@ -231,7 +231,7 @@ def warm_containers_common_options(f): click.option( "--debug-function", help="Optional. Specifies the Lambda Function logicalId to apply debug options to when" - " --warm-containers is specified. This parameter applies to --debug-port, --debugger-path," + " --warm-containers is specified. This parameter applies to --debug-port, --debugger-path," " and --debug-args.", type=click.STRING, multiple=False, diff --git a/samcli/commands/logs/command.py b/samcli/commands/logs/command.py index f8df636b59..e7336f2d7a 100644 --- a/samcli/commands/logs/command.py +++ b/samcli/commands/logs/command.py @@ -71,6 +71,14 @@ "supported by AWS CloudWatch Logs. See the AWS CloudWatch Logs documentation for the syntax " "https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html", ) +@click.option( + "--tail", + "-t", + is_flag=True, + help="Tail events. This will ignore the end time argument and continue to fetch events as they " + "become available. If option --tail is provided without a --name, one will be pulled from all " + "possible resources", +) @click.option( "--include-traces", "-i", diff --git a/samcli/commands/traces/command.py b/samcli/commands/traces/command.py index d82b6871ab..434371319a 100644 --- a/samcli/commands/traces/command.py +++ b/samcli/commands/traces/command.py @@ -35,6 +35,13 @@ multiple=True, help="Fetch specific trace by providing its id", ) +@click.option( + "--tail", + "-t", + is_flag=True, + help="Tail events. This will ignore the end time argument and continue to fetch events as they " + "become available.", +) @common_observability_options @cli_framework_options @aws_creds_options @@ -46,9 +53,9 @@ def cli( ctx, trace_id, + tail, start_time, end_time, - tail, output, config_file, config_env, @@ -56,10 +63,10 @@ def cli( """ `sam traces` command entry point """ - do_cli(trace_id, start_time, end_time, tail, output, ctx.region) + do_cli(trace_id, tail, start_time, end_time, output, ctx.region) -def do_cli(trace_ids, start_time, end_time, tailing, output, region): +def do_cli(trace_ids, tailing, start_time, end_time, output, region): """ Implementation of the ``cli`` method """ diff --git a/samcli/lib/config/samconfig.py b/samcli/lib/config/samconfig.py index e9acafd557..2cd0d41199 100644 --- a/samcli/lib/config/samconfig.py +++ b/samcli/lib/config/samconfig.py @@ -87,7 +87,7 @@ def get_all(self, cmd_names, section, env=DEFAULT_ENV): self.document = self._read() config_content = self.document.get(env, {}) - params = config_content.get(self._to_key(cmd_names), {}).get(section, {}) + params = config_content.get(self.to_key(cmd_names), {}).get(section, {}) if DEFAULT_GLOBAL_CMDNAME in config_content: global_params = config_content.get(DEFAULT_GLOBAL_CMDNAME, {}).get(section, {}) global_params.update(params.copy()) @@ -116,7 +116,7 @@ def put(self, cmd_names, section, key, value, env=DEFAULT_ENV): # Empty document prepare the initial structure. # self.document is a nested dict, we need to check each layer and add new tables, otherwise duplicated key # in parent layer will override the whole child layer - cmd_name_key = self._to_key(cmd_names) + cmd_name_key = self.to_key(cmd_names) env_content = self.document.get(env, {}) cmd_content = env_content.get(cmd_name_key, {}) param_content = cmd_content.get(section, {}) @@ -284,6 +284,6 @@ def _version_sanity_check(version: Any) -> None: raise SamConfigVersionException(f"'{VERSION_KEY}' key is not present or is in unrecognized format. ") @staticmethod - def _to_key(cmd_names: Iterable[str]) -> str: + def to_key(cmd_names: Iterable[str]) -> str: # construct a parsed name that is of the format: a_b_c_d return "_".join([cmd.replace("-", "_").replace(" ", "_") for cmd in cmd_names]) diff --git a/samcli/local/common/runtime_template.py b/samcli/local/common/runtime_template.py index 707ea0f3f3..c999e33982 100644 --- a/samcli/local/common/runtime_template.py +++ b/samcli/local/common/runtime_template.py @@ -83,13 +83,15 @@ def get_local_lambda_images_location(mapping, runtime): return os.path.join(_lambda_images_templates, runtime, dir_name + "-lambda-image") -SUPPORTED_DEP_MANAGERS: List[str] = list( - set( - { - c.get("dependency_manager") # type: ignore - for c in list(itertools.chain(*(RUNTIME_DEP_TEMPLATE_MAPPING.values()))) - if c.get("dependency_manager") - } +SUPPORTED_DEP_MANAGERS: List[str] = sorted( + list( + set( + { + c.get("dependency_manager") # type: ignore + for c in list(itertools.chain(*(RUNTIME_DEP_TEMPLATE_MAPPING.values()))) + if c.get("dependency_manager") + } + ) ) ) @@ -145,7 +147,7 @@ def get_local_lambda_images_location(mapping, runtime): "ruby2.7": "amazon/ruby2.7-base", } -LAMBDA_IMAGES_RUNTIMES: List = list(set(LAMBDA_IMAGES_RUNTIMES_MAP.values())) +LAMBDA_IMAGES_RUNTIMES: List = sorted(list(set(LAMBDA_IMAGES_RUNTIMES_MAP.values()))) # Schemas Code lang is a MINIMUM supported version # - this is why later Lambda runtimes can be mapped to earlier Schemas Code Languages diff --git a/schema/__init__.py b/schema/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/schema/exceptions.py b/schema/exceptions.py new file mode 100644 index 0000000000..af77976327 --- /dev/null +++ b/schema/exceptions.py @@ -0,0 +1,5 @@ +"""Exceptions related to schema generation.""" + + +class SchemaGenerationException(Exception): + pass diff --git a/schema/make_schema.py b/schema/make_schema.py new file mode 100644 index 0000000000..e1d7e889cf --- /dev/null +++ b/schema/make_schema.py @@ -0,0 +1,253 @@ +"""Handles JSON schema generation logic""" + + +import importlib +import json +from dataclasses import dataclass +from enum import Enum +from typing import Any, Dict, List, Optional, Union + +import click + +from samcli.cli.command import _SAM_CLI_COMMAND_PACKAGES +from samcli.lib.config.samconfig import SamConfig +from schema.exceptions import SchemaGenerationException + +PARAMS_TO_EXCLUDE = [ + "config_env", # shouldn't allow different environment from where the config is being read from + "config_file", # shouldn't allow reading another file within current file +] +PARAMS_TO_OMIT_DEFAULT_FIELD = [ + "layer_cache_basedir" # sets default to root directory to that of machine the schema is generated on +] +CHARS_TO_CLEAN = [ + "\b", # backspaces + "\u001b[0m", # ANSI start bold + "\u001b[1m", # ANSI end bold +] + + +class SchemaKeys(Enum): + SCHEMA_FILE_NAME = "schema/samcli.json" + SCHEMA_DRAFT = "http://json-schema.org/draft-04/schema#" + TITLE = "AWS SAM CLI samconfig schema" + ENVIRONMENT_REGEX = "^.+$" + + +@dataclass() +class SamCliParameterSchema: + """Representation of a parameter in the SAM CLI. + + It includes relevant information for the JSON schema, such as name, data type, + and description, among others. + """ + + name: str + type: Union[str, List[str]] + description: str = "" + default: Optional[Any] = None + items: Optional[str] = None + choices: Optional[Any] = None + + def to_schema(self) -> Dict[str, Any]: + """Return the JSON schema representation of the SAM CLI parameter.""" + param: Dict[str, Any] = {} + param.update({"title": self.name, "type": self.type, "description": self.description}) + if self.default: + param.update({"default": self.default}) + if self.items: + param.update({"items": {"type": self.items}}) + if self.choices: + if isinstance(self.choices, list): + self.choices.sort() + param.update({"enum": self.choices}) + return param + + +@dataclass() +class SamCliCommandSchema: + """Representation of a command in the SAM CLI. + + It includes relevant information for the JSON schema, such as name, a description of the + command, and a list of all available parameters. + """ + + name: str # Full command name, with underscores (i.e. remote_invoke, local_start_lambda) + description: str + parameters: List[SamCliParameterSchema] + + def to_schema(self) -> dict: + """Return the JSON schema representation of the SAM CLI command.""" + split_cmd_name = self.name.split("_") + formatted_cmd_name = " ".join(split_cmd_name) + formatted_params_list = "* " + "\n* ".join([f"{param.name}:\n{param.description}" for param in self.parameters]) + params_description = f"Available parameters for the {formatted_cmd_name} command:\n{formatted_params_list}" + + return { + self.name: { + "title": f"{formatted_cmd_name.title()} command", + "description": self.description or "", + "properties": { + "parameters": { + "title": f"Parameters for the {formatted_cmd_name} command", + "description": params_description, + "type": "object", + "properties": {param.name: param.to_schema() for param in self.parameters}, + }, + }, + "required": ["parameters"], + } + } + + +def clean_text(text: str) -> str: + """Clean up a string of text to be formatted for the JSON schema.""" + if not text: + return "" + for char_to_delete in CHARS_TO_CLEAN: + text = text.replace(char_to_delete, "") + return text.strip("\n").strip() + + +def format_param(param: click.core.Option) -> SamCliParameterSchema: + """Format a click Option parameter to a SamCliParameter object. + + A parameter object should contain the following information that will be + necessary for including in the JSON schema: + * name - The name of the parameter + * help - The parameter's description (may vary between commands) + * type - The data type accepted by the parameter + * type.choices - If there are only a certain number of options allowed, + a list of those allowed options + * default - The default option for that parameter + """ + if not param: + raise SchemaGenerationException("Expected to format a parameter that doesn't exist") + if not param.type.name: + raise SchemaGenerationException(f"Parameter {param} passed without a type:\n{param.type}") + + param_type = [] + if "," in param.type.name: # custom type with support for various input values + param_type = [x.lower() for x in param.type.name.split(",")] + else: + param_type.append(param.type.name.lower()) + + formatted_param_types = [] + # NOTE: Params do not have explicit "string" type; either "text" or "path". + # All choice options are from a set of strings. + for param_name in param_type: + if param_name in ["text", "path", "choice", "filename", "directory"]: + formatted_param_types.append("string") + elif param_name == "list": + formatted_param_types.append("array") + else: + formatted_param_types.append(param_name or "string") + formatted_param_types = sorted(list(set(formatted_param_types))) # deduplicate + + formatted_param: SamCliParameterSchema = SamCliParameterSchema( + param.name or "", + formatted_param_types if len(formatted_param_types) > 1 else formatted_param_types[0], + clean_text(param.help or ""), + items="string" if "array" in formatted_param_types else None, + ) + + if param.default and param.name not in PARAMS_TO_OMIT_DEFAULT_FIELD: + formatted_param.default = list(param.default) if isinstance(param.default, tuple) else param.default + + if param.type.name == "choice" and isinstance(param.type, click.Choice): + formatted_param.choices = list(param.type.choices) + + return formatted_param + + +def get_params_from_command(cli) -> List[SamCliParameterSchema]: + """Given a CLI object, return a list of all parameters in that CLI, formatted as SamCliParameterSchema objects.""" + return [ + format_param(param) + for param in cli.params + if param.name and isinstance(param, click.core.Option) and param.name not in PARAMS_TO_EXCLUDE + ] + + +def retrieve_command_structure(package_name: str) -> List[SamCliCommandSchema]: + """Given a SAM CLI package name, retrieve its structure. + + Such a structure is the list of all subcommands as `SamCliCommandSchema`, which includes + the command's name, description, and its parameters. + + Parameters + ---------- + package_name: str + The name of the command package to retrieve. + + Returns + ------- + List[SamCliCommandSchema] + A list of SamCliCommandSchema objects which represent either a command or a list of + subcommands within the package. + """ + module = importlib.import_module(package_name) + command = [] + + if isinstance(module.cli, click.core.Group): # command has subcommands (e.g. local invoke) + for subcommand in module.cli.commands.values(): + cmd_name = SamConfig.to_key([module.__name__.split(".")[-1], str(subcommand.name)]) + command.append( + SamCliCommandSchema( + cmd_name, + clean_text(subcommand.help or subcommand.short_help or ""), + get_params_from_command(subcommand), + ) + ) + else: + cmd_name = SamConfig.to_key([module.__name__.split(".")[-1]]) + command.append( + SamCliCommandSchema( + cmd_name, + clean_text(module.cli.help or module.cli.short_help or ""), + get_params_from_command(module.cli), + ) + ) + return command + + +def generate_schema() -> dict: + """Generate a JSON schema for all SAM CLI commands. + + Returns + ------- + dict + A dictionary representation of the JSON schema. + """ + schema: dict = {} + commands: List[SamCliCommandSchema] = [] + + # Populate schema with relevant attributes + schema["$schema"] = SchemaKeys.SCHEMA_DRAFT.value + schema["title"] = SchemaKeys.TITLE.value + schema["type"] = "object" + schema["properties"] = { + # Version number required for samconfig files to be valid + "version": {"title": "Config version", "type": "number", "default": 0.1} + } + schema["required"] = ["version"] + schema["additionalProperties"] = False + # Iterate through packages for command and parameter information + for package_name in _SAM_CLI_COMMAND_PACKAGES: + commands.extend(retrieve_command_structure(package_name)) + # Generate schema for each of the commands + schema["patternProperties"] = {SchemaKeys.ENVIRONMENT_REGEX.value: {"title": "Environment", "properties": {}}} + for command in commands: + schema["patternProperties"][SchemaKeys.ENVIRONMENT_REGEX.value]["properties"].update(command.to_schema()) + return schema + + +def write_schema(): + """Generate the SAM CLI JSON schema and write it to file.""" + schema = generate_schema() + with open(SchemaKeys.SCHEMA_FILE_NAME.value, "w+", encoding="utf-8") as outfile: + json.dump(schema, outfile, indent=2) + + +if __name__ == "__main__": + write_schema() diff --git a/schema/samcli.json b/schema/samcli.json new file mode 100644 index 0000000000..cbe8ee4fce --- /dev/null +++ b/schema/samcli.json @@ -0,0 +1,2061 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "AWS SAM CLI samconfig schema", + "type": "object", + "properties": { + "version": { + "title": "Config version", + "type": "number", + "default": 0.1 + } + }, + "required": [ + "version" + ], + "additionalProperties": false, + "patternProperties": { + "^.+$": { + "title": "Environment", + "properties": { + "init": { + "title": "Init command", + "description": "Initialize an AWS SAM application.", + "properties": { + "parameters": { + "title": "Parameters for the init command", + "description": "Available parameters for the init command:\n* no_interactive:\nDisable interactive prompting for init parameters. (fail if any required values are missing)\n* architecture:\nArchitectures for Lambda functions.\n\nArchitectures: ['arm64', 'x86_64']\n* location:\nTemplate location (git, mercurial, http(s), zip, path).\n* runtime:\nLambda runtime for application.\n\nRuntimes: dotnet6, go1.x, java17, java11, java8.al2, java8, nodejs18.x, nodejs16.x, nodejs14.x, nodejs12.x, provided, provided.al2, python3.9, python3.8, python3.7, python3.11, python3.10, ruby3.2, ruby2.7\n* package_type:\nLambda deployment package type.\n\nPackage Types: Zip, Image\n* base_image:\nLambda base image for deploying IMAGE based package type.\n\nBase images: amazon/dotnet6-base, amazon/go-provided.al2-base, amazon/go1.x-base, amazon/java11-base, amazon/java17-base, amazon/java8-base, amazon/java8.al2-base, amazon/nodejs12.x-base, amazon/nodejs14.x-base, amazon/nodejs16.x-base, amazon/nodejs18.x-base, amazon/python3.10-base, amazon/python3.11-base, amazon/python3.7-base, amazon/python3.8-base, amazon/python3.9-base, amazon/ruby2.7-base, amazon/ruby3.2-base\n* dependency_manager:\nDependency manager for Lambda runtime.\n\nDependency managers: bundler, cli-package, gradle, maven, mod, npm, pip\n* output_dir:\nDirectory to initialize AWS SAM application.\n* name:\nName of AWS SAM Application.\n* app_template:\nIdentifier of the managed application template to be used. Alternatively, run '$sam init' without options for an interactive workflow.\n* no_input:\nDisable Cookiecutter prompting and accept default values defined in the cookiecutter config.\n* extra_context:\nOverride custom parameters in the template's cookiecutter.json configuration e.g. {\"customParam1\": \"customValue1\", \"customParam2\":\"customValue2\"}\n* tracing:\nEnable AWS X-Ray tracing for application.\n* application_insights:\nEnable CloudWatch Application Insights monitoring for application.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "no_interactive": { + "title": "no_interactive", + "type": "boolean", + "description": "Disable interactive prompting for init parameters. (fail if any required values are missing)" + }, + "architecture": { + "title": "architecture", + "type": "string", + "description": "Architectures for Lambda functions.\n\nArchitectures: ['arm64', 'x86_64']", + "enum": [ + "arm64", + "x86_64" + ] + }, + "location": { + "title": "location", + "type": "string", + "description": "Template location (git, mercurial, http(s), zip, path)." + }, + "runtime": { + "title": "runtime", + "type": "string", + "description": "Lambda runtime for application.\n\nRuntimes: dotnet6, go1.x, java17, java11, java8.al2, java8, nodejs18.x, nodejs16.x, nodejs14.x, nodejs12.x, provided, provided.al2, python3.9, python3.8, python3.7, python3.11, python3.10, ruby3.2, ruby2.7", + "enum": [ + "dotnet6", + "go1.x", + "java11", + "java17", + "java8", + "java8.al2", + "nodejs12.x", + "nodejs14.x", + "nodejs16.x", + "nodejs18.x", + "provided", + "provided.al2", + "python3.10", + "python3.11", + "python3.7", + "python3.8", + "python3.9", + "ruby2.7", + "ruby3.2" + ] + }, + "package_type": { + "title": "package_type", + "type": "string", + "description": "Lambda deployment package type.\n\nPackage Types: Zip, Image", + "enum": [ + "Image", + "Zip" + ] + }, + "base_image": { + "title": "base_image", + "type": "string", + "description": "Lambda base image for deploying IMAGE based package type.\n\nBase images: amazon/dotnet6-base, amazon/go-provided.al2-base, amazon/go1.x-base, amazon/java11-base, amazon/java17-base, amazon/java8-base, amazon/java8.al2-base, amazon/nodejs12.x-base, amazon/nodejs14.x-base, amazon/nodejs16.x-base, amazon/nodejs18.x-base, amazon/python3.10-base, amazon/python3.11-base, amazon/python3.7-base, amazon/python3.8-base, amazon/python3.9-base, amazon/ruby2.7-base, amazon/ruby3.2-base", + "enum": [ + "amazon/dotnet6-base", + "amazon/go-provided.al2-base", + "amazon/go1.x-base", + "amazon/java11-base", + "amazon/java17-base", + "amazon/java8-base", + "amazon/java8.al2-base", + "amazon/nodejs12.x-base", + "amazon/nodejs14.x-base", + "amazon/nodejs16.x-base", + "amazon/nodejs18.x-base", + "amazon/python3.10-base", + "amazon/python3.11-base", + "amazon/python3.7-base", + "amazon/python3.8-base", + "amazon/python3.9-base", + "amazon/ruby2.7-base", + "amazon/ruby3.2-base" + ] + }, + "dependency_manager": { + "title": "dependency_manager", + "type": "string", + "description": "Dependency manager for Lambda runtime.\n\nDependency managers: bundler, cli-package, gradle, maven, mod, npm, pip", + "enum": [ + "bundler", + "cli-package", + "gradle", + "maven", + "mod", + "npm", + "pip" + ] + }, + "output_dir": { + "title": "output_dir", + "type": "string", + "description": "Directory to initialize AWS SAM application.", + "default": "." + }, + "name": { + "title": "name", + "type": "string", + "description": "Name of AWS SAM Application." + }, + "app_template": { + "title": "app_template", + "type": "string", + "description": "Identifier of the managed application template to be used. Alternatively, run '$sam init' without options for an interactive workflow." + }, + "no_input": { + "title": "no_input", + "type": "boolean", + "description": "Disable Cookiecutter prompting and accept default values defined in the cookiecutter config." + }, + "extra_context": { + "title": "extra_context", + "type": "string", + "description": "Override custom parameters in the template's cookiecutter.json configuration e.g. {\"customParam1\": \"customValue1\", \"customParam2\":\"customValue2\"}" + }, + "tracing": { + "title": "tracing", + "type": "boolean", + "description": "Enable AWS X-Ray tracing for application." + }, + "application_insights": { + "title": "application_insights", + "type": "boolean", + "description": "Enable CloudWatch Application Insights monitoring for application." + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "validate": { + "title": "Validate command", + "description": "Validate an AWS SAM Template.", + "properties": { + "parameters": { + "title": "Parameters for the validate command", + "description": "Available parameters for the validate command:\n* template_file:\nAWS SAM template file.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* lint:\nRun linting validation on template through cfn-lint. Create a cfnlintrc config file to specify additional parameters. For more information, see: https://github.com/aws-cloudformation/cfn-lint", + "type": "object", + "properties": { + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template file.", + "default": "template.[yaml|yml|json]" + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "lint": { + "title": "lint", + "type": "boolean", + "description": "Run linting validation on template through cfn-lint. Create a cfnlintrc config file to specify additional parameters. For more information, see: https://github.com/aws-cloudformation/cfn-lint" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "build": { + "title": "Build command", + "description": "Build AWS serverless function code.", + "properties": { + "parameters": { + "title": "Parameters for the build command", + "description": "Available parameters for the build command:\n* hook_name:\nHook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']\n* skip_prepare_infra:\nSkip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name.\n* use_container:\nBuild functions within an AWS Lambda-like container.\n* container_env_var:\nEnvironment variables to be passed into build containers\nResource format (FuncName.VarName=Value) or Global format (VarName=Value).\n\n Example: --container-env-var Func1.VAR1=value1 --container-env-var VAR2=value2\n* container_env_var_file:\nEnvironment variables json file (e.g., env_vars.json) to be passed to build containers.\n* build_image:\nContainer image URIs for building functions/layers. You can specify for all functions/layers with just the image URI (--build-image public.ecr.aws/sam/build-nodejs18.x:latest). You can specify for each individual function with (--build-image FunctionLogicalID=public.ecr.aws/sam/build-nodejs18.x:latest). A combination of the two can be used. If a function does not have build image specified or an image URI for all functions, the default SAM CLI build images will be used.\n* exclude:\nName of the resource(s) to exclude from AWS SAM CLI build.\n* parallel:\nEnable parallel builds for AWS SAM template's functions and layers.\n* mount_with:\nSpecify mount mode for building functions/layers inside container. If it is mounted with write permissions, some files in source code directory may be changed/added by the build process. By default the source code directory is read only.\n* build_dir:\nDirectory to store build artifacts.Note: This directory will be first removed before starting a build.\n* cache_dir:\nDirectory to store cached artifacts. The default cache directory is .aws-sam/cache\n* base_dir:\nResolve relative paths to function's source code with respect to this directory. Use this if SAM template and source code are not in same enclosing folder. By default, relative paths are resolved with respect to the SAM template's location.\n* manifest:\nPath to a custom dependency manifest. Example: custom-package.json\n* cached:\nEnable cached builds.Reuse build artifacts that have not changed from previous builds. \n\nAWS SAM CLI evaluates if files in your project directory have changed. \n\nNote: AWS SAM CLI does not evaluate changes made to third party modules that the project depends on.Example: Python function includes a requirements.txt file with the following entry requests=1.x and the latest request module version changes from 1.1 to 1.2, AWS SAM CLI will not pull the latest version until a non-cached build is run.\n* template_file:\nAWS SAM template file.\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* skip_pull_image:\nSkip pulling down the latest Docker image for Lambda runtime.\n* docker_network:\nName or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "hook_name": { + "title": "hook_name", + "type": "string", + "description": "Hook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']" + }, + "skip_prepare_infra": { + "title": "skip_prepare_infra", + "type": "boolean", + "description": "Skip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name." + }, + "use_container": { + "title": "use_container", + "type": "boolean", + "description": "Build functions within an AWS Lambda-like container." + }, + "container_env_var": { + "title": "container_env_var", + "type": "string", + "description": "Environment variables to be passed into build containers\nResource format (FuncName.VarName=Value) or Global format (VarName=Value).\n\n Example: --container-env-var Func1.VAR1=value1 --container-env-var VAR2=value2" + }, + "container_env_var_file": { + "title": "container_env_var_file", + "type": "string", + "description": "Environment variables json file (e.g., env_vars.json) to be passed to build containers." + }, + "build_image": { + "title": "build_image", + "type": "string", + "description": "Container image URIs for building functions/layers. You can specify for all functions/layers with just the image URI (--build-image public.ecr.aws/sam/build-nodejs18.x:latest). You can specify for each individual function with (--build-image FunctionLogicalID=public.ecr.aws/sam/build-nodejs18.x:latest). A combination of the two can be used. If a function does not have build image specified or an image URI for all functions, the default SAM CLI build images will be used." + }, + "exclude": { + "title": "exclude", + "type": "string", + "description": "Name of the resource(s) to exclude from AWS SAM CLI build." + }, + "parallel": { + "title": "parallel", + "type": "boolean", + "description": "Enable parallel builds for AWS SAM template's functions and layers." + }, + "mount_with": { + "title": "mount_with", + "type": "string", + "description": "Specify mount mode for building functions/layers inside container. If it is mounted with write permissions, some files in source code directory may be changed/added by the build process. By default the source code directory is read only.", + "default": "READ", + "enum": [ + "READ", + "WRITE" + ] + }, + "build_dir": { + "title": "build_dir", + "type": "string", + "description": "Directory to store build artifacts.Note: This directory will be first removed before starting a build.", + "default": ".aws-sam/build" + }, + "cache_dir": { + "title": "cache_dir", + "type": "string", + "description": "Directory to store cached artifacts. The default cache directory is .aws-sam/cache", + "default": ".aws-sam/cache" + }, + "base_dir": { + "title": "base_dir", + "type": "string", + "description": "Resolve relative paths to function's source code with respect to this directory. Use this if SAM template and source code are not in same enclosing folder. By default, relative paths are resolved with respect to the SAM template's location." + }, + "manifest": { + "title": "manifest", + "type": "string", + "description": "Path to a custom dependency manifest. Example: custom-package.json" + }, + "cached": { + "title": "cached", + "type": "boolean", + "description": "Enable cached builds.Reuse build artifacts that have not changed from previous builds. \n\nAWS SAM CLI evaluates if files in your project directory have changed. \n\nNote: AWS SAM CLI does not evaluate changes made to third party modules that the project depends on.Example: Python function includes a requirements.txt file with the following entry requests=1.x and the latest request module version changes from 1.1 to 1.2, AWS SAM CLI will not pull the latest version until a non-cached build is run." + }, + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template file.", + "default": "template.[yaml|yml|json]" + }, + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "skip_pull_image": { + "title": "skip_pull_image", + "type": "boolean", + "description": "Skip pulling down the latest Docker image for Lambda runtime." + }, + "docker_network": { + "title": "docker_network", + "type": "string", + "description": "Name or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network." + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "local_invoke": { + "title": "Local Invoke command", + "description": "Invoke AWS serverless functions locally.", + "properties": { + "parameters": { + "title": "Parameters for the local invoke command", + "description": "Available parameters for the local invoke command:\n* hook_name:\nHook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']\n* skip_prepare_infra:\nSkip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name.\n* event:\nJSON file containing event data passed to the Lambda function during invoke. If this option is not specified, no event is assumed. Pass in the value '-' to input JSON via stdin\n* no_event:\nDEPRECATED: By default no event is assumed.\n* template_file:\nAWS SAM template which references built artifacts for resources in the template. (if applicable)\n* env_vars:\nJSON file containing values for Lambda function's environment variables.\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* debug_port:\nWhen specified, Lambda function container will start in debug mode and will expose this port on localhost.\n* debugger_path:\nHost path to a debugger that will be mounted into the Lambda container.\n* debug_args:\nAdditional arguments to be passed to the debugger.\n* container_env_vars:\nJSON file containing environment variables to be set within the container environment\n* docker_volume_basedir:\nSpecify the location basedir where the SAM template exists. If Docker is running on a remote machine, Path of the SAM template must be mounted on the Docker machine and modified to match the remote machine.\n* log_file:\nFile to capture output logs.\n* layer_cache_basedir:\nSpecify the location basedir where the lambda layers used by the template will be downloaded to.\n* skip_pull_image:\nSkip pulling down the latest Docker image for Lambda runtime.\n* docker_network:\nName or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network.\n* force_image_build:\nForce rebuilding the image used for invoking functions with layers.\n* shutdown:\nEmulate a shutdown event after invoke completes, to test extension handling of shutdown behavior.\n* container_host:\nHost of locally emulated Lambda container. This option is useful when the container runs on a different host than AWS SAM CLI. For example, if one wants to run AWS SAM CLI in a Docker container on macOS, this option could specify `host.docker.internal`\n* container_host_interface:\nIP address of the host network interface that container ports should bind to. Use 0.0.0.0 to bind to all interfaces.\n* invoke_image:\nContainer image URIs for invoking functions or starting api and function. One can specify the image URI used for the local function invocation (--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). One can also specify for each individual function with (--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). If a function does not have invoke image specified, the default AWS SAM CLI emulation image will be used.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "hook_name": { + "title": "hook_name", + "type": "string", + "description": "Hook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']" + }, + "skip_prepare_infra": { + "title": "skip_prepare_infra", + "type": "boolean", + "description": "Skip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name." + }, + "event": { + "title": "event", + "type": "string", + "description": "JSON file containing event data passed to the Lambda function during invoke. If this option is not specified, no event is assumed. Pass in the value '-' to input JSON via stdin" + }, + "no_event": { + "title": "no_event", + "type": "boolean", + "description": "DEPRECATED: By default no event is assumed.", + "default": true + }, + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template which references built artifacts for resources in the template. (if applicable)", + "default": "template.[yaml|yml|json]" + }, + "env_vars": { + "title": "env_vars", + "type": "string", + "description": "JSON file containing values for Lambda function's environment variables." + }, + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "debug_port": { + "title": "debug_port", + "type": "integer", + "description": "When specified, Lambda function container will start in debug mode and will expose this port on localhost." + }, + "debugger_path": { + "title": "debugger_path", + "type": "string", + "description": "Host path to a debugger that will be mounted into the Lambda container." + }, + "debug_args": { + "title": "debug_args", + "type": "string", + "description": "Additional arguments to be passed to the debugger." + }, + "container_env_vars": { + "title": "container_env_vars", + "type": "string", + "description": "JSON file containing environment variables to be set within the container environment" + }, + "docker_volume_basedir": { + "title": "docker_volume_basedir", + "type": "string", + "description": "Specify the location basedir where the SAM template exists. If Docker is running on a remote machine, Path of the SAM template must be mounted on the Docker machine and modified to match the remote machine." + }, + "log_file": { + "title": "log_file", + "type": "string", + "description": "File to capture output logs." + }, + "layer_cache_basedir": { + "title": "layer_cache_basedir", + "type": "string", + "description": "Specify the location basedir where the lambda layers used by the template will be downloaded to." + }, + "skip_pull_image": { + "title": "skip_pull_image", + "type": "boolean", + "description": "Skip pulling down the latest Docker image for Lambda runtime." + }, + "docker_network": { + "title": "docker_network", + "type": "string", + "description": "Name or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network." + }, + "force_image_build": { + "title": "force_image_build", + "type": "boolean", + "description": "Force rebuilding the image used for invoking functions with layers." + }, + "shutdown": { + "title": "shutdown", + "type": "boolean", + "description": "Emulate a shutdown event after invoke completes, to test extension handling of shutdown behavior." + }, + "container_host": { + "title": "container_host", + "type": "string", + "description": "Host of locally emulated Lambda container. This option is useful when the container runs on a different host than AWS SAM CLI. For example, if one wants to run AWS SAM CLI in a Docker container on macOS, this option could specify `host.docker.internal`", + "default": "localhost" + }, + "container_host_interface": { + "title": "container_host_interface", + "type": "string", + "description": "IP address of the host network interface that container ports should bind to. Use 0.0.0.0 to bind to all interfaces.", + "default": "127.0.0.1" + }, + "invoke_image": { + "title": "invoke_image", + "type": "string", + "description": "Container image URIs for invoking functions or starting api and function. One can specify the image URI used for the local function invocation (--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). One can also specify for each individual function with (--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). If a function does not have invoke image specified, the default AWS SAM CLI emulation image will be used." + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "local_start_api": { + "title": "Local Start Api command", + "description": "Run & test AWS serverless functions locally as a HTTP API.", + "properties": { + "parameters": { + "title": "Parameters for the local start api command", + "description": "Available parameters for the local start api command:\n* hook_name:\nHook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']\n* skip_prepare_infra:\nSkip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name.\n* host:\nLocal hostname or IP address to bind to (default: '127.0.0.1')\n* port:\nLocal port number to listen on (default: '3000')\n* static_dir:\nAny static assets (e.g. CSS/Javascript/HTML) files located in this directory will be presented at /\n* template_file:\nAWS SAM template which references built artifacts for resources in the template. (if applicable)\n* env_vars:\nJSON file containing values for Lambda function's environment variables.\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* debug_port:\nWhen specified, Lambda function container will start in debug mode and will expose this port on localhost.\n* debugger_path:\nHost path to a debugger that will be mounted into the Lambda container.\n* debug_args:\nAdditional arguments to be passed to the debugger.\n* container_env_vars:\nJSON file containing environment variables to be set within the container environment\n* docker_volume_basedir:\nSpecify the location basedir where the SAM template exists. If Docker is running on a remote machine, Path of the SAM template must be mounted on the Docker machine and modified to match the remote machine.\n* log_file:\nFile to capture output logs.\n* layer_cache_basedir:\nSpecify the location basedir where the lambda layers used by the template will be downloaded to.\n* skip_pull_image:\nSkip pulling down the latest Docker image for Lambda runtime.\n* docker_network:\nName or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network.\n* force_image_build:\nForce rebuilding the image used for invoking functions with layers.\n* warm_containers:\nOptional. Specifies how AWS SAM CLI manages \ncontainers for each function.\nTwo modes are available:\nEAGER: Containers for all functions are \nloaded at startup and persist between \ninvocations.\nLAZY: Containers are only loaded when each \nfunction is first invoked. Those containers \npersist for additional invocations.\n* debug_function:\nOptional. Specifies the Lambda Function logicalId to apply debug options to when --warm-containers is specified. This parameter applies to --debug-port, --debugger-path, and --debug-args.\n* shutdown:\nEmulate a shutdown event after invoke completes, to test extension handling of shutdown behavior.\n* container_host:\nHost of locally emulated Lambda container. This option is useful when the container runs on a different host than AWS SAM CLI. For example, if one wants to run AWS SAM CLI in a Docker container on macOS, this option could specify `host.docker.internal`\n* container_host_interface:\nIP address of the host network interface that container ports should bind to. Use 0.0.0.0 to bind to all interfaces.\n* invoke_image:\nContainer image URIs for invoking functions or starting api and function. One can specify the image URI used for the local function invocation (--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). One can also specify for each individual function with (--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). If a function does not have invoke image specified, the default AWS SAM CLI emulation image will be used.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "hook_name": { + "title": "hook_name", + "type": "string", + "description": "Hook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']" + }, + "skip_prepare_infra": { + "title": "skip_prepare_infra", + "type": "boolean", + "description": "Skip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name." + }, + "host": { + "title": "host", + "type": "string", + "description": "Local hostname or IP address to bind to (default: '127.0.0.1')", + "default": "127.0.0.1" + }, + "port": { + "title": "port", + "type": "integer", + "description": "Local port number to listen on (default: '3000')", + "default": 3000 + }, + "static_dir": { + "title": "static_dir", + "type": "string", + "description": "Any static assets (e.g. CSS/Javascript/HTML) files located in this directory will be presented at /", + "default": "public" + }, + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template which references built artifacts for resources in the template. (if applicable)", + "default": "template.[yaml|yml|json]" + }, + "env_vars": { + "title": "env_vars", + "type": "string", + "description": "JSON file containing values for Lambda function's environment variables." + }, + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "debug_port": { + "title": "debug_port", + "type": "integer", + "description": "When specified, Lambda function container will start in debug mode and will expose this port on localhost." + }, + "debugger_path": { + "title": "debugger_path", + "type": "string", + "description": "Host path to a debugger that will be mounted into the Lambda container." + }, + "debug_args": { + "title": "debug_args", + "type": "string", + "description": "Additional arguments to be passed to the debugger." + }, + "container_env_vars": { + "title": "container_env_vars", + "type": "string", + "description": "JSON file containing environment variables to be set within the container environment" + }, + "docker_volume_basedir": { + "title": "docker_volume_basedir", + "type": "string", + "description": "Specify the location basedir where the SAM template exists. If Docker is running on a remote machine, Path of the SAM template must be mounted on the Docker machine and modified to match the remote machine." + }, + "log_file": { + "title": "log_file", + "type": "string", + "description": "File to capture output logs." + }, + "layer_cache_basedir": { + "title": "layer_cache_basedir", + "type": "string", + "description": "Specify the location basedir where the lambda layers used by the template will be downloaded to." + }, + "skip_pull_image": { + "title": "skip_pull_image", + "type": "boolean", + "description": "Skip pulling down the latest Docker image for Lambda runtime." + }, + "docker_network": { + "title": "docker_network", + "type": "string", + "description": "Name or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network." + }, + "force_image_build": { + "title": "force_image_build", + "type": "boolean", + "description": "Force rebuilding the image used for invoking functions with layers." + }, + "warm_containers": { + "title": "warm_containers", + "type": "string", + "description": "Optional. Specifies how AWS SAM CLI manages \ncontainers for each function.\nTwo modes are available:\nEAGER: Containers for all functions are \nloaded at startup and persist between \ninvocations.\nLAZY: Containers are only loaded when each \nfunction is first invoked. Those containers \npersist for additional invocations.", + "enum": [ + "EAGER", + "LAZY" + ] + }, + "debug_function": { + "title": "debug_function", + "type": "string", + "description": "Optional. Specifies the Lambda Function logicalId to apply debug options to when --warm-containers is specified. This parameter applies to --debug-port, --debugger-path, and --debug-args." + }, + "shutdown": { + "title": "shutdown", + "type": "boolean", + "description": "Emulate a shutdown event after invoke completes, to test extension handling of shutdown behavior." + }, + "container_host": { + "title": "container_host", + "type": "string", + "description": "Host of locally emulated Lambda container. This option is useful when the container runs on a different host than AWS SAM CLI. For example, if one wants to run AWS SAM CLI in a Docker container on macOS, this option could specify `host.docker.internal`", + "default": "localhost" + }, + "container_host_interface": { + "title": "container_host_interface", + "type": "string", + "description": "IP address of the host network interface that container ports should bind to. Use 0.0.0.0 to bind to all interfaces.", + "default": "127.0.0.1" + }, + "invoke_image": { + "title": "invoke_image", + "type": "string", + "description": "Container image URIs for invoking functions or starting api and function. One can specify the image URI used for the local function invocation (--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). One can also specify for each individual function with (--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). If a function does not have invoke image specified, the default AWS SAM CLI emulation image will be used." + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "local_generate_event": { + "title": "Local Generate Event command", + "description": "Generate events for Lambda functions.", + "properties": { + "parameters": { + "title": "Parameters for the local generate event command", + "description": "Available parameters for the local generate event command:\n* ", + "type": "object", + "properties": {} + } + }, + "required": [ + "parameters" + ] + }, + "local_start_lambda": { + "title": "Local Start Lambda command", + "description": "Emulate AWS serverless functions locally.", + "properties": { + "parameters": { + "title": "Parameters for the local start lambda command", + "description": "Available parameters for the local start lambda command:\n* hook_name:\nHook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']\n* skip_prepare_infra:\nSkip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name.\n* host:\nLocal hostname or IP address to bind to (default: '127.0.0.1')\n* port:\nLocal port number to listen on (default: '3001')\n* template_file:\nAWS SAM template which references built artifacts for resources in the template. (if applicable)\n* env_vars:\nJSON file containing values for Lambda function's environment variables.\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* debug_port:\nWhen specified, Lambda function container will start in debug mode and will expose this port on localhost.\n* debugger_path:\nHost path to a debugger that will be mounted into the Lambda container.\n* debug_args:\nAdditional arguments to be passed to the debugger.\n* container_env_vars:\nJSON file containing environment variables to be set within the container environment\n* docker_volume_basedir:\nSpecify the location basedir where the SAM template exists. If Docker is running on a remote machine, Path of the SAM template must be mounted on the Docker machine and modified to match the remote machine.\n* log_file:\nFile to capture output logs.\n* layer_cache_basedir:\nSpecify the location basedir where the lambda layers used by the template will be downloaded to.\n* skip_pull_image:\nSkip pulling down the latest Docker image for Lambda runtime.\n* docker_network:\nName or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network.\n* force_image_build:\nForce rebuilding the image used for invoking functions with layers.\n* warm_containers:\nOptional. Specifies how AWS SAM CLI manages \ncontainers for each function.\nTwo modes are available:\nEAGER: Containers for all functions are \nloaded at startup and persist between \ninvocations.\nLAZY: Containers are only loaded when each \nfunction is first invoked. Those containers \npersist for additional invocations.\n* debug_function:\nOptional. Specifies the Lambda Function logicalId to apply debug options to when --warm-containers is specified. This parameter applies to --debug-port, --debugger-path, and --debug-args.\n* shutdown:\nEmulate a shutdown event after invoke completes, to test extension handling of shutdown behavior.\n* container_host:\nHost of locally emulated Lambda container. This option is useful when the container runs on a different host than AWS SAM CLI. For example, if one wants to run AWS SAM CLI in a Docker container on macOS, this option could specify `host.docker.internal`\n* container_host_interface:\nIP address of the host network interface that container ports should bind to. Use 0.0.0.0 to bind to all interfaces.\n* invoke_image:\nContainer image URIs for invoking functions or starting api and function. One can specify the image URI used for the local function invocation (--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). One can also specify for each individual function with (--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). If a function does not have invoke image specified, the default AWS SAM CLI emulation image will be used.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "hook_name": { + "title": "hook_name", + "type": "string", + "description": "Hook package id to extend AWS SAM CLI commands functionality. \n\nExample: `terraform` to extend AWS SAM CLI commands functionality to support terraform applications. \n\nAvailable Hook Names: ['terraform']" + }, + "skip_prepare_infra": { + "title": "skip_prepare_infra", + "type": "boolean", + "description": "Skip preparation stage when there are no infrastructure changes. Only used in conjunction with --hook-name." + }, + "host": { + "title": "host", + "type": "string", + "description": "Local hostname or IP address to bind to (default: '127.0.0.1')", + "default": "127.0.0.1" + }, + "port": { + "title": "port", + "type": "integer", + "description": "Local port number to listen on (default: '3001')", + "default": 3001 + }, + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template which references built artifacts for resources in the template. (if applicable)", + "default": "template.[yaml|yml|json]" + }, + "env_vars": { + "title": "env_vars", + "type": "string", + "description": "JSON file containing values for Lambda function's environment variables." + }, + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "debug_port": { + "title": "debug_port", + "type": "integer", + "description": "When specified, Lambda function container will start in debug mode and will expose this port on localhost." + }, + "debugger_path": { + "title": "debugger_path", + "type": "string", + "description": "Host path to a debugger that will be mounted into the Lambda container." + }, + "debug_args": { + "title": "debug_args", + "type": "string", + "description": "Additional arguments to be passed to the debugger." + }, + "container_env_vars": { + "title": "container_env_vars", + "type": "string", + "description": "JSON file containing environment variables to be set within the container environment" + }, + "docker_volume_basedir": { + "title": "docker_volume_basedir", + "type": "string", + "description": "Specify the location basedir where the SAM template exists. If Docker is running on a remote machine, Path of the SAM template must be mounted on the Docker machine and modified to match the remote machine." + }, + "log_file": { + "title": "log_file", + "type": "string", + "description": "File to capture output logs." + }, + "layer_cache_basedir": { + "title": "layer_cache_basedir", + "type": "string", + "description": "Specify the location basedir where the lambda layers used by the template will be downloaded to." + }, + "skip_pull_image": { + "title": "skip_pull_image", + "type": "boolean", + "description": "Skip pulling down the latest Docker image for Lambda runtime." + }, + "docker_network": { + "title": "docker_network", + "type": "string", + "description": "Name or ID of an existing docker network for AWS Lambda docker containers to connect to, along with the default bridge network. If not specified, the Lambda containers will only connect to the default bridge docker network." + }, + "force_image_build": { + "title": "force_image_build", + "type": "boolean", + "description": "Force rebuilding the image used for invoking functions with layers." + }, + "warm_containers": { + "title": "warm_containers", + "type": "string", + "description": "Optional. Specifies how AWS SAM CLI manages \ncontainers for each function.\nTwo modes are available:\nEAGER: Containers for all functions are \nloaded at startup and persist between \ninvocations.\nLAZY: Containers are only loaded when each \nfunction is first invoked. Those containers \npersist for additional invocations.", + "enum": [ + "EAGER", + "LAZY" + ] + }, + "debug_function": { + "title": "debug_function", + "type": "string", + "description": "Optional. Specifies the Lambda Function logicalId to apply debug options to when --warm-containers is specified. This parameter applies to --debug-port, --debugger-path, and --debug-args." + }, + "shutdown": { + "title": "shutdown", + "type": "boolean", + "description": "Emulate a shutdown event after invoke completes, to test extension handling of shutdown behavior." + }, + "container_host": { + "title": "container_host", + "type": "string", + "description": "Host of locally emulated Lambda container. This option is useful when the container runs on a different host than AWS SAM CLI. For example, if one wants to run AWS SAM CLI in a Docker container on macOS, this option could specify `host.docker.internal`", + "default": "localhost" + }, + "container_host_interface": { + "title": "container_host_interface", + "type": "string", + "description": "IP address of the host network interface that container ports should bind to. Use 0.0.0.0 to bind to all interfaces.", + "default": "127.0.0.1" + }, + "invoke_image": { + "title": "invoke_image", + "type": "string", + "description": "Container image URIs for invoking functions or starting api and function. One can specify the image URI used for the local function invocation (--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). One can also specify for each individual function with (--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). If a function does not have invoke image specified, the default AWS SAM CLI emulation image will be used." + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "package": { + "title": "Package command", + "description": "Package an AWS SAM application.", + "properties": { + "parameters": { + "title": "Parameters for the package command", + "description": "Available parameters for the package command:\n* template_file:\nAWS SAM template which references built artifacts for resources in the template. (if applicable)\n* output_template_file:\nThe path to the file where the command writes the output AWS CloudFormation template. If you don't specify a path, the command writes the template to the standard output.\n* s3_bucket:\nAWS S3 bucket where artifacts referenced in the template are uploaded.\n* image_repository:\nAWS ECR repository URI where artifacts referenced in the template are uploaded.\n* image_repositories:\nMapping of Function Logical ID to AWS ECR Repository URI.\n\nExample: Function_Logical_ID=ECR_Repo_Uri\nThis option can be specified multiple times.\n* s3_prefix:\nPrefix name that is added to the artifact's name when it is uploaded to the AWS S3 bucket.\n* kms_key_id:\nThe ID of an AWS KMS key that is used to encrypt artifacts that are at rest in the AWS S3 bucket.\n* use_json:\nIndicates whether to use JSON as the format for the output AWS CloudFormation template. YAML is used by default.\n* force_upload:\nIndicates whether to override existing files in the S3 bucket. Specify this flag to upload artifacts even if they match existing artifacts in the S3 bucket.\n* resolve_s3:\nAutomatically resolve AWS S3 bucket for non-guided deployments. Enabling this option will also create a managed default AWS S3 bucket for you. If one does not provide a --s3-bucket value, the managed bucket will be used. Do not use --guided with this option.\n* metadata:\nMap of metadata to attach to ALL the artifacts that are referenced in the template.\n* signing_profiles:\nA string that contains Code Sign configuration parameters as FunctionOrLayerNameToSign=SigningProfileName:SigningProfileOwner Since signing profile owner is optional, it could also be written as FunctionOrLayerNameToSign=SigningProfileName\n* no_progressbar:\nDoes not showcase a progress bar when uploading artifacts to S3 and pushing docker images to ECR\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template which references built artifacts for resources in the template. (if applicable)", + "default": "template.[yaml|yml|json]" + }, + "output_template_file": { + "title": "output_template_file", + "type": "string", + "description": "The path to the file where the command writes the output AWS CloudFormation template. If you don't specify a path, the command writes the template to the standard output." + }, + "s3_bucket": { + "title": "s3_bucket", + "type": "string", + "description": "AWS S3 bucket where artifacts referenced in the template are uploaded." + }, + "image_repository": { + "title": "image_repository", + "type": "string", + "description": "AWS ECR repository URI where artifacts referenced in the template are uploaded." + }, + "image_repositories": { + "title": "image_repositories", + "type": "array", + "description": "Mapping of Function Logical ID to AWS ECR Repository URI.\n\nExample: Function_Logical_ID=ECR_Repo_Uri\nThis option can be specified multiple times.", + "items": { + "type": "string" + } + }, + "s3_prefix": { + "title": "s3_prefix", + "type": "string", + "description": "Prefix name that is added to the artifact's name when it is uploaded to the AWS S3 bucket." + }, + "kms_key_id": { + "title": "kms_key_id", + "type": "string", + "description": "The ID of an AWS KMS key that is used to encrypt artifacts that are at rest in the AWS S3 bucket." + }, + "use_json": { + "title": "use_json", + "type": "boolean", + "description": "Indicates whether to use JSON as the format for the output AWS CloudFormation template. YAML is used by default." + }, + "force_upload": { + "title": "force_upload", + "type": "boolean", + "description": "Indicates whether to override existing files in the S3 bucket. Specify this flag to upload artifacts even if they match existing artifacts in the S3 bucket." + }, + "resolve_s3": { + "title": "resolve_s3", + "type": "boolean", + "description": "Automatically resolve AWS S3 bucket for non-guided deployments. Enabling this option will also create a managed default AWS S3 bucket for you. If one does not provide a --s3-bucket value, the managed bucket will be used. Do not use --guided with this option." + }, + "metadata": { + "title": "metadata", + "type": "string", + "description": "Map of metadata to attach to ALL the artifacts that are referenced in the template." + }, + "signing_profiles": { + "title": "signing_profiles", + "type": "string", + "description": "A string that contains Code Sign configuration parameters as FunctionOrLayerNameToSign=SigningProfileName:SigningProfileOwner Since signing profile owner is optional, it could also be written as FunctionOrLayerNameToSign=SigningProfileName" + }, + "no_progressbar": { + "title": "no_progressbar", + "type": "boolean", + "description": "Does not showcase a progress bar when uploading artifacts to S3 and pushing docker images to ECR" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "deploy": { + "title": "Deploy command", + "description": "The sam deploy command creates a Cloudformation Stack and deploys your resources.", + "properties": { + "parameters": { + "title": "Parameters for the deploy command", + "description": "Available parameters for the deploy command:\n* guided:\nSpecify this flag to allow SAM CLI to guide you through the deployment using guided prompts.\n* template_file:\nAWS SAM template which references built artifacts for resources in the template. (if applicable)\n* no_execute_changeset:\nIndicates whether to execute the change set. Specify this flag to view stack changes before executing the change set.\n* fail_on_empty_changeset:\nSpecify whether AWS SAM CLI should return a non-zero exit code if there are no changes to be made to the stack. Defaults to a non-zero exit code.\n* confirm_changeset:\nPrompt to confirm if the computed changeset is to be deployed by SAM CLI.\n* disable_rollback:\nPreserves the state of previously provisioned resources when an operation fails.\n* on_failure:\nProvide an action to determine what will happen when a stack fails to create. Three actions are available:\n\n- ROLLBACK: This will rollback a stack to a previous known good state.\n\n- DELETE: The stack will rollback to a previous state if one exists, otherwise the stack will be deleted.\n\n- DO_NOTHING: The stack will not rollback or delete, this is the same as disabling rollback.\n\nDefault behaviour is ROLLBACK.\n\n\n\nThis option is mutually exclusive with --disable-rollback/--no-disable-rollback. You can provide\n--on-failure or --disable-rollback/--no-disable-rollback but not both at the same time.\n* stack_name:\nName of the AWS CloudFormation stack.\n* s3_bucket:\nAWS S3 bucket where artifacts referenced in the template are uploaded.\n* image_repository:\nAWS ECR repository URI where artifacts referenced in the template are uploaded.\n* image_repositories:\nMapping of Function Logical ID to AWS ECR Repository URI.\n\nExample: Function_Logical_ID=ECR_Repo_Uri\nThis option can be specified multiple times.\n* force_upload:\nIndicates whether to override existing files in the S3 bucket. Specify this flag to upload artifacts even if they match existing artifacts in the S3 bucket.\n* s3_prefix:\nPrefix name that is added to the artifact's name when it is uploaded to the AWS S3 bucket.\n* kms_key_id:\nThe ID of an AWS KMS key that is used to encrypt artifacts that are at rest in the AWS S3 bucket.\n* role_arn:\nARN of an IAM role that AWS Cloudformation assumes when executing a deployment change set.\n* use_json:\nIndicates whether to use JSON as the format for the output AWS CloudFormation template. YAML is used by default.\n* resolve_s3:\nAutomatically resolve AWS S3 bucket for non-guided deployments. Enabling this option will also create a managed default AWS S3 bucket for you. If one does not provide a --s3-bucket value, the managed bucket will be used. Do not use --guided with this option.\n* resolve_image_repos:\nAutomatically create and delete ECR repositories for image-based functions in non-guided deployments. A companion stack containing ECR repos for each function will be deployed along with the template stack. Automatically created image repositories will be deleted if the corresponding functions are removed.\n* metadata:\nMap of metadata to attach to ALL the artifacts that are referenced in the template.\n* notification_arns:\nARNs of SNS topics that AWS Cloudformation associates with the stack.\n* tags:\nList of tags to associate with the stack.\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* signing_profiles:\nA string that contains Code Sign configuration parameters as FunctionOrLayerNameToSign=SigningProfileName:SigningProfileOwner Since signing profile owner is optional, it could also be written as FunctionOrLayerNameToSign=SigningProfileName\n* no_progressbar:\nDoes not showcase a progress bar when uploading artifacts to S3 and pushing docker images to ECR\n* capabilities:\nList of capabilities that one must specify before AWS Cloudformation can create certain stacks.\n\nAccepted Values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, CAPABILITY_RESOURCE_POLICY, CAPABILITY_AUTO_EXPAND.\n\nLearn more at: https://docs.aws.amazon.com/serverlessrepo/latest/devguide/acknowledging-application-capabilities.html\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "guided": { + "title": "guided", + "type": "boolean", + "description": "Specify this flag to allow SAM CLI to guide you through the deployment using guided prompts." + }, + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template which references built artifacts for resources in the template. (if applicable)", + "default": "template.[yaml|yml|json]" + }, + "no_execute_changeset": { + "title": "no_execute_changeset", + "type": "boolean", + "description": "Indicates whether to execute the change set. Specify this flag to view stack changes before executing the change set." + }, + "fail_on_empty_changeset": { + "title": "fail_on_empty_changeset", + "type": "boolean", + "description": "Specify whether AWS SAM CLI should return a non-zero exit code if there are no changes to be made to the stack. Defaults to a non-zero exit code.", + "default": true + }, + "confirm_changeset": { + "title": "confirm_changeset", + "type": "boolean", + "description": "Prompt to confirm if the computed changeset is to be deployed by SAM CLI." + }, + "disable_rollback": { + "title": "disable_rollback", + "type": "boolean", + "description": "Preserves the state of previously provisioned resources when an operation fails." + }, + "on_failure": { + "title": "on_failure", + "type": "string", + "description": "Provide an action to determine what will happen when a stack fails to create. Three actions are available:\n\n- ROLLBACK: This will rollback a stack to a previous known good state.\n\n- DELETE: The stack will rollback to a previous state if one exists, otherwise the stack will be deleted.\n\n- DO_NOTHING: The stack will not rollback or delete, this is the same as disabling rollback.\n\nDefault behaviour is ROLLBACK.\n\n\n\nThis option is mutually exclusive with --disable-rollback/--no-disable-rollback. You can provide\n--on-failure or --disable-rollback/--no-disable-rollback but not both at the same time.", + "default": "ROLLBACK", + "enum": [ + "DELETE", + "DO_NOTHING", + "ROLLBACK" + ] + }, + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "Name of the AWS CloudFormation stack." + }, + "s3_bucket": { + "title": "s3_bucket", + "type": "string", + "description": "AWS S3 bucket where artifacts referenced in the template are uploaded." + }, + "image_repository": { + "title": "image_repository", + "type": "string", + "description": "AWS ECR repository URI where artifacts referenced in the template are uploaded." + }, + "image_repositories": { + "title": "image_repositories", + "type": "array", + "description": "Mapping of Function Logical ID to AWS ECR Repository URI.\n\nExample: Function_Logical_ID=ECR_Repo_Uri\nThis option can be specified multiple times.", + "items": { + "type": "string" + } + }, + "force_upload": { + "title": "force_upload", + "type": "boolean", + "description": "Indicates whether to override existing files in the S3 bucket. Specify this flag to upload artifacts even if they match existing artifacts in the S3 bucket." + }, + "s3_prefix": { + "title": "s3_prefix", + "type": "string", + "description": "Prefix name that is added to the artifact's name when it is uploaded to the AWS S3 bucket." + }, + "kms_key_id": { + "title": "kms_key_id", + "type": "string", + "description": "The ID of an AWS KMS key that is used to encrypt artifacts that are at rest in the AWS S3 bucket." + }, + "role_arn": { + "title": "role_arn", + "type": "string", + "description": "ARN of an IAM role that AWS Cloudformation assumes when executing a deployment change set." + }, + "use_json": { + "title": "use_json", + "type": "boolean", + "description": "Indicates whether to use JSON as the format for the output AWS CloudFormation template. YAML is used by default." + }, + "resolve_s3": { + "title": "resolve_s3", + "type": "boolean", + "description": "Automatically resolve AWS S3 bucket for non-guided deployments. Enabling this option will also create a managed default AWS S3 bucket for you. If one does not provide a --s3-bucket value, the managed bucket will be used. Do not use --guided with this option." + }, + "resolve_image_repos": { + "title": "resolve_image_repos", + "type": "boolean", + "description": "Automatically create and delete ECR repositories for image-based functions in non-guided deployments. A companion stack containing ECR repos for each function will be deployed along with the template stack. Automatically created image repositories will be deleted if the corresponding functions are removed." + }, + "metadata": { + "title": "metadata", + "type": "string", + "description": "Map of metadata to attach to ALL the artifacts that are referenced in the template." + }, + "notification_arns": { + "title": "notification_arns", + "type": [ + "array", + "string" + ], + "description": "ARNs of SNS topics that AWS Cloudformation associates with the stack.", + "items": { + "type": "string" + } + }, + "tags": { + "title": "tags", + "type": "array", + "description": "List of tags to associate with the stack.", + "items": { + "type": "string" + } + }, + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "signing_profiles": { + "title": "signing_profiles", + "type": "string", + "description": "A string that contains Code Sign configuration parameters as FunctionOrLayerNameToSign=SigningProfileName:SigningProfileOwner Since signing profile owner is optional, it could also be written as FunctionOrLayerNameToSign=SigningProfileName" + }, + "no_progressbar": { + "title": "no_progressbar", + "type": "boolean", + "description": "Does not showcase a progress bar when uploading artifacts to S3 and pushing docker images to ECR" + }, + "capabilities": { + "title": "capabilities", + "type": [ + "array", + "string" + ], + "description": "List of capabilities that one must specify before AWS Cloudformation can create certain stacks.\n\nAccepted Values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, CAPABILITY_RESOURCE_POLICY, CAPABILITY_AUTO_EXPAND.\n\nLearn more at: https://docs.aws.amazon.com/serverlessrepo/latest/devguide/acknowledging-application-capabilities.html", + "items": { + "type": "string" + } + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "delete": { + "title": "Delete command", + "description": "The sam delete command deletes the CloudFormation\nstack and all the artifacts which were created using sam deploy.\n\n\ne.g. sam delete", + "properties": { + "parameters": { + "title": "Parameters for the delete command", + "description": "Available parameters for the delete command:\n* stack_name:\nThe name of the AWS CloudFormation stack you want to delete.\n* no_prompts:\nSpecify this flag to allow SAM CLI to skip through the guided prompts.\n* s3_bucket:\nThe S3 bucket path you want to delete.\n* s3_prefix:\nThe S3 prefix you want to delete\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "The name of the AWS CloudFormation stack you want to delete." + }, + "no_prompts": { + "title": "no_prompts", + "type": "boolean", + "description": "Specify this flag to allow SAM CLI to skip through the guided prompts." + }, + "s3_bucket": { + "title": "s3_bucket", + "type": "string", + "description": "The S3 bucket path you want to delete." + }, + "s3_prefix": { + "title": "s3_prefix", + "type": "string", + "description": "The S3 prefix you want to delete" + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "logs": { + "title": "Logs command", + "description": "The sam logs commands fetches logs of Lambda Functions/CloudWatch log groups\nwith additional filtering by options.", + "properties": { + "parameters": { + "title": "Parameters for the logs command", + "description": "Available parameters for the logs command:\n* name:\nThe name of the resource for which to fetch logs. If this resource is a part of an AWS CloudFormation stack, this can be the LogicalID of the resource in the CloudFormation/SAM template. Multiple names can be provided by repeating the parameter again. If resource is in a nested stack, name can be prepended by nested stack name to pull logs from that resource (NestedStackLogicalId/ResourceLogicalId). If it is not provided and no --cw-log-group have been given, it will scan given stack and find all supported resources, and start pulling log information from them.\n* stack_name:\nName of the AWS CloudFormation stack that the function is a part of.\n* filter:\nYou can specify an expression to quickly find logs that match terms, phrases or values in your log events. This could be a simple keyword (e.g. \"error\") or a pattern supported by AWS CloudWatch Logs. See the AWS CloudWatch Logs documentation for the syntax https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html\n* tail:\nTail events. This will ignore the end time argument and continue to fetch events as they become available. If option --tail is provided without a --name, one will be pulled from all possible resources\n* include_traces:\nInclude the XRay traces in the log output.\n* cw_log_group:\nAdditional CloudWatch Log group names that are not auto-discovered based upon --name parameter. When provided, it will only tail the given CloudWatch Log groups. If you want to tail log groups related to resources, please also provide their names as well\n* output:\nThe formatting style of the command output. Following options are available:\n\nTEXT: Prints information as regular text with some formatting (default option)\n\nJSON: Prints each line as JSON without formatting\n* end_time:\nFetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or formatted timestamp like '2018-01-01 10:10:10'\n* start_time:\nFetch events starting at this time. Time can be relative values like '5mins ago', 'yesterday' or formatted timestamp like '2018-01-01 10:10:10'. Defaults to '10mins ago'.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "name": { + "title": "name", + "type": "string", + "description": "The name of the resource for which to fetch logs. If this resource is a part of an AWS CloudFormation stack, this can be the LogicalID of the resource in the CloudFormation/SAM template. Multiple names can be provided by repeating the parameter again. If resource is in a nested stack, name can be prepended by nested stack name to pull logs from that resource (NestedStackLogicalId/ResourceLogicalId). If it is not provided and no --cw-log-group have been given, it will scan given stack and find all supported resources, and start pulling log information from them." + }, + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "Name of the AWS CloudFormation stack that the function is a part of." + }, + "filter": { + "title": "filter", + "type": "string", + "description": "You can specify an expression to quickly find logs that match terms, phrases or values in your log events. This could be a simple keyword (e.g. \"error\") or a pattern supported by AWS CloudWatch Logs. See the AWS CloudWatch Logs documentation for the syntax https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html" + }, + "tail": { + "title": "tail", + "type": "boolean", + "description": "Tail events. This will ignore the end time argument and continue to fetch events as they become available. If option --tail is provided without a --name, one will be pulled from all possible resources" + }, + "include_traces": { + "title": "include_traces", + "type": "boolean", + "description": "Include the XRay traces in the log output." + }, + "cw_log_group": { + "title": "cw_log_group", + "type": "string", + "description": "Additional CloudWatch Log group names that are not auto-discovered based upon --name parameter. When provided, it will only tail the given CloudWatch Log groups. If you want to tail log groups related to resources, please also provide their names as well" + }, + "output": { + "title": "output", + "type": "string", + "description": "The formatting style of the command output. Following options are available:\n\nTEXT: Prints information as regular text with some formatting (default option)\n\nJSON: Prints each line as JSON without formatting", + "enum": [ + "json", + "text" + ] + }, + "end_time": { + "title": "end_time", + "type": "string", + "description": "Fetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or formatted timestamp like '2018-01-01 10:10:10'" + }, + "start_time": { + "title": "start_time", + "type": "string", + "description": "Fetch events starting at this time. Time can be relative values like '5mins ago', 'yesterday' or formatted timestamp like '2018-01-01 10:10:10'. Defaults to '10mins ago'.", + "default": "10m ago" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "publish": { + "title": "Publish command", + "description": "Use this command to publish a packaged AWS SAM template to\nthe AWS Serverless Application Repository to share within your team,\nacross your organization, or with the community at large.\n\n\nThis command expects the template's Metadata section to contain an\nAWS::ServerlessRepo::Application section with application metadata\nfor publishing. For more details on this metadata section, see\nhttps://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-publishing-applications.html\n\nExamples\n--------\nTo publish an application\n$ sam publish -t packaged.yaml --region ", + "properties": { + "parameters": { + "title": "Parameters for the publish command", + "description": "Available parameters for the publish command:\n* template_file:\nAWS SAM template which references built artifacts for resources in the template. (if applicable)\n* semantic_version:\nOptional. The value provided here overrides SemanticVersion in the template metadata.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template which references built artifacts for resources in the template. (if applicable)", + "default": "template.[yaml|yml|json]" + }, + "semantic_version": { + "title": "semantic_version", + "type": "string", + "description": "Optional. The value provided here overrides SemanticVersion in the template metadata." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "traces": { + "title": "Traces command", + "description": "Use this command to fetch AWS X-Ray traces generated by your stack.\n\n\nRun the following command to fetch X-Ray traces by ID.\n$ sam traces --trace-id tracing-id-1 --trace-id tracing-id-2\n\nRun the following command to tail X-Ray traces as they become available.\n$ sam traces --tail", + "properties": { + "parameters": { + "title": "Parameters for the traces command", + "description": "Available parameters for the traces command:\n* trace_id:\nFetch specific trace by providing its id\n* tail:\nTail events. This will ignore the end time argument and continue to fetch events as they become available.\n* output:\nThe formatting style of the command output. Following options are available:\n\nTEXT: Prints information as regular text with some formatting (default option)\n\nJSON: Prints each line as JSON without formatting\n* end_time:\nFetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or formatted timestamp like '2018-01-01 10:10:10'\n* start_time:\nFetch events starting at this time. Time can be relative values like '5mins ago', 'yesterday' or formatted timestamp like '2018-01-01 10:10:10'. Defaults to '10mins ago'.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "trace_id": { + "title": "trace_id", + "type": "string", + "description": "Fetch specific trace by providing its id" + }, + "tail": { + "title": "tail", + "type": "boolean", + "description": "Tail events. This will ignore the end time argument and continue to fetch events as they become available." + }, + "output": { + "title": "output", + "type": "string", + "description": "The formatting style of the command output. Following options are available:\n\nTEXT: Prints information as regular text with some formatting (default option)\n\nJSON: Prints each line as JSON without formatting", + "enum": [ + "json", + "text" + ] + }, + "end_time": { + "title": "end_time", + "type": "string", + "description": "Fetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or formatted timestamp like '2018-01-01 10:10:10'" + }, + "start_time": { + "title": "start_time", + "type": "string", + "description": "Fetch events starting at this time. Time can be relative values like '5mins ago', 'yesterday' or formatted timestamp like '2018-01-01 10:10:10'. Defaults to '10mins ago'.", + "default": "10m ago" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "sync": { + "title": "Sync command", + "description": "NEW! Sync an AWS SAM Project to AWS.", + "properties": { + "parameters": { + "title": "Parameters for the sync command", + "description": "Available parameters for the sync command:\n* template_file:\nAWS SAM template file.\n* code:\nSync ONLY code resources. This includes Lambda Functions, API Gateway, and Step Functions.\n* watch:\nWatch local files and automatically sync with cloud.\n* resource_id:\nSync code for all the resources with the ID. To sync a resource within a nested stack, use the following pattern {ChildStack}/{logicalId}.\n* resource:\nSync code for all resources of the given resource type. Accepted values are ['AWS::Serverless::Function', 'AWS::Lambda::Function', 'AWS::Serverless::LayerVersion', 'AWS::Lambda::LayerVersion', 'AWS::Serverless::Api', 'AWS::ApiGateway::RestApi', 'AWS::Serverless::HttpApi', 'AWS::ApiGatewayV2::Api', 'AWS::Serverless::StateMachine', 'AWS::StepFunctions::StateMachine']\n* dependency_layer:\nSeparate dependencies of individual function into a Lambda layer for improved performance.\n* skip_deploy_sync:\nThis option will skip the initial infrastructure deployment if it is not required by comparing the local template with the template deployed in cloud.\n* stack_name:\nName of the AWS CloudFormation stack.\n* base_dir:\nResolve relative paths to function's source code with respect to this directory. Use this if SAM template and source code are not in same enclosing folder. By default, relative paths are resolved with respect to the SAM template's location.\n* use_container:\nBuild functions within an AWS Lambda-like container.\n* build_image:\nContainer image URIs for building functions/layers. You can specify for all functions/layers with just the image URI (--build-image public.ecr.aws/sam/build-nodejs18.x:latest). You can specify for each individual function with (--build-image FunctionLogicalID=public.ecr.aws/sam/build-nodejs18.x:latest). A combination of the two can be used. If a function does not have build image specified or an image URI for all functions, the default SAM CLI build images will be used.\n* image_repository:\nAWS ECR repository URI where artifacts referenced in the template are uploaded.\n* image_repositories:\nMapping of Function Logical ID to AWS ECR Repository URI.\n\nExample: Function_Logical_ID=ECR_Repo_Uri\nThis option can be specified multiple times.\n* s3_bucket:\nAWS S3 bucket where artifacts referenced in the template are uploaded.\n* s3_prefix:\nPrefix name that is added to the artifact's name when it is uploaded to the AWS S3 bucket.\n* kms_key_id:\nThe ID of an AWS KMS key that is used to encrypt artifacts that are at rest in the AWS S3 bucket.\n* role_arn:\nARN of an IAM role that AWS Cloudformation assumes when executing a deployment change set.\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* metadata:\nMap of metadata to attach to ALL the artifacts that are referenced in the template.\n* notification_arns:\nARNs of SNS topics that AWS Cloudformation associates with the stack.\n* tags:\nList of tags to associate with the stack.\n* capabilities:\nList of capabilities that one must specify before AWS Cloudformation can create certain stacks.\n\nAccepted Values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, CAPABILITY_RESOURCE_POLICY, CAPABILITY_AUTO_EXPAND.\n\nLearn more at: https://docs.aws.amazon.com/serverlessrepo/latest/devguide/acknowledging-application-capabilities.html", + "type": "object", + "properties": { + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template file.", + "default": "template.[yaml|yml|json]" + }, + "code": { + "title": "code", + "type": "boolean", + "description": "Sync ONLY code resources. This includes Lambda Functions, API Gateway, and Step Functions." + }, + "watch": { + "title": "watch", + "type": "boolean", + "description": "Watch local files and automatically sync with cloud." + }, + "resource_id": { + "title": "resource_id", + "type": "string", + "description": "Sync code for all the resources with the ID. To sync a resource within a nested stack, use the following pattern {ChildStack}/{logicalId}." + }, + "resource": { + "title": "resource", + "type": "string", + "description": "Sync code for all resources of the given resource type. Accepted values are ['AWS::Serverless::Function', 'AWS::Lambda::Function', 'AWS::Serverless::LayerVersion', 'AWS::Lambda::LayerVersion', 'AWS::Serverless::Api', 'AWS::ApiGateway::RestApi', 'AWS::Serverless::HttpApi', 'AWS::ApiGatewayV2::Api', 'AWS::Serverless::StateMachine', 'AWS::StepFunctions::StateMachine']", + "enum": [ + "AWS::ApiGateway::RestApi", + "AWS::ApiGatewayV2::Api", + "AWS::Lambda::Function", + "AWS::Lambda::LayerVersion", + "AWS::Serverless::Api", + "AWS::Serverless::Function", + "AWS::Serverless::HttpApi", + "AWS::Serverless::LayerVersion", + "AWS::Serverless::StateMachine", + "AWS::StepFunctions::StateMachine" + ] + }, + "dependency_layer": { + "title": "dependency_layer", + "type": "boolean", + "description": "Separate dependencies of individual function into a Lambda layer for improved performance.", + "default": true + }, + "skip_deploy_sync": { + "title": "skip_deploy_sync", + "type": "boolean", + "description": "This option will skip the initial infrastructure deployment if it is not required by comparing the local template with the template deployed in cloud.", + "default": true + }, + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "Name of the AWS CloudFormation stack." + }, + "base_dir": { + "title": "base_dir", + "type": "string", + "description": "Resolve relative paths to function's source code with respect to this directory. Use this if SAM template and source code are not in same enclosing folder. By default, relative paths are resolved with respect to the SAM template's location." + }, + "use_container": { + "title": "use_container", + "type": "boolean", + "description": "Build functions within an AWS Lambda-like container." + }, + "build_image": { + "title": "build_image", + "type": "string", + "description": "Container image URIs for building functions/layers. You can specify for all functions/layers with just the image URI (--build-image public.ecr.aws/sam/build-nodejs18.x:latest). You can specify for each individual function with (--build-image FunctionLogicalID=public.ecr.aws/sam/build-nodejs18.x:latest). A combination of the two can be used. If a function does not have build image specified or an image URI for all functions, the default SAM CLI build images will be used." + }, + "image_repository": { + "title": "image_repository", + "type": "string", + "description": "AWS ECR repository URI where artifacts referenced in the template are uploaded." + }, + "image_repositories": { + "title": "image_repositories", + "type": "array", + "description": "Mapping of Function Logical ID to AWS ECR Repository URI.\n\nExample: Function_Logical_ID=ECR_Repo_Uri\nThis option can be specified multiple times.", + "items": { + "type": "string" + } + }, + "s3_bucket": { + "title": "s3_bucket", + "type": "string", + "description": "AWS S3 bucket where artifacts referenced in the template are uploaded." + }, + "s3_prefix": { + "title": "s3_prefix", + "type": "string", + "description": "Prefix name that is added to the artifact's name when it is uploaded to the AWS S3 bucket." + }, + "kms_key_id": { + "title": "kms_key_id", + "type": "string", + "description": "The ID of an AWS KMS key that is used to encrypt artifacts that are at rest in the AWS S3 bucket." + }, + "role_arn": { + "title": "role_arn", + "type": "string", + "description": "ARN of an IAM role that AWS Cloudformation assumes when executing a deployment change set." + }, + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "metadata": { + "title": "metadata", + "type": "string", + "description": "Map of metadata to attach to ALL the artifacts that are referenced in the template." + }, + "notification_arns": { + "title": "notification_arns", + "type": [ + "array", + "string" + ], + "description": "ARNs of SNS topics that AWS Cloudformation associates with the stack.", + "items": { + "type": "string" + } + }, + "tags": { + "title": "tags", + "type": "array", + "description": "List of tags to associate with the stack.", + "items": { + "type": "string" + } + }, + "capabilities": { + "title": "capabilities", + "type": [ + "array", + "string" + ], + "description": "List of capabilities that one must specify before AWS Cloudformation can create certain stacks.\n\nAccepted Values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, CAPABILITY_RESOURCE_POLICY, CAPABILITY_AUTO_EXPAND.\n\nLearn more at: https://docs.aws.amazon.com/serverlessrepo/latest/devguide/acknowledging-application-capabilities.html", + "default": [ + "CAPABILITY_NAMED_IAM", + "CAPABILITY_AUTO_EXPAND" + ], + "items": { + "type": "string" + } + } + } + } + }, + "required": [ + "parameters" + ] + }, + "pipeline_bootstrap": { + "title": "Pipeline Bootstrap command", + "description": "This command generates the required AWS infrastructure resources to connect to your CI/CD system.\nThis step must be run for each deployment stage in your pipeline, prior to running the sam pipeline init command.", + "properties": { + "parameters": { + "title": "Parameters for the pipeline bootstrap command", + "description": "Available parameters for the pipeline bootstrap command:\n* interactive:\nDisable interactive prompting for bootstrap parameters, and fail if any required arguments are missing.\n* stage:\nThe name of the corresponding deployment stage. It is used as a suffix for the created AWS infrastructure resources.\n* pipeline_user:\nThe Amazon Resource Name (ARN) of the IAM user having its access key ID and secret access key shared with the CI/CD system. It is used to grant this IAM user permission to access the corresponding AWS account. If not provided, the command will create one along with the access key ID and secret access key credentials.\n* pipeline_execution_role:\nThe ARN of the IAM role to be assumed by the pipeline user to operate on this stage. Provide it only if you want to use your own role, otherwise this command will create one.\n* cloudformation_execution_role:\nThe ARN of the IAM role to be assumed by the AWS CloudFormation service while deploying the application's stack. Provide only if you want to use your own role, otherwise the command will create one.\n* bucket:\nThe ARN of the Amazon S3 bucket to hold the AWS SAM artifacts.\n* create_image_repository:\nIf set to true and no ECR image repository is provided, this command will create an ECR image repository to hold the container images of Lambda functions having an Image package type.\n* image_repository:\nThe ARN of an Amazon ECR image repository to hold the container images of Lambda functions or layers that have a package type of Image. If provided, the --create-image-repository options is ignored. If not provided and --create-image-repository is specified, the command will create one.\n* confirm_changeset:\nPrompt to confirm if the resources are to be deployed.\n* permissions_provider:\nChoose a permissions provider to assume the pipeline execution role. Default is to use an IAM User.\n* oidc_provider_url:\nThe URL of the OIDC provider.\n* oidc_client_id:\nThe client ID configured to use with the OIDC provider.\n* github_org:\nThe GitHub organization that the repository belongs to. If there is no organization enter the Username of the repository owner instead Only used if using GitHub Actions OIDC for user permissions\n* github_repo:\nThe name of the GitHub Repository that deployments will occur from. Only used if using GitHub Actions OIDC for permissions\n* deployment_branch:\nThe name of the branch that deployments will occur from. Only used if using GitHub Actions OIDC for permissions\n* oidc_provider:\nThe name of the CI/CD system that will be used for OIDC permissions Currently supported CI/CD systems are : GitLab, GitHub and Bitbucket\n* gitlab_group:\nThe GitLab group that the repository belongs to. Only used if using GitLab OIDC for permissions\n* gitlab_project:\nThe GitLab project name. Only used if using GitLab OIDC for permissions\n* bitbucket_repo_uuid:\nThe UUID of the Bitbucket repository. Only used if using Bitbucket OIDC for permissions. Found at https://bitbucket.org///admin/addon/admin/pipelines/openid-connect\n* cicd_provider:\nThe CICD platform for the SAM Pipeline\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "interactive": { + "title": "interactive", + "type": "boolean", + "description": "Disable interactive prompting for bootstrap parameters, and fail if any required arguments are missing.", + "default": true + }, + "stage": { + "title": "stage", + "type": "string", + "description": "The name of the corresponding deployment stage. It is used as a suffix for the created AWS infrastructure resources." + }, + "pipeline_user": { + "title": "pipeline_user", + "type": "string", + "description": "The Amazon Resource Name (ARN) of the IAM user having its access key ID and secret access key shared with the CI/CD system. It is used to grant this IAM user permission to access the corresponding AWS account. If not provided, the command will create one along with the access key ID and secret access key credentials." + }, + "pipeline_execution_role": { + "title": "pipeline_execution_role", + "type": "string", + "description": "The ARN of the IAM role to be assumed by the pipeline user to operate on this stage. Provide it only if you want to use your own role, otherwise this command will create one." + }, + "cloudformation_execution_role": { + "title": "cloudformation_execution_role", + "type": "string", + "description": "The ARN of the IAM role to be assumed by the AWS CloudFormation service while deploying the application's stack. Provide only if you want to use your own role, otherwise the command will create one." + }, + "bucket": { + "title": "bucket", + "type": "string", + "description": "The ARN of the Amazon S3 bucket to hold the AWS SAM artifacts." + }, + "create_image_repository": { + "title": "create_image_repository", + "type": "boolean", + "description": "If set to true and no ECR image repository is provided, this command will create an ECR image repository to hold the container images of Lambda functions having an Image package type." + }, + "image_repository": { + "title": "image_repository", + "type": "string", + "description": "The ARN of an Amazon ECR image repository to hold the container images of Lambda functions or layers that have a package type of Image. If provided, the --create-image-repository options is ignored. If not provided and --create-image-repository is specified, the command will create one." + }, + "confirm_changeset": { + "title": "confirm_changeset", + "type": "boolean", + "description": "Prompt to confirm if the resources are to be deployed.", + "default": true + }, + "permissions_provider": { + "title": "permissions_provider", + "type": "string", + "description": "Choose a permissions provider to assume the pipeline execution role. Default is to use an IAM User.", + "default": "iam", + "enum": [ + "iam", + "oidc" + ] + }, + "oidc_provider_url": { + "title": "oidc_provider_url", + "type": "string", + "description": "The URL of the OIDC provider." + }, + "oidc_client_id": { + "title": "oidc_client_id", + "type": "string", + "description": "The client ID configured to use with the OIDC provider." + }, + "github_org": { + "title": "github_org", + "type": "string", + "description": "The GitHub organization that the repository belongs to. If there is no organization enter the Username of the repository owner instead Only used if using GitHub Actions OIDC for user permissions" + }, + "github_repo": { + "title": "github_repo", + "type": "string", + "description": "The name of the GitHub Repository that deployments will occur from. Only used if using GitHub Actions OIDC for permissions" + }, + "deployment_branch": { + "title": "deployment_branch", + "type": "string", + "description": "The name of the branch that deployments will occur from. Only used if using GitHub Actions OIDC for permissions" + }, + "oidc_provider": { + "title": "oidc_provider", + "type": "string", + "description": "The name of the CI/CD system that will be used for OIDC permissions Currently supported CI/CD systems are : GitLab, GitHub and Bitbucket", + "enum": [ + "bitbucket-pipelines", + "github-actions", + "gitlab" + ] + }, + "gitlab_group": { + "title": "gitlab_group", + "type": "string", + "description": "The GitLab group that the repository belongs to. Only used if using GitLab OIDC for permissions" + }, + "gitlab_project": { + "title": "gitlab_project", + "type": "string", + "description": "The GitLab project name. Only used if using GitLab OIDC for permissions" + }, + "bitbucket_repo_uuid": { + "title": "bitbucket_repo_uuid", + "type": "string", + "description": "The UUID of the Bitbucket repository. Only used if using Bitbucket OIDC for permissions. Found at https://bitbucket.org///admin/addon/admin/pipelines/openid-connect" + }, + "cicd_provider": { + "title": "cicd_provider", + "type": "string", + "description": "The CICD platform for the SAM Pipeline" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + }, + "pipeline_init": { + "title": "Pipeline Init command", + "description": "This command generates a pipeline configuration file that your CI/CD system can use to deploy\nserverless applications using AWS SAM.\n\nBefore using sam pipeline init, you must bootstrap the necessary resources for each stage in your pipeline.\nYou can do this by running sam pipeline init --bootstrap to be guided through the setup and configuration\nfile generation process, or refer to resources you have previously created with the sam pipeline bootstrap command.", + "properties": { + "parameters": { + "title": "Parameters for the pipeline init command", + "description": "Available parameters for the pipeline init command:\n* bootstrap:\nEnable interactive mode that walks the user through creating necessary AWS infrastructure resources.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "bootstrap": { + "title": "bootstrap", + "type": "boolean", + "description": "Enable interactive mode that walks the user through creating necessary AWS infrastructure resources." + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "list_resources": { + "title": "List Resources command", + "description": "Get a list of resources that will be deployed to CloudFormation.\n\nIf a stack name is provided, the corresponding physical IDs of each\nresource will be mapped to the logical ID of each resource.", + "properties": { + "parameters": { + "title": "Parameters for the list resources command", + "description": "Available parameters for the list resources command:\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* stack_name:\nName of corresponding deployed stack.(Not including a stack name will only show local resources defined in the template.)\n* output:\nOutput the results from the command in a given output format (json or table).\n* template_file:\nAWS SAM template file.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "Name of corresponding deployed stack.(Not including a stack name will only show local resources defined in the template.)" + }, + "output": { + "title": "output", + "type": "string", + "description": "Output the results from the command in a given output format (json or table).", + "default": "table", + "enum": [ + "json", + "table" + ] + }, + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template file.", + "default": "template.[yaml|yml|json]" + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "list_stack_outputs": { + "title": "List Stack Outputs command", + "description": "Get the stack outputs as defined in the SAM/CloudFormation template.", + "properties": { + "parameters": { + "title": "Parameters for the list stack outputs command", + "description": "Available parameters for the list stack outputs command:\n* stack_name:\nName of corresponding deployed stack.\n* output:\nOutput the results from the command in a given output format (json or table).\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "Name of corresponding deployed stack." + }, + "output": { + "title": "output", + "type": "string", + "description": "Output the results from the command in a given output format (json or table).", + "default": "table", + "enum": [ + "json", + "table" + ] + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "list_endpoints": { + "title": "List Endpoints command", + "description": "Get a summary of the cloud endpoints in the stack.\n\nThis command will show both the cloud and local endpoints that can\nbe used with sam local and sam sync. Currently the endpoint resources\nare Lambda functions and API Gateway API resources.", + "properties": { + "parameters": { + "title": "Parameters for the list endpoints command", + "description": "Available parameters for the list endpoints command:\n* parameter_overrides:\nString that contains AWS CloudFormation parameter overrides encoded as key=value pairs.\n* stack_name:\nName of corresponding deployed stack.(Not including a stack name will only show local resources defined in the template.)\n* output:\nOutput the results from the command in a given output format (json or table).\n* template_file:\nAWS SAM template file.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", + "type": "object", + "properties": { + "parameter_overrides": { + "title": "parameter_overrides", + "type": [ + "array", + "string" + ], + "description": "String that contains AWS CloudFormation parameter overrides encoded as key=value pairs.", + "items": { + "type": "string" + } + }, + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "Name of corresponding deployed stack.(Not including a stack name will only show local resources defined in the template.)" + }, + "output": { + "title": "output", + "type": "string", + "description": "Output the results from the command in a given output format (json or table).", + "default": "table", + "enum": [ + "json", + "table" + ] + }, + "template_file": { + "title": "template_file", + "type": "string", + "description": "AWS SAM template file.", + "default": "template.[yaml|yml|json]" + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } + } + }, + "required": [ + "parameters" + ] + }, + "docs": { + "title": "Docs command", + "description": "NEW! Open the documentation in a browser.", + "properties": { + "parameters": { + "title": "Parameters for the docs command", + "description": "Available parameters for the docs command:\n* ", + "type": "object", + "properties": {} + } + }, + "required": [ + "parameters" + ] + }, + "remote_invoke": { + "title": "Remote Invoke command", + "description": "Invoke or send an event to resources in the cloud.", + "properties": { + "parameters": { + "title": "Parameters for the remote invoke command", + "description": "Available parameters for the remote invoke command:\n* stack_name:\nName of the stack to get the resource information from\n* event:\nThe event that will be sent to the resource. The target parameter will depend on the resource type. For instance: 'Payload' for Lambda which can be passed as a JSON string\n* event_file:\nThe file that contains the event that will be sent to the resource.\n* output:\nOutput the results from the command in a given output format. The text format prints a readable AWS API response. The json format prints the full AWS API response.\n* parameter:\nAdditional parameters that can be passed to invoke the resource.\nThe following additional parameters can be used to invoke a lambda resource and get a buffered response: InvocationType='Event'|'RequestResponse'|'DryRun', LogType='None'|'Tail', ClientContext='base64-encoded string' Qualifier='string'. The following additional parameters can be used to invoke a lambda resource with response streaming: InvocationType='RequestResponse'|'DryRun', LogType='None'|'Tail', ClientContext='base64-encoded string', Qualifier='string'.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", + "type": "object", + "properties": { + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "Name of the stack to get the resource information from" + }, + "event": { + "title": "event", + "type": "string", + "description": "The event that will be sent to the resource. The target parameter will depend on the resource type. For instance: 'Payload' for Lambda which can be passed as a JSON string" + }, + "event_file": { + "title": "event_file", + "type": "string", + "description": "The file that contains the event that will be sent to the resource." + }, + "output": { + "title": "output", + "type": "string", + "description": "Output the results from the command in a given output format. The text format prints a readable AWS API response. The json format prints the full AWS API response.", + "default": "text", + "enum": [ + "json", + "text" + ] + }, + "parameter": { + "title": "parameter", + "type": "array", + "description": "Additional parameters that can be passed to invoke the resource.\nThe following additional parameters can be used to invoke a lambda resource and get a buffered response: InvocationType='Event'|'RequestResponse'|'DryRun', LogType='None'|'Tail', ClientContext='base64-encoded string' Qualifier='string'. The following additional parameters can be used to invoke a lambda resource with response streaming: InvocationType='RequestResponse'|'DryRun', LogType='None'|'Tail', ClientContext='base64-encoded string', Qualifier='string'.", + "items": { + "type": "string" + } + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } + } + }, + "required": [ + "parameters" + ] + } + } + } + } +} \ No newline at end of file diff --git a/tests/unit/commands/traces/test_command.py b/tests/unit/commands/traces/test_command.py index 59bc6185b4..3b70cf3e62 100644 --- a/tests/unit/commands/traces/test_command.py +++ b/tests/unit/commands/traces/test_command.py @@ -50,7 +50,7 @@ def test_traces_command( given_puller = Mock() patched_generate_puller.return_value = given_puller - do_cli(trace_ids, start_time, end_time, tail, output, self.region) + do_cli(trace_ids, tail, start_time, end_time, output, self.region) patched_parse_time.assert_has_calls( [ diff --git a/tests/unit/schema/test_schema_logic.py b/tests/unit/schema/test_schema_logic.py new file mode 100644 index 0000000000..4e618c86bf --- /dev/null +++ b/tests/unit/schema/test_schema_logic.py @@ -0,0 +1,246 @@ +from typing import List +from unittest.mock import MagicMock, patch +from parameterized import parameterized +from unittest import TestCase +from schema.exceptions import SchemaGenerationException + +from schema.make_schema import ( + SamCliCommandSchema, + SamCliParameterSchema, + SchemaKeys, + format_param, + generate_schema, + get_params_from_command, + retrieve_command_structure, +) + + +class TestParameterSchema(TestCase): + @parameterized.expand( + [ + ("", "", {}), + ("default", "default value", {"default": "default value"}), + ("items", "item type", {"items": {"type": "item type"}}), + ("choices", ["1", "2"], {"enum": ["1", "2"]}), + ] + ) + def test_parameter_to_schema(self, property_name, property_value, added_property_field): + param = SamCliParameterSchema("param name", "param type", "param description") + param.__setattr__(property_name, property_value) + + param_schema = param.to_schema() + + expected_schema = {"title": "param name", "type": "param type", "description": "param description"} + expected_schema.update(added_property_field) + self.assertEqual(expected_schema, param_schema) + + def test_parameter_to_schema_with_multiple_type(self): + param = SamCliParameterSchema("param name", ["type1", "type2"], "param description") + + param_schema = param.to_schema() + + expected_schema = {"title": "param name", "type": ["type1", "type2"], "description": "param description"} + self.assertEqual(expected_schema, param_schema) + + +class TestCommandSchema(TestCase): + def test_command_to_schema(self): + params = [SamCliParameterSchema("param1", "string"), SamCliParameterSchema("param2", "number")] + command = SamCliCommandSchema("commandname", "command description", params) + + command_schema = command.to_schema() + + self.assertEqual(len(command_schema.keys()), 1) + self.assertEqual(list(command_schema.keys())[0], "commandname") + inner_schema = command_schema["commandname"] + self._validate_schema_keys(inner_schema) + self._validate_schema_parameters_keys(inner_schema) + self._validate_schema_parameters_exist_correctly(inner_schema, params) + self.assertEqual(["parameters"], inner_schema["required"], "Parameters attribute should be required") + + def _validate_schema_keys(self, schema): + for expected_key in ["title", "description", "properties", "required"]: + self.assertIn(expected_key, schema.keys(), f"Command schema should have key {expected_key}") + self.assertIn("parameters", schema["properties"].keys(), "Schema should have 'parameters'") + + def _validate_schema_parameters_keys(self, schema): + for expected_key in ["title", "description", "type", "properties"]: + self.assertIn( + expected_key, + schema["properties"]["parameters"], + f"Parameters schema should have key {expected_key}", + ) + + def _validate_schema_parameters_exist_correctly(self, schema, expected_params): + for param in expected_params: + self.assertIn( + param.name, schema["properties"]["parameters"]["properties"], f"{param.name} should be in schema" + ) + self.assertEqual( + param.to_schema(), + schema["properties"]["parameters"]["properties"].get(param.name), + f"{param.name} should point to schema representation", + ) + + +class TestSchemaLogic(TestCase): + @parameterized.expand( + [ + ("string", "string"), + ("integer", "integer"), + ("number", "number"), + ("text", "string"), + ("path", "string"), + ("choice", "string"), + ("filename", "string"), + ("directory", "string"), + ("LIST", "array"), + ("type1,type2", ["type1", "type2"]), + ("list,type1", ["array", "type1"]), + ("string,path,choice,filename,directory", "string"), + ] + ) + def test_param_formatted_correctly(self, param_type, expected_type): + mock_param = MagicMock() + mock_param.name = "param_name" + mock_param.type.name = param_type + mock_param.help = "param description" + mock_param.default = None + + formatted_param = format_param(mock_param) + + self.assertIsInstance(formatted_param, SamCliParameterSchema) + self.assertEqual(formatted_param.name, "param_name") + self.assertEqual(formatted_param.type, expected_type) + self.assertEqual(formatted_param.description, "param description") + self.assertEqual(formatted_param.default, None) + + def test_param_formatted_throws_error_when_none(self): + mock_param = MagicMock() + mock_param.type.name = None + + with self.assertRaises(SchemaGenerationException): + format_param(None) + + with self.assertRaises(SchemaGenerationException): + format_param(mock_param) + + @parameterized.expand( + [ + ("list", SamCliParameterSchema("p_name", "array", default="default value", items="string")), + ("choice", SamCliParameterSchema("p_name", "string", default=["default", "value"], choices=["1", "2"])), + ] + ) + @patch("schema.make_schema.isinstance") + def test_param_formatted_given_type(self, param_type, expected_param, isinstance_mock): + mock_param = MagicMock() + mock_param.name = "p_name" + mock_param.type.name = param_type + mock_param.type.choices = ["1", "2"] + mock_param.help = None + mock_param.default = ("default", "value") if param_type == "choice" else "default value" + isinstance_mock.return_value = True if param_type == "choice" else False # mock check against click.Choice + + formatted_param = format_param(mock_param) + + self.assertEqual(expected_param, formatted_param) + + @patch("schema.make_schema.isinstance") + @patch("schema.make_schema.format_param") + def test_getting_params_from_cli_object(self, format_param_mock, isinstance_mock): + mock_cli = MagicMock() + mock_cli.params = [] + param_names = ["param1", "param2", "config_file", None] + for param_name in param_names: + mock_param = MagicMock() + mock_param.name = param_name + mock_cli.params.append(mock_param) + format_param_mock.side_effect = lambda x: x.name + + params = get_params_from_command(mock_cli) + + self.assertIn("param1", params) + self.assertIn("param2", params) + self.assertNotIn("config_file", params) + self.assertNotIn(None, params) + + @patch("schema.make_schema.importlib.import_module") + @patch("schema.make_schema.get_params_from_command") + def test_command_structure_is_retrieved(self, get_params_mock, import_mock): + mock_module = self._setup_mock_module() + import_mock.side_effect = lambda _: mock_module + get_params_mock.return_value = [] + + commands = retrieve_command_structure("") + + self._validate_retrieved_command_structure(commands) + + @patch("schema.make_schema.importlib.import_module") + @patch("schema.make_schema.get_params_from_command") + @patch("schema.make_schema.isinstance") + def test_command_structure_is_retrieved_from_group_cli(self, isinstance_mock, get_params_mock, import_mock): + mock_module = self._setup_mock_module() + mock_module.cli.commands = {} + for i in range(2): + mock_subcommand = MagicMock() + mock_subcommand.name = f"subcommand{i}" + mock_subcommand.help = "help text" + mock_module.cli.commands.update({f"subcommand{i}": mock_subcommand}) + import_mock.side_effect = lambda _: mock_module + get_params_mock.return_value = [] + + commands = retrieve_command_structure("") + + self._validate_retrieved_command_structure(commands) + + @patch("schema.make_schema.retrieve_command_structure") + def test_schema_is_generated_properly(self, retrieve_commands_mock): + def mock_retrieve_commands(package_name, counter=[0]): + counter[0] += 1 + return [SamCliCommandSchema(f"command-{counter[0]}", "some command", [])] + + retrieve_commands_mock.side_effect = mock_retrieve_commands + + schema = generate_schema() + + for expected_key in [ + "$schema", + "title", + "type", + "properties", + "required", + "additionalProperties", + "patternProperties", + ]: + self.assertIn(expected_key, schema.keys(), f"Key '{expected_key}' should be in schema") + self.assertEqual(schema["required"], ["version"], "Version key should be required") + self.assertEqual( + list(schema["patternProperties"].keys()), + [SchemaKeys.ENVIRONMENT_REGEX.value], + "patternProperties should have environment regex value", + ) + self.assertEqual( + list(schema["patternProperties"][SchemaKeys.ENVIRONMENT_REGEX.value].keys()), + ["title", "properties"], + "Environment should have keys 'title' and 'properties'", + ) + commands_in_schema = schema["patternProperties"][SchemaKeys.ENVIRONMENT_REGEX.value]["properties"] + for command_name, command_value in commands_in_schema.items(): + self.assertTrue(command_name.startswith("command-"), "Command should have key of its name") + command_number = command_name.split("-")[-1] + self.assertEqual( + {command_name: command_value}, + SamCliCommandSchema(f"command-{command_number}", "some command", []).to_schema(), + "Command should be represented correctly in schema", + ) + + def _setup_mock_module(self) -> MagicMock: + mock_module = MagicMock() + mock_module.__setattr__("__name__", "samcli.commands.cmdname") + mock_module.cli.help = "help text" + return mock_module + + def _validate_retrieved_command_structure(self, commands: List[SamCliCommandSchema]): + for command in commands: + self.assertTrue(command.name.startswith("cmdname"), "Name of command should be parsed") + self.assertEqual(command.description, "help text", "Help text should be parsed") diff --git a/tests/unit/schema/test_schema_validation.py b/tests/unit/schema/test_schema_validation.py new file mode 100644 index 0000000000..ec8ff088ca --- /dev/null +++ b/tests/unit/schema/test_schema_validation.py @@ -0,0 +1,53 @@ +import os +from pathlib import Path +import jsonschema +from parameterized import parameterized +from unittest import TestCase + +from samcli.lib.config.file_manager import FILE_MANAGER_MAPPER +from schema.make_schema import generate_schema + + +class TestSchemaValidation(TestCase): + schema = None + testdata_dir = None + + @classmethod + def setUpClass(cls): + cls.schema = generate_schema() + testing_dir = Path(__name__).resolve().parents[0] + cls.testdata_dir = str(Path(testing_dir, "tests", "unit", "schema", "testdata")) + + def test_samconfig_validates_against_schema(self): + self.assertIsNotNone(self.schema, "Schema was not set") + + passing_tests_dir = Path(self.testdata_dir, "passing_tests") + + # Read in and assert all files in passing_tests pass + for config_file_path in os.listdir(passing_tests_dir): + config_file = FILE_MANAGER_MAPPER[Path(config_file_path).suffix].read( + Path(str(passing_tests_dir), config_file_path) + ) + self.assertNotEqual(config_file, {}, f"Config file {config_file_path} should be read correctly") + + try: + jsonschema.validate(config_file, self.schema) + except jsonschema.ValidationError as e: + self.fail(f"File {config_file_path} not validating: {e.message}") + + def test_samconfig_doesnt_validate_against_schema(self): + self.assertIsNotNone(self.schema, "Schema was not set") + + failing_tests_dir = Path(self.testdata_dir, "failing_tests") + + # Read in and assert all files in failing_tests fail + for config_file_path in os.listdir(failing_tests_dir): + config_file = FILE_MANAGER_MAPPER[Path(config_file_path).suffix].read( + Path(str(failing_tests_dir), config_file_path) + ) + self.assertNotEqual(config_file, {}, f"Config file {config_file_path} should be read correctly") + + with self.assertRaises( + jsonschema.ValidationError, msg=f"Config file {config_file_path} should not validate against schema" + ): + jsonschema.validate(config_file, self.schema) diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/buildcmd_noparams.toml new file mode 100644 index 0000000000..932be00152 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.build] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_noparams.yaml b/tests/unit/schema/testdata/failing_tests/buildcmd_noparams.yaml new file mode 100644 index 0000000000..2cd38690fe --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_noparams.yaml @@ -0,0 +1,4 @@ +version: 0.1 +default: + build: + debug: false \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_build_dir.toml b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_build_dir.toml new file mode 100644 index 0000000000..eddb917e60 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_build_dir.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.build.parameters] +build_dir = false \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_build_dir.yaml b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_build_dir.yaml new file mode 100644 index 0000000000..512cbffcc6 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_build_dir.yaml @@ -0,0 +1,6 @@ +version: 0.1 + +default: + build: + parameters: + build_dir: false \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_debug.toml b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_debug.toml new file mode 100644 index 0000000000..f7513f9453 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_debug.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.build.parameters] +debug = "false" \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_debug.yaml b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_debug.yaml new file mode 100644 index 0000000000..21a434567e --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_debug.yaml @@ -0,0 +1,6 @@ +version: 0.1 + +default: + build: + parameters: + debug: "False" \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_parameter_overrides.toml b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_parameter_overrides.toml new file mode 100644 index 0000000000..4ff06e6b2f --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_parameter_overrides.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.build.parameters] +parameter_overrides = 10 \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_parameter_overrides.yaml b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_parameter_overrides.yaml new file mode 100644 index 0000000000..8fd607ad4d --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/buildcmd_wrongtype_parameter_overrides.yaml @@ -0,0 +1,6 @@ +version: 0.1 + +default: + build: + parameters: + parameter_overrides: 10 \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/deletecmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/deletecmd_noparams.toml new file mode 100644 index 0000000000..f9b2e5bbd6 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/deletecmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.delete] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/deploycmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/deploycmd_noparams.toml new file mode 100644 index 0000000000..d506ec73fd --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/deploycmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.deploy] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/initcmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/initcmd_noparams.toml new file mode 100644 index 0000000000..e49f8da8fc --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/initcmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.init] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/list_endpointscmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/list_endpointscmd_noparams.toml new file mode 100644 index 0000000000..7f0070e5c7 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/list_endpointscmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.list_endpoints] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/list_resourcescmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/list_resourcescmd_noparams.toml new file mode 100644 index 0000000000..6f470bec1b --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/list_resourcescmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.list_resources] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/list_stack_outputscmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/list_stack_outputscmd_noparams.toml new file mode 100644 index 0000000000..ec2648eafc --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/list_stack_outputscmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.list_stack_outputs] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/local_invokecmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/local_invokecmd_noparams.toml new file mode 100644 index 0000000000..65c4d76e23 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/local_invokecmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.local_invoke] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/local_invokecmd_wrongtype_debug_port.toml b/tests/unit/schema/testdata/failing_tests/local_invokecmd_wrongtype_debug_port.toml new file mode 100644 index 0000000000..06533cba69 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/local_invokecmd_wrongtype_debug_port.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.local_invoke.parameters] +debug_port = "10" \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/local_invokecmd_wrongtype_debug_port.yaml b/tests/unit/schema/testdata/failing_tests/local_invokecmd_wrongtype_debug_port.yaml new file mode 100644 index 0000000000..925042a578 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/local_invokecmd_wrongtype_debug_port.yaml @@ -0,0 +1,6 @@ +version: 0.1 + +default: + local_invoke: + parameters: + debug_port: "10" \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/local_start_apicmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/local_start_apicmd_noparams.toml new file mode 100644 index 0000000000..397fc3dbc0 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/local_start_apicmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.local_start_api] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/local_start_lambdacmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/local_start_lambdacmd_noparams.toml new file mode 100644 index 0000000000..04572a74fa --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/local_start_lambdacmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.local_start_lambda] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/logscmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/logscmd_noparams.toml new file mode 100644 index 0000000000..73e819840c --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/logscmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.logs] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/noversion.toml b/tests/unit/schema/testdata/failing_tests/noversion.toml new file mode 100644 index 0000000000..48e6e70e15 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/noversion.toml @@ -0,0 +1,26 @@ +# version = 0.1 + +[default] +[default.global] +[default.global.parameters] +stack_name = "sam-app" + +[default.build.parameters] +cached = true +parallel = true + +[default.deploy.parameters] +capabilities = "CAPABILITY_IAM" +confirm_changeset = true +resolve_s3 = true + +[default.sync.parameters] +watch = true + +[default.local_start_api.parameters] +warm_containers = "EAGER" + +[prod] +[prod.sync] +[prod.sync.parameters] +watch = false \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/noversion.yaml b/tests/unit/schema/testdata/failing_tests/noversion.yaml new file mode 100644 index 0000000000..95e4ebc8ac --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/noversion.yaml @@ -0,0 +1,4 @@ +default: + build: + parameters: + debug: false \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/packagecmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/packagecmd_noparams.toml new file mode 100644 index 0000000000..45d2528271 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/packagecmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.package] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/packagecmd_wrongtype_image_repositories.toml b/tests/unit/schema/testdata/failing_tests/packagecmd_wrongtype_image_repositories.toml new file mode 100644 index 0000000000..a33abbe0d3 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/packagecmd_wrongtype_image_repositories.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.package.parameters] +image_repositories = "Image repositories" \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/packagecmd_wrongtype_image_repositories.yaml b/tests/unit/schema/testdata/failing_tests/packagecmd_wrongtype_image_repositories.yaml new file mode 100644 index 0000000000..372838afbe --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/packagecmd_wrongtype_image_repositories.yaml @@ -0,0 +1,6 @@ +version: 0.1 + +default: + package: + parameters: + image_repositories: Image repositories \ No newline at end of file diff --git a/tests/unit/schema/testdata/failing_tests/pipeline_bootstrapcmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/pipeline_bootstrapcmd_noparams.toml new file mode 100644 index 0000000000..456e9b8b4b --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/pipeline_bootstrapcmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.pipeline_bootstrap] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/pipeline_initcmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/pipeline_initcmd_noparams.toml new file mode 100644 index 0000000000..f398ad234d --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/pipeline_initcmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.pipeline_init] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/publishcmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/publishcmd_noparams.toml new file mode 100644 index 0000000000..d56a7f82c5 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/publishcmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.publish] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/remote_invokecmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/remote_invokecmd_noparams.toml new file mode 100644 index 0000000000..6186e6d091 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/remote_invokecmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.remote_invoke] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/synccmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/synccmd_noparams.toml new file mode 100644 index 0000000000..b4458242ca --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/synccmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.sync] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/tracescmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/tracescmd_noparams.toml new file mode 100644 index 0000000000..d2d5e647d6 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/tracescmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.traces] +debug = false diff --git a/tests/unit/schema/testdata/failing_tests/validatecmd_noparams.toml b/tests/unit/schema/testdata/failing_tests/validatecmd_noparams.toml new file mode 100644 index 0000000000..3277e99465 --- /dev/null +++ b/tests/unit/schema/testdata/failing_tests/validatecmd_noparams.toml @@ -0,0 +1,4 @@ +version = 0.1 + +[default.validate] +debug = false diff --git a/tests/unit/schema/testdata/passing_tests/buildcmd.toml b/tests/unit/schema/testdata/passing_tests/buildcmd.toml new file mode 100644 index 0000000000..d958e59157 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/buildcmd.toml @@ -0,0 +1,36 @@ +version = 0.1 + +[default.build.parameters] +hook_name = "Hook name" +skip_prepare_infra = false +use_container = false +container_env_var = "Container env var" +container_env_var_file = "Container env var file" +build_image = "Build image" +exclude = "Exclude" +parallel = false +mount_with = "READ" +build_dir = "Build dir" +cache_dir = "Cache dir" +base_dir = "Base dir" +manifest = "Manifest" +cached = false +template_file = "Template file" +parameter_overrides = "Parameter overrides" +skip_pull_image = false +docker_network = "Docker network" +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.build.parameters] +skip_prepare_infra = true +use_container = true +parallel = true +mount_with = "WRITE" +cached = true +parameter_overrides = ["Parameter", "Overrides"] +skip_pull_image = true +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/deletecmd.toml b/tests/unit/schema/testdata/passing_tests/deletecmd.toml new file mode 100644 index 0000000000..4b5f09c6fb --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/deletecmd.toml @@ -0,0 +1,16 @@ +version = 0.1 + +[default.delete.parameters] +stack_name = "Stack name" +no_prompts = false +s3_bucket = "S3 Bucket" +s3_prefix = "S3 Prefix" +profile = "Profile" +region = "Region" +beta_features = false +debug = false + +[other.delete.parameters] +no_prompts = true +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/deploycmd.toml b/tests/unit/schema/testdata/passing_tests/deploycmd.toml new file mode 100644 index 0000000000..1596b421bb --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/deploycmd.toml @@ -0,0 +1,50 @@ +version = 0.1 + +[default.deploy.parameters] +guided = false +template_file = "Template file" +no_execute_changeset = false +fail_on_empty_changeset = false +confirm_changeset = false +disable_rollback = false +on_failure = "DELETE" +stack_name = "Stack name" +s3_bucket = "S3 Bucket" +image_repository = "Image repository" +image_repositories = ["Image", "Repositories"] +force_upload = false +s3_prefix = "S3 Prefix" +kms_key_id = "KMS Key ID" +role_arn = "Role ARN" +use_json = false +resolve_s3 = false +resolve_image_repos = false +metadata = "Metadata" +notification_arns = "Notification ARNS" +tags = ["Tags", "More tags", "Even more tags"] +parameter_overrides = "Parameter overrides" +signing_profiles = "Signing profiles" +no_progressbar = false +capabilities = "Capabilities" +profile = "Profile" +region = "Region" +beta_features = false +debug = false + +[other.deploy.parameters] +guided = true +no_execute_changeset = true +fail_on_empty_changeset = true +confirm_changeset = true +disable_rollback = true +on_failure = "ROLLBACK" +force_upload = true +use_json = true +resolve_s3 = true +resolve_image_repos = true +notification_arns = ["Notification", "ARNS"] +parameter_overrides = ["Parameter", "Overrides"] +no_progressbar = true +capabilities = ["Capabilities", "More capabilities"] +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/initcmd.toml b/tests/unit/schema/testdata/passing_tests/initcmd.toml new file mode 100644 index 0000000000..a514c6c476 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/initcmd.toml @@ -0,0 +1,37 @@ +version = 0.1 + +[default.init.parameters] +no_interactive = false +architecture = "arm64" +location = "Location" +runtime = "python3.11" +package_type = "Image" +base_image = "amazon/python3.11-base" +dependency_manager = "pip" +output_dir = "Output dir" +name = "Name" +app_template = "App template" +no_input = false +extra_context = "Extra context" +tracing = false +application_insights = false +beta_features = false +debug = false + +[other.init.parameters] +no_interactive = true +architecture = "x86_64" +runtime = "java11" +package_type = "Zip" +base_image = "amazon/java11-base" +dependency_manager = "gradle" +no_input = true +tracing = true +application_insights = true +beta_features = true +debug = true + +[onemore.init.parameters] +runtime = "ruby3.2" +base_image = "amazon/ruby3.2-base" +dependency_manager = "bundler" \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/list_endpointscmd.toml b/tests/unit/schema/testdata/passing_tests/list_endpointscmd.toml new file mode 100644 index 0000000000..ef03141b4a --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/list_endpointscmd.toml @@ -0,0 +1,17 @@ +version = 0.1 + +[default.list_endpoints.parameters] +parameter_overrides = "Parameter overrides" +stack_name = "Stack name" +output = "json" +template_file = "Template file" +profile = "Profile" +region = "Region" +beta_features = false +debug = false + +[other.list_endpoints.parameters] +parameter_overrides = ["Parameter", "Overrides"] +output = "table" +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/list_resources.toml b/tests/unit/schema/testdata/passing_tests/list_resources.toml new file mode 100644 index 0000000000..558a9de810 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/list_resources.toml @@ -0,0 +1,17 @@ +version = 0.1 + +[default.list_resources.parameters] +parameter_overrides = "Parameter overrides" +stack_name = "Stack name" +output = "json" +template_file = "Template file" +profile = "Profile" +region = "Region" +beta_features = false +debug = false + +[other.list_resources.parameters] +parameter_overrides = ["Parameter", "Overrides"] +output = "table" +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/list_stack_outputs.toml b/tests/unit/schema/testdata/passing_tests/list_stack_outputs.toml new file mode 100644 index 0000000000..e931937d9e --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/list_stack_outputs.toml @@ -0,0 +1,14 @@ +version = 0.1 + +[default.list_stack_outputs.parameters] +stack_name = "Stack name" +output = "json" +profile = "Profile" +region = "Region" +beta_features = false +debug = false + +[other.list_stack_outputs.parameters] +output = "table" +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/local_invokecmd.toml b/tests/unit/schema/testdata/passing_tests/local_invokecmd.toml new file mode 100644 index 0000000000..d5cd5f24a3 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/local_invokecmd.toml @@ -0,0 +1,39 @@ +version = 0.1 + +[default.local_invoke.parameters] +hook_name = "Hook name" +skip_prepare_infra = false +event = "Event" +no_event = false +template_file = "Template file" +env_vars = "Env vars" +parameter_overrides = "Parameter overrides" +debug_port = 10 +debugger_path = "Debugger path" +debug_args = "Debug args" +container_env_vars = "Container env vars" +docker_volume_basedir = "Docker volume basedir" +log_file = "Log file" +layer_cache_basedir = "Layer cache basedir" +skip_pull_image = false +docker_network = "Docker network" +force_image_build = false +shutdown = false +container_host = "Container host" +container_host_interface = "Container host interface" +invoke_image = "Invoke image" +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.local_invoke.parameters] +skip_prepare_infra = true +no_event = true +parameter_overrides = ["Parameter", "Overrides"] +debug_port = 20 +skip_pull_image = true +force_image_build = true +shutdown = true +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/local_start_apicmd.toml b/tests/unit/schema/testdata/passing_tests/local_start_apicmd.toml new file mode 100644 index 0000000000..bb833a2419 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/local_start_apicmd.toml @@ -0,0 +1,43 @@ +version = 0.1 + +[default.local_start_api.parameters] +hook_name = "Hook name" +skip_prepare_infra = false +host = "Host" +port = 10 +static_dir = "Static dir" +template_file = "Template file" +env_vars = "Env vars" +parameter_overrides = "Parameter overrides" +debug_port = 10 +debugger_path = "Debugger path" +debug_args = "Debug args" +container_env_vars = "Container env vars" +docker_volume_basedir = "Docker volume basedir" +log_file = "Log file" +layer_cache_basedir = "Layer cache basedir" +skip_pull_image = false +docker_network = "Docker network" +force_image_build = false +warm_containers = "EAGER" +debug_function = "Debug function" +shutdown = false +container_host = "Container host" +container_host_interface = "Container host interface" +invoke_image = "Invoke image" +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.local_start_api.parameters] +skip_prepare_infra = true +port = 200 +parameter_overrides = ["Parameter", "Overrides"] +debug_port = 1 +skip_pull_image = true +force_image_build = true +warm_containers = "LAZY" +shutdown = true +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/local_start_lambdacmd.toml b/tests/unit/schema/testdata/passing_tests/local_start_lambdacmd.toml new file mode 100644 index 0000000000..b738f8639b --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/local_start_lambdacmd.toml @@ -0,0 +1,42 @@ +version = 0.1 + +[default.local_start_lambda.parameters] +hook_name = "Hook name" +skip_prepare_infra = false +host = "Host" +port = 10 +template_file = "Template file" +env_vars = "Env vars" +parameter_overrides = "Parameter overrides" +debug_port = 10 +debugger_path = "Debugger path" +debug_args = "Debug args" +container_env_vars = "Container env vars" +docker_volume_basedir = "Docker volume basedir" +log_file = "Log file" +layer_cache_basedir = "Layer cache basedir" +skip_pull_image = false +docker_network = "Docker network" +force_image_build = false +warm_containers = "EAGER" +debug_function = "Debug function" +shutdown = false +container_host = "Container host" +container_host_interface = "Container host interface" +invoke_image = "Invoke image" +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.local_start_lambda.parameters] +skip_prepare_infra = true +port = 200 +parameter_overrides = ["Parameter", "Overrides"] +debug_port = 1 +skip_pull_image = true +force_image_build = true +warm_containers = "LAZY" +shutdown = true +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/logscmd.toml b/tests/unit/schema/testdata/passing_tests/logscmd.toml new file mode 100644 index 0000000000..ec7d8d71d9 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/logscmd.toml @@ -0,0 +1,23 @@ +version = 0.1 + +[default.logs.parameters] +name = "Name" +stack_name = "Stack name" +filter = "Filter" +tail = false +include_traces = false +cw_log_group = "CW Log Group" +output = "json" +end_time = "End time" +start_time = "Start time" +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.logs.parameters] +tail = true +include_traces = true +output = "text" +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/packagecmd.toml b/tests/unit/schema/testdata/passing_tests/packagecmd.toml new file mode 100644 index 0000000000..ed9c7ca9b3 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/packagecmd.toml @@ -0,0 +1,28 @@ +version = 0.1 + +[default.package.parameters] +template_file = "Template file" +output_template_file = "Output template file" +s3_bucket = "S3 Bucket" +image_repository = "Image repository" +image_repositories = ["Image", "Repositories"] +s3_prefix = "S3 Prefix" +kms_key_id = "KMS Key ID" +use_json = false +force_upload = false +resolve_s3 = false +metadata = "Metadata" +signing_profiles = "Signing profiles" +no_progressbar = false +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.package.parameters] +use_json = true +force_upload = true +resolve_s3 = true +no_profressbar = true +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/pipeline_bootstrapcmd.toml b/tests/unit/schema/testdata/passing_tests/pipeline_bootstrapcmd.toml new file mode 100644 index 0000000000..adf31387c3 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/pipeline_bootstrapcmd.toml @@ -0,0 +1,37 @@ +version = 0.1 + +[default.pipeline_bootstrap.parameters] +interactive = false +stage = "Stage" +pipeline_user = "Pipeline user" +pipeline_execution_role = "Pipeline execution role" +cloudformation_execution_role = "Cloudformation execution role" +bucket = "Bucket" +create_image_repository = false +image_repository = "Image repository" +image_repositories = ["Image", "Repositories"] +confirm_changeset = false +permissions_provider = "iam" +oidc_provider_url = "OIDC Provider URL" +oidc_client_id = "OIDC Client ID" +github_org = "Github ORG" +github_repo = "GitHub Repo" +deployment_branch = "Deployment branch" +oidc_provider = "bitbucket-pipelines" +gitlab_group = "GitLab group" +gitlab_project = "GitLab project" +bitbucket_repo_uuid = "BitBucket Repo UUID" +cicd_provider = "CICD Provider" +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.pipeline_bootstrap.parameters] +interactive = true +create_image_repository = true +confirm_changeset = true +permissions_provider = "oidc" +oidc_provider = "gitlab" +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/pipeline_initcmd.toml b/tests/unit/schema/testdata/passing_tests/pipeline_initcmd.toml new file mode 100644 index 0000000000..bc155d01b8 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/pipeline_initcmd.toml @@ -0,0 +1,11 @@ +version = 0.1 + +[default.pipeline_init.parameters] +bootstrap = false +beta_features = false +debug = false + +[other.pipeline_init.parameters] +bootstrap = true +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/publishcmd.toml b/tests/unit/schema/testdata/passing_tests/publishcmd.toml new file mode 100644 index 0000000000..937bf3054e --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/publishcmd.toml @@ -0,0 +1,13 @@ +version = 0.1 + +[default.publish.parameters] +template_file = "Template file" +semantic_version = "Semantic version" +profile = "Profile" +region = "Region" +beta_features = false +debug = false + +[other.publish.parameters] +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/remote_invokecmd.toml b/tests/unit/schema/testdata/passing_tests/remote_invokecmd.toml new file mode 100644 index 0000000000..3056e54246 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/remote_invokecmd.toml @@ -0,0 +1,17 @@ +version = 0.1 + +[default.remote_invoke.parameters] +stack_name = "Stack name" +event = "Event" +event_file = "Event file" +output = "json" +parameter = ["Parameter", "Parameter2"] +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.remote_invoke.parameters] +output = "text" +beta_features = false +debug = false \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/sample.toml b/tests/unit/schema/testdata/passing_tests/sample.toml new file mode 100644 index 0000000000..4b95a2c644 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/sample.toml @@ -0,0 +1,26 @@ +version = 0.1 + +[default] +[default.global] +[default.global.parameters] +stack_name = "sam-app" + +[default.build.parameters] +cached = true +parallel = true + +[default.deploy.parameters] +capabilities = "CAPABILITY_IAM" +confirm_changeset = true +resolve_s3 = true + +[default.sync.parameters] +watch = true + +[default.local_start_api.parameters] +warm_containers = "EAGER" + +[prod] +[prod.sync] +[prod.sync.parameters] +watch = false \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/sample.yaml b/tests/unit/schema/testdata/passing_tests/sample.yaml new file mode 100644 index 0000000000..53527d0dcc --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/sample.yaml @@ -0,0 +1,26 @@ +version: 0.1 + +default: + global: + parameters: + stack_name: sam-app + build: + parameters: + cached: true + parallel: true + deploy: + parameters: + capabilities: CAPABILITY_IAM + confirm_changeset: true + resolve_s3: true + sync: + parameters: + watch: true + local_start_api: + parameters: + warm_containers: EAGER + +prod: + sync: + parameters: + watch: false \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/simplesample.toml b/tests/unit/schema/testdata/passing_tests/simplesample.toml new file mode 100644 index 0000000000..ead5e1d1bc --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/simplesample.toml @@ -0,0 +1,22 @@ +version = 0.1 + +[default.global.parameters] +stack_name = "sam-app" + +[default.build.parameters] +cached = true +parallel = true + +[default.deploy.parameters] +capabilities = "CAPABILITY_IAM" +confirm_changeset = true +resolve_s3 = true + +[default.sync.parameters] +watch = true + +[default.local_start_api.parameters] +warm_containers = "EAGER" + +[prod.sync.parameters] +watch = false \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/synccmd.toml b/tests/unit/schema/testdata/passing_tests/synccmd.toml new file mode 100644 index 0000000000..0c8f17e161 --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/synccmd.toml @@ -0,0 +1,42 @@ +version = 0.1 + +[default.sync.parameters] +template_file = "Template file" +code = false +watch = false +resource_id = "Resource ID" +resource = "AWS::Serverless::Function" +dependency_layer = false +skip_deploy_sync = false +stack_name = "Stack name" +base_dir = "Base dir" +use_container = false +build_image = "Build image" +image_repository = "Image repository" +image_repositories = ["Image", "Repositories"] +s3_bucket = "S3 Bucket" +s3_prefix = "S3 Prefix" +kms_key_id = "KMS Key ID" +role_arn = "Role ARN" +parameter_overrides = "Parameter overrides" +beta_features = false +debug = false +profile = "Profile" +region = "Region" +metadata = "Metadata" +notification_arns = ["Notification", "ARNS"] +tags = ["Tags", "More tags"] +capabilities = ["Some", "Capabilities"] + +[other.sync.parameters] +code = true +watch = true +resource = "AWS::Lambda::Function" +dependency_layer = true +skip_deploy_sync = true +use_container = true +parameter_overrides = ["Parameter", "Overrides"] +beta_features = true +debug = true +notification_arns = "Notification ARNS" +capabilities = "Capabilities" \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/tracescmd.toml b/tests/unit/schema/testdata/passing_tests/tracescmd.toml new file mode 100644 index 0000000000..760eea2aba --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/tracescmd.toml @@ -0,0 +1,18 @@ +version = 0.1 + +[default.traces.parameters] +trace_id = "Trace ID" +tail = false +output = "json" +end_time = "End time" +start_time = "Start time" +beta_features = false +debug = false +profile = "Profile" +region = "Region" + +[other.traces.parameters] +tail = true +output = "text" +beta_features = true +debug = true \ No newline at end of file diff --git a/tests/unit/schema/testdata/passing_tests/validatecmd.toml b/tests/unit/schema/testdata/passing_tests/validatecmd.toml new file mode 100644 index 0000000000..295d46250a --- /dev/null +++ b/tests/unit/schema/testdata/passing_tests/validatecmd.toml @@ -0,0 +1,14 @@ +version = 0.1 + +[default.validate.parameters] +template_file = "Template file" +profile = "Profile" +region = "Region" +beta_features = false +debug = false +lint = false + +[other.validate.parameters] +beta_features = true +debug = true +lint = true \ No newline at end of file