code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def convert(self, value, param, ctx): """Converts the user provided parameter value for the option to the provided Enum Parameters ------------ value: User provided value for the click option param: click parameter ctx: Context """ LOG.debug("C...
Converts the user provided parameter value for the option to the provided Enum Parameters ------------ value: User provided value for the click option param: click parameter ctx: Context
convert
python
aws/aws-sam-cli
samcli/cli/types.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/cli/types.py
Apache-2.0
def convert( self, value: Union[Dict[str, List[str]], str], param: Optional[click.Parameter], ctx: Optional[click.Context] ) -> Dict[str, List[str]]: """ Parses the multiple provided values into a mapping of resources to a list of exclusions. Parameters ---------- va...
Parses the multiple provided values into a mapping of resources to a list of exclusions. Parameters ---------- value: Union[Dict[str, List[str]], str] The passed in arugment param: click.Parameter The parameter that was provided ctx: click.Contex...
convert
python
aws/aws-sam-cli
samcli/cli/types.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/cli/types.py
Apache-2.0
def replace_spaces(self, replacement="_"): """ Replace spaces in a text with a replacement together with its original locations. Input: "test 1" Output: "test_1" [4] """ self.space_positions = [i for i, char in enumerate(self.text) if char == " "] self.modified_te...
Replace spaces in a text with a replacement together with its original locations. Input: "test 1" Output: "test_1" [4]
replace_spaces
python
aws/aws-sam-cli
samcli/cli/types.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/cli/types.py
Apache-2.0
def restore_spaces(self): """ Restore spaces in a text from a original space locations. Input: "test_1" [4] Output: "test 1" """ text_list = list(self.modified_text) for pos in self.space_positions: text_list[pos] = " " return "".join(text_li...
Restore spaces in a text from a original space locations. Input: "test_1" [4] Output: "test 1"
restore_spaces
python
aws/aws-sam-cli
samcli/cli/types.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/cli/types.py
Apache-2.0
def show(self, file: Optional[IO] = None) -> None: """Overriding show to customize printing stack trace and message""" if file is None: file = click._compat.get_text_stderr() # pylint: disable=protected-access tb = "".join(traceback.format_tb(self.__traceback__)) click.echo...
Overriding show to customize printing stack trace and message
show
python
aws/aws-sam-cli
samcli/commands/exceptions.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/exceptions.py
Apache-2.0
def __init__( self, resource_identifier: Optional[str], template_file: str, base_dir: Optional[str], build_dir: str, cache_dir: str, cached: bool, parallel: bool, mode: Optional[str], manifest_path: Optional[str] = None, clean: bool...
Initialize the class Parameters ---------- resource_identifier: Optional[str] The unique identifier of the resource template_file: str Path to the template for building base_dir : str Path to a folder. Use this folder as the root to r...
__init__
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def set_up(self) -> None: """Set up class members used for building This should be called each time before run() if stacks are changed.""" self._stacks, remote_stack_full_paths = SamLocalStackProvider.get_stacks( self._template_file, parameter_overrides=self._parameter_ov...
Set up class members used for building This should be called each time before run() if stacks are changed.
set_up
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def run(self) -> None: """Runs the building process by creating an ApplicationBuilder.""" if self._is_sam_template(): SamApiProvider.check_implicit_api_resource_ids(self.stacks) self._stacks = self._handle_build_pre_processing() caught_exception: Optional[Exception] = None ...
Runs the building process by creating an ApplicationBuilder.
run
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _is_sam_template(self) -> bool: """Check if a given template is a SAM template""" template_dict = get_template_data(self._template_file) template_transforms = template_dict.get("Transform", []) if not isinstance(template_transforms, list): template_transforms = [template_...
Check if a given template is a SAM template
_is_sam_template
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _handle_build_pre_processing(self) -> List[Stack]: """ Pre-modify the stacks as required before invoking the build :return: List of modified stacks """ stacks = [] if any(EsbuildBundlerManager(stack).esbuild_configured() for stack in self.stacks): # esbuil...
Pre-modify the stacks as required before invoking the build :return: List of modified stacks
_handle_build_pre_processing
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _handle_build_post_processing(self, builder: ApplicationBuilder, build_result: ApplicationBuildResult) -> None: """ Add any template modifications necessary before moving the template to build directory :param stack: Stack resources :param template: Current template file :par...
Add any template modifications necessary before moving the template to build directory :param stack: Stack resources :param template: Current template file :param build_result: Result of the application build :return: Modified template dict
_handle_build_post_processing
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _gen_success_msg(self, artifacts_dir: str, output_template_path: str, is_default_build_dir: bool) -> str: """ Generates a success message containing some suggested commands to run Parameters ---------- artifacts_dir: str A string path representing the folder of b...
Generates a success message containing some suggested commands to run Parameters ---------- artifacts_dir: str A string path representing the folder of built artifacts output_template_path: str A string path representing the final template file i...
_gen_success_msg
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def resources_to_build(self) -> ResourcesToBuildCollector: """ Function return resources that should be build by current build command. This function considers Lambda Functions and Layers with build method as buildable resources. Returns ------- ResourcesToBuildCollector ...
Function return resources that should be build by current build command. This function considers Lambda Functions and Layers with build method as buildable resources. Returns ------- ResourcesToBuildCollector
resources_to_build
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def collect_build_resources(self, resource_identifier: str) -> ResourcesToBuildCollector: """Collect a single buildable resource and its dependencies. For a Lambda function, its layers will be included. Parameters ---------- resource_identifier : str Resource identif...
Collect a single buildable resource and its dependencies. For a Lambda function, its layers will be included. Parameters ---------- resource_identifier : str Resource identifier for the resource to be built Returns ------- ResourcesToBuildCollector ...
collect_build_resources
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def collect_all_build_resources(self) -> ResourcesToBuildCollector: """Collect all buildable resources. Including Lambda functions and layers. Returns ------- ResourcesToBuildCollector ResourcesToBuildCollector that contains all the buildable resources. """ r...
Collect all buildable resources. Including Lambda functions and layers. Returns ------- ResourcesToBuildCollector ResourcesToBuildCollector that contains all the buildable resources.
collect_all_build_resources
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _collect_single_function_and_dependent_layers( self, resource_identifier: str, resource_collector: ResourcesToBuildCollector ) -> None: """ Populate resource_collector with function with provided identifier and all layers that function need to be build in resource_collector ...
Populate resource_collector with function with provided identifier and all layers that function need to be build in resource_collector Parameters ---------- resource_collector: Collector that will be populated with resources.
_collect_single_function_and_dependent_layers
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _collect_single_buildable_layer( self, resource_identifier: str, resource_collector: ResourcesToBuildCollector ) -> None: """ Populate resource_collector with layer with provided identifier. Parameters ---------- resource_collector Returns ------...
Populate resource_collector with layer with provided identifier. Parameters ---------- resource_collector Returns -------
_collect_single_buildable_layer
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _check_exclude_warning(self) -> None: """ Prints warning message if a single resource to build is also being excluded """ excludes: Tuple[str, ...] = self._exclude if self._exclude is not None else () if self._resource_identifier in excludes: LOG.warning(self._EXC...
Prints warning message if a single resource to build is also being excluded
_check_exclude_warning
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def _check_rust_cargo_experimental_flag(self) -> None: """ Prints warning message and confirms if user wants to use beta feature """ WARNING_MESSAGE = ( 'Build method "rust-cargolambda" is a beta feature.\n' "Please confirm if you would like to proceed\n" ...
Prints warning message and confirms if user wants to use beta feature
_check_rust_cargo_experimental_flag
python
aws/aws-sam-cli
samcli/commands/build/build_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/build_context.py
Apache-2.0
def prompt_user_to_enable_mount_with_write_if_needed( resources_to_build: ResourcesToBuildCollector, base_dir: str, ) -> bool: """ First check if mounting with write permissions is needed for building inside container or not. If it is needed, then prompt user to choose if enables mounting with write...
First check if mounting with write permissions is needed for building inside container or not. If it is needed, then prompt user to choose if enables mounting with write permissions or not. Parameters ---------- resources_to_build: Resource to build inside container base_dir : str ...
prompt_user_to_enable_mount_with_write_if_needed
python
aws/aws-sam-cli
samcli/commands/build/utils.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/utils.py
Apache-2.0
def prompt(config: CONFIG, source_dir: str) -> bool: """ Prompt user to choose if enables mounting with write permissions or not when building lambda functions/layers Parameters ---------- config: namedtuple(Capability) Config specifying the particular build workflow source_dir : str ...
Prompt user to choose if enables mounting with write permissions or not when building lambda functions/layers Parameters ---------- config: namedtuple(Capability) Config specifying the particular build workflow source_dir : str Path to the function source code Returns ---...
prompt
python
aws/aws-sam-cli
samcli/commands/build/utils.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/build/utils.py
Apache-2.0
def init_clients(self): """ Initialize all the clients being used by sam delete. """ client_provider = get_boto_client_provider_with_config(region=self.region, profile=self.profile) try: cloudformation_client = client_provider("cloudformation") s3_client ...
Initialize all the clients being used by sam delete.
init_clients
python
aws/aws-sam-cli
samcli/commands/delete/delete_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/delete/delete_context.py
Apache-2.0
def s3_prompts(self): """ Guided prompts asking user to delete s3 artifacts """ # Note: s3_bucket and s3_prefix information is only # available if it is provided as an option flag, a # local toml file or if this information is obtained # from the template resource...
Guided prompts asking user to delete s3 artifacts
s3_prompts
python
aws/aws-sam-cli
samcli/commands/delete/delete_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/delete/delete_context.py
Apache-2.0
def ecr_companion_stack_prompts(self): """ User prompt to delete the ECR companion stack. """ click.echo(f"\tFound ECR Companion Stack {self.companion_stack_name}") if self.no_prompts: return True return confirm( click.style( "\tDo...
User prompt to delete the ECR companion stack.
ecr_companion_stack_prompts
python
aws/aws-sam-cli
samcli/commands/delete/delete_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/delete/delete_context.py
Apache-2.0
def ecr_repos_prompts(self, template: Template): """ User prompts to delete the ECR repositories for the given template. :param template: Template to get the ECR repositories. """ retain_repos = [] ecr_repos = template.get_ecr_repos() if not self.no_prompts: ...
User prompts to delete the ECR repositories for the given template. :param template: Template to get the ECR repositories.
ecr_repos_prompts
python
aws/aws-sam-cli
samcli/commands/delete/delete_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/delete/delete_context.py
Apache-2.0
def delete_ecr_companion_stack(self): """ Delete the ECR companion stack and ECR repositories based on user input. """ delete_ecr_companion_stack_prompt = self.ecr_companion_stack_prompts() if delete_ecr_companion_stack_prompt or self.no_prompts: cf_ecr_compan...
Delete the ECR companion stack and ECR repositories based on user input.
delete_ecr_companion_stack
python
aws/aws-sam-cli
samcli/commands/delete/delete_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/delete/delete_context.py
Apache-2.0
def delete(self): """ Delete method calls for Cloudformation stacks and S3 and ECR artifacts """ # Fetch the template using the stack-name cf_template = self.cf_utils.get_stack_template(self.stack_name, TEMPLATE_STAGE) # Get the cloudformation template name using templat...
Delete method calls for Cloudformation stacks and S3 and ECR artifacts
delete
python
aws/aws-sam-cli
samcli/commands/delete/delete_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/delete/delete_context.py
Apache-2.0
def run(self): """ Delete the stack based on the argument provided by user and samconfig.toml. """ if not self.no_prompts: delete_stack = confirm( click.style( f"\tAre you sure you want to delete the stack {self.stack_name}" f" in the regio...
Delete the stack based on the argument provided by user and samconfig.toml.
run
python
aws/aws-sam-cli
samcli/commands/delete/delete_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/delete/delete_context.py
Apache-2.0
def auth_per_resource(stacks: List[Stack]): """ Check if authentication has been set for the function resources defined in the template that have `Api` Event type or the function property FunctionUrlConfig. Parameters ---------- stacks: List[Stack] The list of stacks where resources are...
Check if authentication has been set for the function resources defined in the template that have `Api` Event type or the function property FunctionUrlConfig. Parameters ---------- stacks: List[Stack] The list of stacks where resources are looked for Returns ------- List of t...
auth_per_resource
python
aws/aws-sam-cli
samcli/commands/deploy/auth_utils.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/auth_utils.py
Apache-2.0
def _auth_resource_event(sam_function_provider: SamFunctionProvider, sam_function, auth_resource_list): """ Parameters ---------- sam_function_provider: SamFunctionProvider sam_function: Current function which has all intrinsics resolved. auth_resource_list: List of tuples with function name an...
Parameters ---------- sam_function_provider: SamFunctionProvider sam_function: Current function which has all intrinsics resolved. auth_resource_list: List of tuples with function name and auth. eg: [("Name", True)] Returns -------
_auth_resource_event
python
aws/aws-sam-cli
samcli/commands/deploy/auth_utils.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/auth_utils.py
Apache-2.0
def _auth_id(resources_dict, event_properties, identifier): """ Parameters ---------- resources_dict: dict Resolved resources defined in the SAM Template event_properties: dict Properties of given event supplied to a function resource identifier: str Id: `ApiId` or `Rest...
Parameters ---------- resources_dict: dict Resolved resources defined in the SAM Template event_properties: dict Properties of given event supplied to a function resource identifier: str Id: `ApiId` or `RestApiId` Returns ------- bool Returns if the giv...
_auth_id
python
aws/aws-sam-cli
samcli/commands/deploy/auth_utils.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/auth_utils.py
Apache-2.0
def _auth_definition_body_and_uri(definition_body, definition_uri): """ Parameters ---------- definition_body: dict inline definition body defined in the template definition_uri: string Either an s3 url or a local path to a definition uri Returns ------- bool Is...
Parameters ---------- definition_body: dict inline definition body defined in the template definition_uri: string Either an s3 url or a local path to a definition uri Returns ------- bool Is security defined on the swagger or not?
_auth_definition_body_and_uri
python
aws/aws-sam-cli
samcli/commands/deploy/auth_utils.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/auth_utils.py
Apache-2.0
def run(self): """ Execute deployment based on the argument provided by customers and samconfig.toml. """ # Parse parameters with open(self.template_file, "r") as handle: template_str = handle.read() template_dict = yaml_parse(template_str) if not i...
Execute deployment based on the argument provided by customers and samconfig.toml.
run
python
aws/aws-sam-cli
samcli/commands/deploy/deploy_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/deploy_context.py
Apache-2.0
def deploy( self, stack_name: str, template_str: str, parameters: List[dict], capabilities: List[str], no_execute_changeset: bool, role_arn: str, notification_arns: List[str], s3_uploader: S3Uploader, tags: List[str], region: str, ...
Deploy the stack to cloudformation. - if changeset needs confirmation, it will prompt for customers to confirm. - if no_execute_changeset is True, the changeset won't be executed. Parameters ---------- stack_name : str name of the stack template_str ...
deploy
python
aws/aws-sam-cli
samcli/commands/deploy/deploy_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/deploy_context.py
Apache-2.0
def merge_parameters(template_dict: Dict, parameter_overrides: Dict) -> List[Dict]: """ CloudFormation CreateChangeset requires a value for every parameter from the template, either specifying a new value or use previous value. For convenience, this method will accept new parameter value...
CloudFormation CreateChangeset requires a value for every parameter from the template, either specifying a new value or use previous value. For convenience, this method will accept new parameter values and generates a dict of all parameters in a format that ChangeSet API will ac...
merge_parameters
python
aws/aws-sam-cli
samcli/commands/deploy/deploy_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/deploy_context.py
Apache-2.0
def guided_prompts(self, parameter_override_keys): """ Start an interactive cli prompt to collection information for deployment Parameters ---------- parameter_override_keys The keys of parameters to override, for each key, customers will be asked to provide a value ...
Start an interactive cli prompt to collection information for deployment Parameters ---------- parameter_override_keys The keys of parameters to override, for each key, customers will be asked to provide a value
guided_prompts
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def prompt_code_signing_settings(self, stacks: List[Stack]): """ Prompt code signing settings to ask whether customers want to code sign their code and display signing details. Parameters ---------- stacks : List[Stack] List of stacks to search functions and ...
Prompt code signing settings to ask whether customers want to code sign their code and display signing details. Parameters ---------- stacks : List[Stack] List of stacks to search functions and layers
prompt_code_signing_settings
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def prompt_image_repository( self, stack_name, stacks: List[Stack], image_repositories: Optional[Dict[str, str]], region: str, s3_bucket: str, s3_prefix: str, ) -> Dict[str, str]: """ Prompt for the image repository to push the images. ...
Prompt for the image repository to push the images. For each image function found in build artifacts, it will prompt for an image repository. Parameters ---------- stack_name : List[Stack] Name of the stack to be deployed. stacks : List[Stack] L...
prompt_image_repository
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def prompt_specify_repos( self, functions_without_repos: List[str], image_repositories: Dict[str, str], ) -> Dict[str, str]: """ Show prompts for each function that isn't associated with a image repo Parameters ---------- functions_without_repos: List...
Show prompts for each function that isn't associated with a image repo Parameters ---------- functions_without_repos: List[str] List of functions without associating repos image_repositories: Dict[str, str] Current image repo dictionary with function lo...
prompt_specify_repos
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def prompt_create_all_repos( self, functions: List[str], functions_without_repo: List[str], existing_mapping: Dict[str, str] ) -> bool: """ Prompt whether to create all repos Parameters ---------- functions: List[str] List of function logical IDs that are...
Prompt whether to create all repos Parameters ---------- functions: List[str] List of function logical IDs that are image based functions_without_repo: List[str] List of function logical IDs that do not have an ECR image repo specified existing...
prompt_create_all_repos
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def prompt_delete_unreferenced_repos( self, unreferenced_repo_uris: List[str], image_repositories: Dict[str, str] ) -> Dict[str, str]: """ Prompt user for deleting unreferenced companion stack image repos. Throws GuidedDeployFailedError if delete repos has been denied by the user. ...
Prompt user for deleting unreferenced companion stack image repos. Throws GuidedDeployFailedError if delete repos has been denied by the user. This function does not actually remove the functions from the stack. Parameters ---------- unreferenced_repo_uris: List[str] ...
prompt_delete_unreferenced_repos
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def verify_images_exist_locally(functions: Dict[str, Function]) -> None: """ Verify all images associated with deploying functions exist locally. Parameters ---------- functions: Dict[str, Function] Dictionary of functions in the stack to be deployed with key as thei...
Verify all images associated with deploying functions exist locally. Parameters ---------- functions: Dict[str, Function] Dictionary of functions in the stack to be deployed with key as their logical ID.
verify_images_exist_locally
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def _get_parameter_value( parameter_key: str, parameter_properties: Dict, parameter_override_from_cmdline: Dict ) -> Any: """ This function provide the value of a parameter. If the command line/config file have "override_parameter" whose key exist in the template file parameters, it ...
This function provide the value of a parameter. If the command line/config file have "override_parameter" whose key exist in the template file parameters, it will use the corresponding value. Otherwise, it will use its default value in template file. :param parameter_key: key of parame...
_get_parameter_value
python
aws/aws-sam-cli
samcli/commands/deploy/guided_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/guided_context.py
Apache-2.0
def print_deploy_args( stack_name, s3_bucket, image_repository, region, capabilities, parameter_overrides, confirm_changeset, signing_profiles, use_changeset, disable_rollback, ): """ Print a table of the values that are used during a sam deploy. Irrespective of if a ...
Print a table of the values that are used during a sam deploy. Irrespective of if a image_repository is provided or not, the template is always uploaded to the s3 bucket. Example below: Deploying with following values =============================== Stack name : sa...
print_deploy_args
python
aws/aws-sam-cli
samcli/commands/deploy/utils.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/deploy/utils.py
Apache-2.0
def create_command() -> Type[Command]: """ Factory method for creating a Docs command Returns ------- Type[Command] Sub-command class if the command line args include sub-commands, otherwise returns the base command class """ if DocsCommandContext().sub_commands: retu...
Factory method for creating a Docs command Returns ------- Type[Command] Sub-command class if the command line args include sub-commands, otherwise returns the base command class
create_command
python
aws/aws-sam-cli
samcli/commands/docs/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/command.py
Apache-2.0
def __init__(self, command: str): """ Constructor used for instantiating a command implementation object Parameters ---------- command: str Name of the command that is being executed """ self.command = command self.docs_command = DocsCommandCo...
Constructor used for instantiating a command implementation object Parameters ---------- command: str Name of the command that is being executed
__init__
python
aws/aws-sam-cli
samcli/commands/docs/command_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/command_context.py
Apache-2.0
def run_command(self): """ Run the necessary logic for the `sam docs` command Raises ------ InvalidDocsCommandException """ if self.docs_command.sub_commands and self.command not in self.docs_command.all_commands: raise InvalidDocsCommandException( ...
Run the necessary logic for the `sam docs` command Raises ------ InvalidDocsCommandException
run_command
python
aws/aws-sam-cli
samcli/commands/docs/command_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/command_context.py
Apache-2.0
def __init__(self, *args, **kwargs): """ Constructor for instantiating a base command for the docs command """ self.docs_command = DocsCommandContext() command_callback = self.docs_command.command_callback super().__init__(name=COMMAND_NAME, help=HELP_TEXT, callback=comma...
Constructor for instantiating a base command for the docs command
__init__
python
aws/aws-sam-cli
samcli/commands/docs/core/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/core/command.py
Apache-2.0
def format_description(formatter: DocsCommandHelpTextFormatter): """ Formats the description of the help text for the docs command. Parameters ---------- formatter: DocsCommandHelpTextFormatter A formatter instance to use for formatting the help text """ ...
Formats the description of the help text for the docs command. Parameters ---------- formatter: DocsCommandHelpTextFormatter A formatter instance to use for formatting the help text
format_description
python
aws/aws-sam-cli
samcli/commands/docs/core/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/core/command.py
Apache-2.0
def format_sub_commands(self, formatter: DocsCommandHelpTextFormatter): """ Formats the sub-commands of the help text for the docs command. Parameters ---------- formatter: DocsCommandHelpTextFormatter A formatter instance to use for formatting the help text ...
Formats the sub-commands of the help text for the docs command. Parameters ---------- formatter: DocsCommandHelpTextFormatter A formatter instance to use for formatting the help text
format_sub_commands
python
aws/aws-sam-cli
samcli/commands/docs/core/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/core/command.py
Apache-2.0
def __init__(self, command_list: Optional[List[str]] = None, *args, **kwargs): """ Constructor for instantiating a sub-command for the docs command Parameters ---------- command_list: Optional[List[str]] Optional list of strings representing the fully resolved comman...
Constructor for instantiating a sub-command for the docs command Parameters ---------- command_list: Optional[List[str]] Optional list of strings representing the fully resolved command name (e.g. ["docs", "local", "invoke"])
__init__
python
aws/aws-sam-cli
samcli/commands/docs/core/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/core/command.py
Apache-2.0
def get_command(self, ctx: Context, cmd_name: str) -> Command: """ Overriding the get_command method from the parent class. This method recursively gets creates sub-commands until it reaches the leaf command, then it returns that as a click command. Parameters ---------...
Overriding the get_command method from the parent class. This method recursively gets creates sub-commands until it reaches the leaf command, then it returns that as a click command. Parameters ---------- ctx: Context The click command context cmd_n...
get_command
python
aws/aws-sam-cli
samcli/commands/docs/core/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/core/command.py
Apache-2.0
def __init__(self, *args, **kwargs): """ Constructor for instantiating a formatter object used for formatting help text """ super().__init__(*args, **kwargs) self.left_justification_length = self.width // 2 - self.indent_increment self.modifiers = [BaseLineRowModifier()]
Constructor for instantiating a formatter object used for formatting help text
__init__
python
aws/aws-sam-cli
samcli/commands/docs/core/formatter.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/docs/core/formatter.py
Apache-2.0
def pt_callback(ctx, param, provided_value): """ This function is the callback for the --package-type param. Here we check if --package-type was passed or not. If not, we use the default value of --package-type to be Zip. """ if provided_value is None: return ZIP ...
This function is the callback for the --package-type param. Here we check if --package-type was passed or not. If not, we use the default value of --package-type to be Zip.
pt_callback
python
aws/aws-sam-cli
samcli/commands/init/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/command.py
Apache-2.0
def non_interactive_validation(func): """ Check requirement for --dependency-manager parameter for non interactive mode --dependency-manager parameter is only required if --package-type is ZIP or --base-image is one of the java ones """ def wrapped(*args, **kwargs): ctx = click.get_cur...
Check requirement for --dependency-manager parameter for non interactive mode --dependency-manager parameter is only required if --package-type is ZIP or --base-image is one of the java ones
non_interactive_validation
python
aws/aws-sam-cli
samcli/commands/init/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/command.py
Apache-2.0
def get_sorted_runtimes(runtime_option_list): """ Return a list of sorted runtimes in ascending order of runtime names and descending order of runtime version. Parameters ---------- runtime_option_list : list list of possible runtime to be selected Returns ------- list ...
Return a list of sorted runtimes in ascending order of runtime names and descending order of runtime version. Parameters ---------- runtime_option_list : list list of possible runtime to be selected Returns ------- list sorted list of possible runtime to be selected ...
get_sorted_runtimes
python
aws/aws-sam-cli
samcli/commands/init/init_flow_helpers.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_flow_helpers.py
Apache-2.0
def get_supported_runtime(runtime_list): """ Returns a list of only runtimes supported by the current version of SAMCLI. This is the list that is presented to the customer to select from. Parameters ---------- runtime_list : list List of runtime Returns ------- list ...
Returns a list of only runtimes supported by the current version of SAMCLI. This is the list that is presented to the customer to select from. Parameters ---------- runtime_list : list List of runtime Returns ------- list List of supported runtime
get_supported_runtime
python
aws/aws-sam-cli
samcli/commands/init/init_flow_helpers.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_flow_helpers.py
Apache-2.0
def compare_runtimes(first_runtime, second_runtime): """ Logic to compare supported runtime for sorting. Parameters ---------- first_runtime : str runtime to be compared second_runtime : str runtime to be compared Returns ------- int comparison result ""...
Logic to compare supported runtime for sorting. Parameters ---------- first_runtime : str runtime to be compared second_runtime : str runtime to be compared Returns ------- int comparison result
compare_runtimes
python
aws/aws-sam-cli
samcli/commands/init/init_flow_helpers.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_flow_helpers.py
Apache-2.0
def _get_version_number(runtime): """ Return the runtime version number Parameters ---------- runtime_version : str version of a runtime Returns ------- float Runtime version number """ if is_custom_runtime(runtime): return 1.0 return float(re.searc...
Return the runtime version number Parameters ---------- runtime_version : str version of a runtime Returns ------- float Runtime version number
_get_version_number
python
aws/aws-sam-cli
samcli/commands/init/init_flow_helpers.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_flow_helpers.py
Apache-2.0
def _get_runtime_from_image(image: str) -> Optional[str]: """ Get corresponding runtime from the base-image parameter Expecting 'amazon/{runtime}-base' But might also be like 'amazon/{runtime}-provided.al2-base' """ match = re.fullmatch(r"amazon/([a-z0-9.]*)-?([a-z0-9.]*)-base", image) if m...
Get corresponding runtime from the base-image parameter Expecting 'amazon/{runtime}-base' But might also be like 'amazon/{runtime}-provided.al2-base'
_get_runtime_from_image
python
aws/aws-sam-cli
samcli/commands/init/init_flow_helpers.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_flow_helpers.py
Apache-2.0
def _check_upsert_templates(self, shared_dir: Path, cloned_folder_name: str) -> bool: """ Check if the app templates repository should be cloned, or if cloning should be skipped. Parameters ---------- shared_dir: Path Folder containing the aws-sam-cli shared data ...
Check if the app templates repository should be cloned, or if cloning should be skipped. Parameters ---------- shared_dir: Path Folder containing the aws-sam-cli shared data cloned_folder_name: str Name of the directory into which the app templates will...
_check_upsert_templates
python
aws/aws-sam-cli
samcli/commands/init/init_templates.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_templates.py
Apache-2.0
def is_dynamic_schemas_template(self, package_type, app_template, runtime, base_image, dependency_manager): """ Check if provided template is dynamic template e.g: AWS Schemas template. Currently dynamic templates require different handling e.g: for schema download & merge schema code in sam-app...
Check if provided template is dynamic template e.g: AWS Schemas template. Currently dynamic templates require different handling e.g: for schema download & merge schema code in sam-app. :param package_type: :param app_template: :param runtime: :param base_image: ...
is_dynamic_schemas_template
python
aws/aws-sam-cli
samcli/commands/init/init_templates.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_templates.py
Apache-2.0
def get_preprocessed_manifest( self, filter_value: Optional[str] = None, app_template: Optional[str] = None, package_type: Optional[str] = None, dependency_manager: Optional[str] = None, ) -> dict: """ This method get the manifest cloned from the git repo and ...
This method get the manifest cloned from the git repo and preprocessed it. Below is the link to manifest: https://github.com/aws/aws-sam-cli-app-templates/blob/master/manifest-v2.json The structure of the manifest is shown below: { "dotnet6": [ { ...
get_preprocessed_manifest
python
aws/aws-sam-cli
samcli/commands/init/init_templates.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_templates.py
Apache-2.0
def _get_manifest(self): """ In an attempt to reduce initial wait time to achieve an interactive flow <= 10sec, This method first attempts to spools just the manifest file and if the manifest can't be spooled, it attempts to clone the cli template git repo or use local cli templa...
In an attempt to reduce initial wait time to achieve an interactive flow <= 10sec, This method first attempts to spools just the manifest file and if the manifest can't be spooled, it attempts to clone the cli template git repo or use local cli template
_get_manifest
python
aws/aws-sam-cli
samcli/commands/init/init_templates.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_templates.py
Apache-2.0
def template_does_not_meet_filter_criteria( app_template: Optional[str], package_type: Optional[str], dependency_manager: Optional[str], template: dict ) -> bool: """ Parameters ---------- app_template : Optional[str] Application template generated package_type : Optional[str] Th...
Parameters ---------- app_template : Optional[str] Application template generated package_type : Optional[str] The package type, 'Zip' or 'Image', see samcli/lib/utils/packagetype.py dependency_manager : Optional[str] Dependency manager template : dict key-value ...
template_does_not_meet_filter_criteria
python
aws/aws-sam-cli
samcli/commands/init/init_templates.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_templates.py
Apache-2.0
def filter_value_matches_template_runtime(filter_value, template_runtime): """ Validate if the filter value matches template runtimes from the manifest file Parameters ---------- filter_value : str Lambda runtime used to filter through data generated from the manifest template_runtime :...
Validate if the filter value matches template runtimes from the manifest file Parameters ---------- filter_value : str Lambda runtime used to filter through data generated from the manifest template_runtime : str Runtime of the template in view Returns ------- bool ...
filter_value_matches_template_runtime
python
aws/aws-sam-cli
samcli/commands/init/init_templates.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/init_templates.py
Apache-2.0
def get_schema_template_details(schemas_api_caller): """ Calls schemas APIs to fetch available selection and returns schema details based on user selection. :param schemas_api_caller: :return: """ registry_name = _get_registry_cli_choice(schemas_api_caller) schema_full_name = _get_schema_cli...
Calls schemas APIs to fetch available selection and returns schema details based on user selection. :param schemas_api_caller: :return:
get_schema_template_details
python
aws/aws-sam-cli
samcli/commands/init/interactive_event_bridge_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_event_bridge_flow.py
Apache-2.0
def _get_registry_cli_choice(schemas_api_caller): """Returns registry choice if one registry is present otherwise prompt for selection""" registries = _fetch_available_registries(schemas_api_caller, dict(), None) registry_pages = registries["registry_pages"] # If only one registry don't prompt for choic...
Returns registry choice if one registry is present otherwise prompt for selection
_get_registry_cli_choice
python
aws/aws-sam-cli
samcli/commands/init/interactive_event_bridge_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_event_bridge_flow.py
Apache-2.0
def _get_schema_cli_choice(schemas_api_caller, registry_name): """Returns registry registry choice if one registry is present otherwise prompt for selection""" schemas = _fetch_available_schemas(schemas_api_caller, registry_name, dict(), None) schema_pages = schemas["schema_pages"] # If only one schema...
Returns registry registry choice if one registry is present otherwise prompt for selection
_get_schema_cli_choice
python
aws/aws-sam-cli
samcli/commands/init/interactive_event_bridge_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_event_bridge_flow.py
Apache-2.0
def _fetch_available_schemas(schemas_api_caller, registry_name, schema_pages, next_token): """calls schemas api fetch schemas for given registry. Two CLI pages are fetched at a time.""" list_schemas_response = schemas_api_caller.list_schemas(registry_name, next_token, PAGE_LIMIT) schemas = list_schemas_resp...
calls schemas api fetch schemas for given registry. Two CLI pages are fetched at a time.
_fetch_available_schemas
python
aws/aws-sam-cli
samcli/commands/init/interactive_event_bridge_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_event_bridge_flow.py
Apache-2.0
def _fetch_available_registries(schemas_api_caller, registry_pages, next_token): """calls schemas api to fetch registries. Two CLI pages are fetched at a time.""" list_registries_response = schemas_api_caller.list_registries(next_token, PAGE_LIMIT) registries = list_registries_response["registries"] # ...
calls schemas api to fetch registries. Two CLI pages are fetched at a time.
_fetch_available_registries
python
aws/aws-sam-cli
samcli/commands/init/interactive_event_bridge_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_event_bridge_flow.py
Apache-2.0
def _construct_cli_page(items, item_per_page): """Responsible for splitting items into CLI pages. Currently CLI pages are list of dictionary [0:{0:s1, 1:s2: 3:s3}, 1: {4:s4, 5:s5: 6:s6}] We maintain the page detail and item index details.""" pages = [ items[i * item_per_page : (i + 1) * item_per...
Responsible for splitting items into CLI pages. Currently CLI pages are list of dictionary [0:{0:s1, 1:s2: 3:s3}, 1: {4:s4, 5:s5: 6:s6}] We maintain the page detail and item index details.
_construct_cli_page
python
aws/aws-sam-cli
samcli/commands/init/interactive_event_bridge_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_event_bridge_flow.py
Apache-2.0
def do_interactive( location, pt_explicit, package_type, runtime, architecture, base_image, dependency_manager, output_dir, name, app_template, no_input, tracing, application_insights, structured_logging, ): """ Implementation of the ``cli`` method when --...
Implementation of the ``cli`` method when --interactive is provided. It will ask customers a few questions to init a template.
do_interactive
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def generate_application( location, pt_explicit, package_type, runtime, architecture, base_image, dependency_manager, output_dir, name, app_template, no_input, location_opt_choice, tracing, application_insights, structured_logging, ): # pylint: disable=too-ma...
The method holds the decision logic for generating an application Parameters ---------- location : str Location to SAM template pt_explicit : bool boolean representing if the customer explicitly stated packageType package_type : str Zip or Image runtime : str ...
generate_application
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def _get_latest_python_runtime() -> str: """ Returns the latest support version of Python SAM CLI supports Returns ------- str: The name of the latest Python runtime (ex. "python3.12") """ latest_major = 0 latest_minor = 0 compiled_regex = re.compile(r"python(.*?)\.(.*)...
Returns the latest support version of Python SAM CLI supports Returns ------- str: The name of the latest Python runtime (ex. "python3.12")
_get_latest_python_runtime
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def _generate_default_hello_world_application( use_case: str, package_type: Optional[str], runtime: Optional[str], base_image: Optional[str], dependency_manager: Optional[str], pt_explicit: bool, ) -> Tuple: """ Generate the default Hello World template if Hello World Example is selected...
Generate the default Hello World template if Hello World Example is selected Parameters ---------- use_case : str Type of template example selected package_type : Optional[str] The package type, 'Zip' or 'Image', see samcli/lib/utils/packagetype.py runtime : Optional[str] ...
_generate_default_hello_world_application
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def _get_app_template_properties( preprocessed_options: dict, use_case: str, base_image: Optional[str], template_properties: Tuple ) -> Tuple: """ This is the heart of the interactive flow, this method fetchs the templates options needed to generate a template Parameters ---------- preprocessed...
This is the heart of the interactive flow, this method fetchs the templates options needed to generate a template Parameters ---------- preprocessed_options : dict Preprocessed manifest from https://github.com/aws/aws-sam-cli-app-templates use_case : Optional[str] Type of template ...
_get_app_template_properties
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def prompt_user_to_enable_tracing(): """ Prompt user to if X-Ray Tracing should activated for functions in the SAM template and vice versa """ if click.confirm("\nWould you like to enable X-Ray tracing on the function(s) in your application? "): doc_link = "https://aws.amazon.com/xray/pricing/" ...
Prompt user to if X-Ray Tracing should activated for functions in the SAM template and vice versa
prompt_user_to_enable_tracing
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def prompt_user_to_enable_application_insights(): """ Prompt user to choose if AppInsights monitoring should be enabled for their application and vice versa """ doc_link = "https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-application-insights.html" if click.confirm( ...
Prompt user to choose if AppInsights monitoring should be enabled for their application and vice versa
prompt_user_to_enable_application_insights
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def prompt_user_to_enable_structured_logging(): """ Prompt user to choose if structured loggingConfig should activated for their functions in the SAM template and vice versa """ if click.confirm("\nWould you like to set Structured Logging in JSON format on your Lambda functions? "): doc_link...
Prompt user to choose if structured loggingConfig should activated for their functions in the SAM template and vice versa
prompt_user_to_enable_structured_logging
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def generate_summary_message( package_type, runtime, base_image, dependency_manager, output_dir, name, app_template, architecture ): """ Parameters ---------- package_type : str The package type, 'Zip' or 'Image', see samcli/lib/utils/packagetype.py runtime : str AWS Lambda funct...
Parameters ---------- package_type : str The package type, 'Zip' or 'Image', see samcli/lib/utils/packagetype.py runtime : str AWS Lambda function runtime base_image : str base image dependency_manager : str dependency manager output_dir : str the dir...
generate_summary_message
python
aws/aws-sam-cli
samcli/commands/init/interactive_init_flow.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/init/interactive_init_flow.py
Apache-2.0
def cli(): """ Get local and deployed state of serverless application. """
Get local and deployed state of serverless application.
cli
python
aws/aws-sam-cli
samcli/commands/list/list.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/list.py
Apache-2.0
def consume(self, data: Dict[Any, Any]) -> None: """ Outputs the data in a table format Parameters ---------- data: Dict[Any, Any] The data to be outputted """ @pprint_column_names( format_string=data["format_string"], format_k...
Outputs the data in a table format Parameters ---------- data: Dict[Any, Any] The data to be outputted
consume
python
aws/aws-sam-cli
samcli/commands/list/table_consumer.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/table_consumer.py
Apache-2.0
def print_table_rows(**kwargs): """ Prints the rows of the table based on the data provided """ for entry in data["data"]: pprint_columns( columns=entry, width=kwargs["width"], margin=kwargs["marg...
Prints the rows of the table based on the data provided
print_table_rows
python
aws/aws-sam-cli
samcli/commands/list/table_consumer.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/table_consumer.py
Apache-2.0
def init_clients(self) -> None: """ Initialize the clients being used by sam list. """ from boto3 import Session if not self.region: session = Session() self.region = session.region_name client_provider = get_boto_client_provider_with_config(regi...
Initialize the clients being used by sam list.
init_clients
python
aws/aws-sam-cli
samcli/commands/list/cli_common/list_common_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/cli_common/list_common_context.py
Apache-2.0
def cli(self, parameter_overrides, stack_name, output, template_file, save_params, config_file, config_env): """ `sam list endpoints` command entry point """ do_cli( parameter_overrides=parameter_overrides, stack_name=stack_name, output=output, region=self.region, ...
`sam list endpoints` command entry point
cli
python
aws/aws-sam-cli
samcli/commands/list/endpoints/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/endpoints/command.py
Apache-2.0
def __init__( self, stack_name: str, output: str, region: Optional[str], profile: Optional[str], template_file: Optional[str], parameter_overrides: Optional[dict] = None, ): """ Parameters ---------- stack_name: str ...
Parameters ---------- stack_name: str The name of the stack output: str The format of the output, either json or table region: Optional[str] The region of the stack profile: Optional[str] Optional profile to be used ...
__init__
python
aws/aws-sam-cli
samcli/commands/list/endpoints/endpoints_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/endpoints/endpoints_context.py
Apache-2.0
def init_clients(self) -> None: """ Initialize the clients being used by sam list. """ super().init_clients() self.iam_client = self.client_provider("iam") self.cloudcontrol_client = self.client_provider("cloudcontrol") self.apigateway_client = self.client_provide...
Initialize the clients being used by sam list.
init_clients
python
aws/aws-sam-cli
samcli/commands/list/endpoints/endpoints_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/endpoints/endpoints_context.py
Apache-2.0
def cli(self, parameter_overrides, stack_name, output, template_file, save_params, config_file, config_env): """ `sam list resources` command entry point """ do_cli( parameter_overrides=parameter_overrides, stack_name=stack_name, output=output, region=self.region, ...
`sam list resources` command entry point
cli
python
aws/aws-sam-cli
samcli/commands/list/resources/command.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/resources/command.py
Apache-2.0
def init_clients(self) -> None: """ Initialize the clients being used by sam list. """ super().init_clients() self.iam_client = self.client_provider("iam")
Initialize the clients being used by sam list.
init_clients
python
aws/aws-sam-cli
samcli/commands/list/resources/resources_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/resources/resources_context.py
Apache-2.0
def run(self) -> None: """ Get the stack outputs for a stack """ factory = MapperConsumerFactory() container = factory.create(producer=ProducersEnum.STACK_OUTPUTS_PRODUCER, output=self.output) producer = StackOutputsProducer( stack_name=self.stack_name, ...
Get the stack outputs for a stack
run
python
aws/aws-sam-cli
samcli/commands/list/stack_outputs/stack_outputs_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/list/stack_outputs/stack_outputs_context.py
Apache-2.0
def cli(): """ Run your Serverless application locally for quick development & testing """
Run your Serverless application locally for quick development & testing
cli
python
aws/aws-sam-cli
samcli/commands/local/local.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/local.py
Apache-2.0
def __init__( self, # pylint: disable=R0914 template_file: str, function_identifier: Optional[str] = None, env_vars_file: Optional[str] = None, docker_volume_basedir: Optional[str] = None, docker_network: Optional[str] = None, log_file: Optional[str] = None, ...
Initialize the context Parameters ---------- template_file str Name or path to template function_identifier str Identifier of the function to invoke env_vars_file str Path to a file containing values for environment variables ...
__init__
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0
def __enter__(self) -> "InvokeContext": """ Performs some basic checks and returns itself when everything is ready to invoke a Lambda function. :returns InvokeContext: Returns this object """ self._stacks = self._get_stacks() _function_providers_class: Dict[ContainersM...
Performs some basic checks and returns itself when everything is ready to invoke a Lambda function. :returns InvokeContext: Returns this object
__enter__
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0
def _initialize_all_functions_containers(self) -> None: """ Create and run a container for each available lambda function """ LOG.info("Initializing the lambda functions containers.") def initialize_function_container(function: Function) -> None: function_config = se...
Create and run a container for each available lambda function
_initialize_all_functions_containers
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0
def _add_account_id_to_global(self) -> None: """ Attempts to get the Account ID from the current session If there is no current session, the standard parameter override for AWS::AccountId is used """ client_provider = get_boto_client_provider_with_config(region=self._aws_...
Attempts to get the Account ID from the current session If there is no current session, the standard parameter override for AWS::AccountId is used
_add_account_id_to_global
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0
def function_identifier(self) -> str: """ Returns identifier of the function to invoke. If no function identifier is provided, this method will return logicalID of the only function from the template :return string: Name of the function :raises InvokeContextException: If functio...
Returns identifier of the function to invoke. If no function identifier is provided, this method will return logicalID of the only function from the template :return string: Name of the function :raises InvokeContextException: If function identifier is not provided
function_identifier
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0
def local_lambda_runner(self) -> LocalLambdaRunner: """ Returns an instance of the runner capable of running Lambda functions locally :return samcli.commands.local.lib.local_lambda.LocalLambdaRunner: Runner configured to run Lambda functions locally """ if self._loca...
Returns an instance of the runner capable of running Lambda functions locally :return samcli.commands.local.lib.local_lambda.LocalLambdaRunner: Runner configured to run Lambda functions locally
local_lambda_runner
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0
def stdout(self) -> StreamWriter: """ Returns stream writer for stdout to output Lambda function logs to Returns ------- samcli.lib.utils.stream_writer.StreamWriter Stream writer for stdout """ stream = self._log_file_handle if self._log_file_handle e...
Returns stream writer for stdout to output Lambda function logs to Returns ------- samcli.lib.utils.stream_writer.StreamWriter Stream writer for stdout
stdout
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0
def stderr(self) -> StreamWriter: """ Returns stream writer for stderr to output Lambda function errors to Returns ------- samcli.lib.utils.stream_writer.StreamWriter Stream writer for stderr """ stream = self._log_file_handle if self._log_file_handle...
Returns stream writer for stderr to output Lambda function errors to Returns ------- samcli.lib.utils.stream_writer.StreamWriter Stream writer for stderr
stderr
python
aws/aws-sam-cli
samcli/commands/local/cli_common/invoke_context.py
https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/invoke_context.py
Apache-2.0