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 get_last_event_time(self, stack_name, default_time=time.time()):
"""
Finds the last event time stamp that presents for the stack, if not return the default_time
:param stack_name: Name or ID of the stack
:param default_time: the default unix epoch time to be returned in case if the s... |
Finds the last event time stamp that presents for the stack, if not return the default_time
:param stack_name: Name or ID of the stack
:param default_time: the default unix epoch time to be returned in case if the stack provided does not exist
:return: unix epoch
| get_last_event_time | python | aws/aws-sam-cli | samcli/lib/deploy/deployer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/deploy/deployer.py | Apache-2.0 |
def describe_stack_events(
self, stack_name: str, time_stamp_marker: float, on_failure: FailureMode = FailureMode.ROLLBACK, **kwargs
):
"""
Calls CloudFormation to get current stack events
:param stack_name: Name or ID of the stack
:param time_stamp_marker: last event time on... |
Calls CloudFormation to get current stack events
:param stack_name: Name or ID of the stack
:param time_stamp_marker: last event time on the stack to start streaming events from.
:param on_failure: The action to take if the stack fails to deploy
:param kwargs: Other arguments to... | describe_stack_events | python | aws/aws-sam-cli | samcli/lib/deploy/deployer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/deploy/deployer.py | Apache-2.0 |
def wait_for_execute(
self,
stack_name: str,
stack_operation: str,
disable_rollback: bool,
on_failure: FailureMode = FailureMode.ROLLBACK,
time_stamp_marker: float = 0,
max_wait_duration: int = 60,
) -> None:
"""
Wait for stack operation to exe... |
Wait for stack operation to execute and return when execution completes.
If the stack has "Outputs," they will be printed.
Parameters
----------
stack_name : str
The name of the stack
stack_operation : str
The type of the stack operation, 'CREATE... | wait_for_execute | python | aws/aws-sam-cli | samcli/lib/deploy/deployer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/deploy/deployer.py | Apache-2.0 |
def sync(
self,
stack_name: str,
cfn_template: str,
parameter_values: List[Dict],
capabilities: Optional[List[str]],
role_arn: Optional[str],
notification_arns: Optional[List[str]],
s3_uploader: Optional[S3Uploader],
tags: Optional[Dict],
o... |
Call the sync command to directly update stack or create stack
Parameters
----------
:param stack_name: The name of the stack
:param cfn_template: CloudFormation template string
:param parameter_values: Template parameters object
:param capabilities: Array of ca... | sync | python | aws/aws-sam-cli | samcli/lib/deploy/deployer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/deploy/deployer.py | Apache-2.0 |
def rollback_delete_stack(self, stack_name: str):
"""
Try to rollback the stack to a sucessful state, if there is no good state then delete the stack
Parameters
----------
:param stack_name: str
The name of the stack
"""
kwargs = {
"StackN... |
Try to rollback the stack to a sucessful state, if there is no good state then delete the stack
Parameters
----------
:param stack_name: str
The name of the stack
| rollback_delete_stack | python | aws/aws-sam-cli | samcli/lib/deploy/deployer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/deploy/deployer.py | Apache-2.0 |
def _get_stack_status(self, stack_name: str) -> str:
"""
Returns the status of the stack
Parameters
----------
:param stack_name: str
The name of the stack
Parameters
----------
:return: str
A string representing the status of the... |
Returns the status of the stack
Parameters
----------
:param stack_name: str
The name of the stack
Parameters
----------
:return: str
A string representing the status of the stack
| _get_stack_status | python | aws/aws-sam-cli | samcli/lib/deploy/deployer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/deploy/deployer.py | Apache-2.0 |
def _rollback_wait(self, stack_name: str, wait_time: int = 30, max_retries: int = 120):
"""
Manual waiter for rollback status, waits until we get *_ROLLBACK_COMPLETE or ROLLBACK_FAILED
Parameters
----------
:param stack_name: str
The name of the stack
:param ... |
Manual waiter for rollback status, waits until we get *_ROLLBACK_COMPLETE or ROLLBACK_FAILED
Parameters
----------
:param stack_name: str
The name of the stack
:param wait_time: int
The time to wait between polls, default 30 seconds
:param max_re... | _rollback_wait | python | aws/aws-sam-cli | samcli/lib/deploy/deployer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/deploy/deployer.py | Apache-2.0 |
def stream_progress(self, logs: docker.APIClient.logs):
"""
Stream progress from docker push logs and move the cursor based on the log id.
:param logs: generator from docker_clent.APIClient.logs
"""
ids: Dict[str, int] = dict()
for log in logs:
_id = log.get("... |
Stream progress from docker push logs and move the cursor based on the log id.
:param logs: generator from docker_clent.APIClient.logs
| stream_progress | python | aws/aws-sam-cli | samcli/lib/docker/log_streamer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/docker/log_streamer.py | Apache-2.0 |
def _stream_write(self, _id: str, status: str, stream: str, progress: str, error: str):
"""
Write stream information to stderr, if the stream information contains a log id,
use the carriage return character to rewrite that particular line.
:param _id: docker log id
:param status:... |
Write stream information to stderr, if the stream information contains a log id,
use the carriage return character to rewrite that particular line.
:param _id: docker log id
:param status: docker log status
:param stream: stream, usually stderr
:param progress: docker lo... | _stream_write | python | aws/aws-sam-cli | samcli/lib/docker/log_streamer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/docker/log_streamer.py | Apache-2.0 |
def launch(self, url: str):
"""
Launch a browser session (or open an existing tab by default) for a given URL
Parameters
----------
url: str
The URL string to open in the browser
Raises
------
BrowserConfigurationError
"""
o... |
Launch a browser session (or open an existing tab by default) for a given URL
Parameters
----------
url: str
The URL string to open in the browser
Raises
------
BrowserConfigurationError
| launch | python | aws/aws-sam-cli | samcli/lib/docs/browser_configuration.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/docs/browser_configuration.py | Apache-2.0 |
def __init__(self, browser: BrowserConfiguration, command: str):
"""
Constructor for instantiating a Documentation object
Parameters
----------
browser: BrowserConfiguration
Configuration for a browser object used to launch docs pages
command: str
... |
Constructor for instantiating a Documentation object
Parameters
----------
browser: BrowserConfiguration
Configuration for a browser object used to launch docs pages
command: str
String name of the command for which to find documentation
| __init__ | python | aws/aws-sam-cli | samcli/lib/docs/documentation.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/docs/documentation.py | Apache-2.0 |
def transform(self, tags, values_to_sub):
"""
transform (if needed) values_to_sub with given tags
Parameters
----------
tags: dict
the values of a particular event that can be substituted
within the event json
values_to_sub: dict
key/v... |
transform (if needed) values_to_sub with given tags
Parameters
----------
tags: dict
the values of a particular event that can be substituted
within the event json
values_to_sub: dict
key/value pairs that will be substituted into the json
... | transform | python | aws/aws-sam-cli | samcli/lib/generated_sample_events/events.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/generated_sample_events/events.py | Apache-2.0 |
def transform_val(self, properties, val):
"""
transform (if needed) given val with given properties
Parameters
----------
properties: dict
set of properties to be used for transformation
val: string
the value to undergo transformation
Retu... |
transform (if needed) given val with given properties
Parameters
----------
properties: dict
set of properties to be used for transformation
val: string
the value to undergo transformation
Returns
-------
transformed
t... | transform_val | python | aws/aws-sam-cli | samcli/lib/generated_sample_events/events.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/generated_sample_events/events.py | Apache-2.0 |
def encode(encoding_scheme: str, val: str) -> str:
"""
encodes a given val with given encoding scheme
Parameters
----------
encoding_scheme: string
the encoding scheme
val: string
the value to be encoded
Returns
-------
enc... |
encodes a given val with given encoding scheme
Parameters
----------
encoding_scheme: string
the encoding scheme
val: string
the value to be encoded
Returns
-------
encoded: string
the encoded value
| encode | python | aws/aws-sam-cli | samcli/lib/generated_sample_events/events.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/generated_sample_events/events.py | Apache-2.0 |
def hash(hashing_scheme: str, val: str) -> str:
"""
hashes a given val using given hashing_scheme
Parameters
----------
hashing_scheme: string
the hashing scheme
val: string
the value to be hashed
Returns
-------
hashed: st... |
hashes a given val using given hashing_scheme
Parameters
----------
hashing_scheme: string
the hashing scheme
val: string
the value to be hashed
Returns
-------
hashed: string
the hashed value
| hash | python | aws/aws-sam-cli | samcli/lib/generated_sample_events/events.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/generated_sample_events/events.py | Apache-2.0 |
def generate_event(self, service_name: str, event_type: str, values_to_sub: Dict) -> str:
"""
opens the event json, substitutes the values in, and
returns the customized event json
Parameters
----------
service_name: string
name of the top level service (S3, ... |
opens the event json, substitutes the values in, and
returns the customized event json
Parameters
----------
service_name: string
name of the top level service (S3, apigateway, etc)
event_type: string
name of the event underneath the service
... | generate_event | python | aws/aws-sam-cli | samcli/lib/generated_sample_events/events.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/generated_sample_events/events.py | Apache-2.0 |
def __init__(self, package_dir: Path):
"""
Parameters
----------
package_dir: Path
The path of the hook package directory
"""
self._package_dir = package_dir
config_loc = package_dir / self.CONFIG_FILENAME
if not config_loc.is_file():
... |
Parameters
----------
package_dir: Path
The path of the hook package directory
| __init__ | python | aws/aws-sam-cli | samcli/lib/hook/hook_config.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/hook/hook_config.py | Apache-2.0 |
def prepare(
self,
output_dir_path: str,
iac_project_path: Optional[str] = None,
debug: bool = False,
aws_profile: Optional[str] = None,
aws_region: Optional[str] = None,
skip_prepare_infra: bool = False,
plan_file: Optional[str] = None,
project_ro... |
Run the prepare hook to generate the IaC Metadata file.
Parameters
----------
output_dir_path: str
the path where the hook can create the generated Metadata files. Required
iac_project_path: str
the path where the hook can find the TF application. Defaul... | prepare | python | aws/aws-sam-cli | samcli/lib/hook/hook_wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/hook/hook_wrapper.py | Apache-2.0 |
def _load_hook_package(self, hook_name: str) -> None:
"""Find and load hook package config with given hook name
Parameters
----------
hook_name: str
Hook name
"""
# locate hook package from internal first
LOG.debug("Looking for internal hook package")... | Find and load hook package config with given hook name
Parameters
----------
hook_name: str
Hook name
| _load_hook_package | python | aws/aws-sam-cli | samcli/lib/hook/hook_wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/hook/hook_wrapper.py | Apache-2.0 |
def _execute(self, functionality_key: str, params: Optional[Dict] = None) -> Dict:
"""
Execute a functionality with given key
Parameters
----------
functionality_key: str
The key of the functionality
params: Dict
A dict of parameters to pass into ... |
Execute a functionality with given key
Parameters
----------
functionality_key: str
The key of the functionality
params: Dict
A dict of parameters to pass into the execution
Returns
-------
Dict
the output from the ex... | _execute | python | aws/aws-sam-cli | samcli/lib/hook/hook_wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/hook/hook_wrapper.py | Apache-2.0 |
def _execute_as_module(module: str, method: str, params: Optional[Dict] = None) -> Dict:
"""
Execute a module/method with given module and given method
Parameters
----------
module: str
the module where the method lives in
method: str
the name of the method to execute
params... |
Execute a module/method with given module and given method
Parameters
----------
module: str
the module where the method lives in
method: str
the name of the method to execute
params: Dict
A dict of parameters to pass into the execution
Returns
-------
Dict... | _execute_as_module | python | aws/aws-sam-cli | samcli/lib/hook/hook_wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/hook/hook_wrapper.py | Apache-2.0 |
def get_available_hook_packages_ids() -> List[str]:
"""
return a list of available hook names.
Returns
-------
List
The available hook names.
"""
LOG.debug("Return available internal hook packages")
hook_packages_ids = []
for child in INTERNAL_PACKAGES_ROOT.iterdir():
... |
return a list of available hook names.
Returns
-------
List
The available hook names.
| get_available_hook_packages_ids | python | aws/aws-sam-cli | samcli/lib/hook/hook_wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/hook/hook_wrapper.py | Apache-2.0 |
def __init__(
self,
asset_id: Optional[str] = None,
repository_name: Optional[str] = None,
registry: Optional[str] = None,
image_tag: Optional[str] = None,
source_local_image: Optional[str] = None,
source_path: Optional[str] = None,
docker_file_name: Optio... |
image uri = <registry>/repository_name:image_tag
registry = aws_account_id.dkr.ecr.us-west-2.amazonaws.com
| __init__ | python | aws/aws-sam-cli | samcli/lib/iac/plugins_interfaces.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/iac/plugins_interfaces.py | Apache-2.0 |
def is_cdk_project(template: Dict) -> bool:
"""
Check if the CFN template was produced from a CDK project
Parameters
----------
template:
CFN template to look through
"""
resources = template.get("Resources", {}) if template else {}
cdk_project_conditions = any(
[
... |
Check if the CFN template was produced from a CDK project
Parameters
----------
template:
CFN template to look through
| is_cdk_project | python | aws/aws-sam-cli | samcli/lib/iac/cdk/utils.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/iac/cdk/utils.py | Apache-2.0 |
def _resource_level_metadata_exists(resources: Dict) -> bool:
"""
Check if there is a AWS::CDK::Metadata resource is in the resources
Parameters
----------
resources:
Dict of resources to look through
"""
for _, resource in resources.items():
if resource.get("Type", "") == ... |
Check if there is a AWS::CDK::Metadata resource is in the resources
Parameters
----------
resources:
Dict of resources to look through
| _resource_level_metadata_exists | python | aws/aws-sam-cli | samcli/lib/iac/cdk/utils.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/iac/cdk/utils.py | Apache-2.0 |
def _cdk_path_metadata_exists(resources: Dict) -> bool:
"""
Check if there is an aws:cdk:path property in the metadata of any of the resources
Parameters
----------
resources:
Dict of resources to look through
"""
for _, resource in resources.items():
metadata = resource.ge... |
Check if there is an aws:cdk:path property in the metadata of any of the resources
Parameters
----------
resources:
Dict of resources to look through
| _cdk_path_metadata_exists | python | aws/aws-sam-cli | samcli/lib/iac/cdk/utils.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/iac/cdk/utils.py | Apache-2.0 |
def _relevant_cdk_files_are_present() -> bool:
"""
Check if there are CDK files in the cwd
"""
relevant_cdk_files = ["manifest.json", "tree.json", "cdk.json"]
# In case a customer runs `cdk synth --no-staging > template.yaml` the template
# will be in the project root and it's entirely possible ... |
Check if there are CDK files in the cwd
| _relevant_cdk_files_are_present | python | aws/aws-sam-cli | samcli/lib/iac/cdk/utils.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/iac/cdk/utils.py | Apache-2.0 |
def generate_non_cookiecutter_project(location, output_dir):
"""
Uses Cookiecutter APIs to download a project at given ``location`` to the ``output_dir``.
This does *not* run cookiecutter on the downloaded project.
Parameters
----------
location : str
Path to where the project is. This ... |
Uses Cookiecutter APIs to download a project at given ``location`` to the ``output_dir``.
This does *not* run cookiecutter on the downloaded project.
Parameters
----------
location : str
Path to where the project is. This supports all formats of location cookiecutter supports
(ex: ... | generate_non_cookiecutter_project | python | aws/aws-sam-cli | samcli/lib/init/arbitrary_project.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/arbitrary_project.py | Apache-2.0 |
def _download_and_copy(download_fn, output_dir):
"""
Runs the download function to download files into a temporary directory and then copy the files over to
the ``output_dir``
Parameters
----------
download_fn : function
Method to be called to download. It needs to accept a parameter ca... |
Runs the download function to download files into a temporary directory and then copy the files over to
the ``output_dir``
Parameters
----------
download_fn : function
Method to be called to download. It needs to accept a parameter called `clone_to_dir`. This will be
set to the tem... | _download_and_copy | python | aws/aws-sam-cli | samcli/lib/init/arbitrary_project.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/arbitrary_project.py | Apache-2.0 |
def _write_defaults(self, defaults: List[Default]) -> None:
"""
Helper method to create a default samconfig property.
Parameters
----------
defaults: List[Default]
A list of default properties for a specific command to be written to the samconfig file
command... |
Helper method to create a default samconfig property.
Parameters
----------
defaults: List[Default]
A list of default properties for a specific command to be written to the samconfig file
command: List[str]
List of strings representing the command to be ... | _write_defaults | python | aws/aws-sam-cli | samcli/lib/init/default_samconfig.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/default_samconfig.py | Apache-2.0 |
def generate_project(
location=None,
package_type=None,
runtime=None,
dependency_manager=None,
output_dir=".",
name=None,
no_input=False,
extra_context=None,
tracing=False,
application_insights=False,
structured_logging=False,
):
"""Generates project using cookiecutter an... | Generates project using cookiecutter and options given
Generate project scaffolds a project using default templates if user
doesn't provide one via location parameter. Default templates are
automatically chosen depending on runtime given by the user.
Parameters
----------
location: Path, optio... | generate_project | python | aws/aws-sam-cli | samcli/lib/init/__init__.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/__init__.py | Apache-2.0 |
def _create_default_samconfig(package_type: str, output_dir: str, name: str) -> None:
"""
Init post-processing function to create a default samconfig.toml
file and place it into the cookie cutter project.
Parameters
----------
package_type: str
string representing the package type, 'Zip... |
Init post-processing function to create a default samconfig.toml
file and place it into the cookie cutter project.
Parameters
----------
package_type: str
string representing the package type, 'Zip' or 'Image', see samcli/lib/utils/packagetype.py
output_dir: str
string represen... | _create_default_samconfig | python | aws/aws-sam-cli | samcli/lib/init/__init__.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/__init__.py | Apache-2.0 |
def inside_dir(dirpath):
"""
Execute code from inside the given directory
:param dirpath: String, path of the directory the command is being run.
"""
old_path = os.getcwd()
try:
os.chdir(dirpath)
yield
finally:
os.chdir(old_path) |
Execute code from inside the given directory
:param dirpath: String, path of the directory the command is being run.
| inside_dir | python | aws/aws-sam-cli | samcli/lib/init/templates/cookiecutter-aws-sam-hello-golang/tests/test_bake_project.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/templates/cookiecutter-aws-sam-hello-golang/tests/test_bake_project.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function
Parameters
----------
event: dict, required
API Gateway Lambda Proxy Input Format
Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-fo... | Sample pure Lambda function
Parameters
----------
event: dict, required
API Gateway Lambda Proxy Input Format
Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format
context: object,... | lambda_handler | python | aws/aws-sam-cli | samcli/lib/init/templates/cookiecutter-aws-sam-hello-python/{{cookiecutter.project_name}}/hello_world/app.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/templates/cookiecutter-aws-sam-hello-python/{{cookiecutter.project_name}}/hello_world/app.py | Apache-2.0 |
def modify_template(self):
"""
This method modifies the template by first added the new field to the template
and then run a sanity check on the template to know if the template matches the
CFN yaml
"""
self._update_template_fields()
self._write(self.template)
... |
This method modifies the template by first added the new field to the template
and then run a sanity check on the template to know if the template matches the
CFN yaml
| modify_template | python | aws/aws-sam-cli | samcli/lib/init/template_modifiers/cli_template_modifier.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/template_modifiers/cli_template_modifier.py | Apache-2.0 |
def _sanity_check(self) -> bool:
"""
Conducts sanity check on template using yaml parser to ensure the updated template meets
CFN template criteria
Returns
-------
bool
True if templates passes sanity check else False
"""
try:
pars... |
Conducts sanity check on template using yaml parser to ensure the updated template meets
CFN template criteria
Returns
-------
bool
True if templates passes sanity check else False
| _sanity_check | python | aws/aws-sam-cli | samcli/lib/init/template_modifiers/cli_template_modifier.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/template_modifiers/cli_template_modifier.py | Apache-2.0 |
def _update_template_fields(self):
"""
Add new field to SAM template
"""
if self.template.get(self.GLOBALS):
template_globals = self.template.get(self.GLOBALS)
function_globals = template_globals.get(self.FUNCTION, {})
if not function_globals:
... |
Add new field to SAM template
| _update_template_fields | python | aws/aws-sam-cli | samcli/lib/init/template_modifiers/structured_logging_template_modifier.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/template_modifiers/structured_logging_template_modifier.py | Apache-2.0 |
def _update_template_fields(self):
"""
Add new field to SAM template
"""
if self.template.get(self.GLOBALS):
template_globals = self.template.get(self.GLOBALS)
function_globals = template_globals.get(self.FUNCTION, {})
if not function_globals:
... |
Add new field to SAM template
| _update_template_fields | python | aws/aws-sam-cli | samcli/lib/init/template_modifiers/xray_tracing_template_modifier.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/init/template_modifiers/xray_tracing_template_modifier.py | Apache-2.0 |
def __init__(
self, template=None, logical_id_translator=None, default_type_resolver=None, common_attribute_resolver=None
):
"""
Initializes the Intrinsic Symbol Table so that runtime attributes can be resolved.
The code is defaulted in the following order logical_id_translator => p... |
Initializes the Intrinsic Symbol Table so that runtime attributes can be resolved.
The code is defaulted in the following order logical_id_translator => parameters => default_type_resolver =>
common_attribute_resolver
If the item is a pseudo type, it will run through the logical_id_tr... | __init__ | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def resolve_symbols(self, logical_id, resource_attribute, ignore_errors=False):
"""
This function resolves all the symbols given a logical id and a resource_attribute for Fn::GetAtt and Ref.
This boils Ref into a type of Fn:GetAtt to simplify the implementation.
For example:
... |
This function resolves all the symbols given a logical id and a resource_attribute for Fn::GetAtt and Ref.
This boils Ref into a type of Fn:GetAtt to simplify the implementation.
For example:
{"Ref": "AWS::REGION"} => resolve_symbols("AWS::REGION", "REF")
{"Fn::GetAtt": ... | resolve_symbols | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def arn_resolver(self, logical_id, service_name="lambda"):
"""
This function resolves Arn in the format
arn:{partition_name}:{service_name}:{aws_region}:{account_id}:{function_name}
Parameters
-----------
logical_id: str
This the reference to the function... |
This function resolves Arn in the format
arn:{partition_name}:{service_name}:{aws_region}:{account_id}:{function_name}
Parameters
-----------
logical_id: str
This the reference to the function name used
service_name: str
This is the service n... | arn_resolver | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def _get_function_name(self, logical_id):
"""
This function returns the function name associated with the logical ID.
If the template doesn't define a FunctionName, it will just return the
logical ID, which is the default function name.
Parameters
-----------
log... |
This function returns the function name associated with the logical ID.
If the template doesn't define a FunctionName, it will just return the
logical ID, which is the default function name.
Parameters
-----------
logical_id: str
This the reference to the fu... | _get_function_name | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def get_translation(self, logical_id, resource_attributes=IntrinsicResolver.REF):
"""
This gets the logical_id_translation of the logical id and resource_attributes.
Parameters
----------
logical_id: str
This is the logical id of the resource in question
reso... |
This gets the logical_id_translation of the logical id and resource_attributes.
Parameters
----------
logical_id: str
This is the logical id of the resource in question
resource_attributes: str
This is the attribute required. By default, it is a REF type... | get_translation | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def handle_pseudo_region(self):
"""
Gets the region from the environment and defaults to a the default region from the global variables.
This is only run if it is not specified by the logical_id_translator as a default.
Return
-------
The region from the environment or ... |
Gets the region from the environment and defaults to a the default region from the global variables.
This is only run if it is not specified by the logical_id_translator as a default.
Return
-------
The region from the environment or a default one
| handle_pseudo_region | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def handle_pseudo_url_prefix(self):
"""
This gets the AWS::UrlSuffix for the intrinsic with the china and regular prefix.
This is only run if it is not specified by the logical_id_translator as a default.
Return
-------
The url prefix of amazonaws.com or amazonaws.com.cn... |
This gets the AWS::UrlSuffix for the intrinsic with the china and regular prefix.
This is only run if it is not specified by the logical_id_translator as a default.
Return
-------
The url prefix of amazonaws.com or amazonaws.com.cn
| handle_pseudo_url_prefix | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def handle_pseudo_partition(self):
"""
This resolves AWS::Partition so that the correct partition is returned depending on the region.
This is only run if it is not specified by the logical_id_translator as a default.
Return
-------
A pseudo partition like aws-cn or aws... |
This resolves AWS::Partition so that the correct partition is returned depending on the region.
This is only run if it is not specified by the logical_id_translator as a default.
Return
-------
A pseudo partition like aws-cn or aws or aws-gov
| handle_pseudo_partition | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsics_symbol_table.py | Apache-2.0 |
def __init__(self, template, symbol_resolver):
"""
Initializes the Intrinsic Property class with the default intrinsic_key_function_map and
conditional_key_function_map.
In the future, for items like Fn::ImportValue multiple templates can be provided
into the function.
"... |
Initializes the Intrinsic Property class with the default intrinsic_key_function_map and
conditional_key_function_map.
In the future, for items like Fn::ImportValue multiple templates can be provided
into the function.
| __init__ | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def default_intrinsic_function_map(self):
"""
Returns a dictionary containing the mapping from
Intrinsic Function Key -> Intrinsic Resolver.
The intrinsic_resolver function has the format lambda intrinsic: some_retun_value
Return
-------
A dictionary containi... |
Returns a dictionary containing the mapping from
Intrinsic Function Key -> Intrinsic Resolver.
The intrinsic_resolver function has the format lambda intrinsic: some_retun_value
Return
-------
A dictionary containing the mapping from Intrinsic Function Key -> Intrins... | default_intrinsic_function_map | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def default_conditional_key_map(self):
"""
Returns a dictionary containing the mapping from Conditional
Conditional Intrinsic Function Key -> Conditional Intrinsic Resolver.
The intrinsic_resolver function has the format lambda intrinsic: some_retun_value
The code was split ... |
Returns a dictionary containing the mapping from Conditional
Conditional Intrinsic Function Key -> Conditional Intrinsic Resolver.
The intrinsic_resolver function has the format lambda intrinsic: some_retun_value
The code was split between conditionals and other intrinsic keys for ... | default_conditional_key_map | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def intrinsic_property_resolver(self, intrinsic, ignore_errors, parent_function="template"):
"""
This resolves the intrinsic of the format
{
intrinsic: dict
} by calling the function with the relevant intrinsic function resolver.
This also supports returning a string... |
This resolves the intrinsic of the format
{
intrinsic: dict
} by calling the function with the relevant intrinsic function resolver.
This also supports returning a string, list, boolean, int since they may be intermediate steps in the recursion
process. No transform... | intrinsic_property_resolver | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def resolve_template(self, ignore_errors=False):
"""
This resolves all the attributes of the CloudFormation dictionary Resources, Outputs, Mappings, Parameters,
Conditions.
Return
-------
Return a processed template
"""
processed_template = self._template... |
This resolves all the attributes of the CloudFormation dictionary Resources, Outputs, Mappings, Parameters,
Conditions.
Return
-------
Return a processed template
| resolve_template | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def resolve_attribute(self, cloud_formation_property, ignore_errors=False):
"""
This will parse through every entry in a CloudFormation root key and resolve them based on the symbol_resolver.
Customers can optionally ignore resource errors and default to whatever the resource provides.
... |
This will parse through every entry in a CloudFormation root key and resolve them based on the symbol_resolver.
Customers can optionally ignore resource errors and default to whatever the resource provides.
Parameters
-----------
cloud_formation_property: dict
A hig... | resolve_attribute | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_base64(self, intrinsic_value, ignore_errors):
"""
{ "Fn::Base64" : valueToEncode }
This intrinsic function will then base64 encode the string using python's base64.
This function will resolve all the intrinsic properties in valueToEncode
Parameter
---------... |
{ "Fn::Base64" : valueToEncode }
This intrinsic function will then base64 encode the string using python's base64.
This function will resolve all the intrinsic properties in valueToEncode
Parameter
----------
intrinsic_value: list, dict
This is the value of t... | handle_fn_base64 | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_select(self, intrinsic_value, ignore_errors):
"""
{ "Fn::Select" : [ index, listOfObjects ] }
It will select the item in the listOfObjects using python's base64.
This intrinsic function will resolve all the objects within the function's value and check their type.
P... |
{ "Fn::Select" : [ index, listOfObjects ] }
It will select the item in the listOfObjects using python's base64.
This intrinsic function will resolve all the objects within the function's value and check their type.
Parameter
----------
intrinsic_value: list, dict
... | handle_fn_select | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_find_in_map(self, intrinsic_value, ignore_errors):
"""
{ "Fn::FindInMap" : [ "MapName", "TopLevelKey", "SecondLevelKey"] } This function will then lookup the
specified dictionary in the Mappings dictionary as mappings[map_name][top_level_key][second_level_key].
This intrinsic... |
{ "Fn::FindInMap" : [ "MapName", "TopLevelKey", "SecondLevelKey"] } This function will then lookup the
specified dictionary in the Mappings dictionary as mappings[map_name][top_level_key][second_level_key].
This intrinsic function will resolve all the objects within the function's value and ch... | handle_find_in_map | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_get_azs(self, intrinsic_value, ignore_errors):
"""
{ "Fn::GetAZs" : "" }
{ "Fn::GetAZs" : { "Ref" : "AWS::Region" } }
{ "Fn::GetAZs" : "us-east-1" }
This intrinsic function will get the availability zones specified for the specified region. This is usually used
... |
{ "Fn::GetAZs" : "" }
{ "Fn::GetAZs" : { "Ref" : "AWS::Region" } }
{ "Fn::GetAZs" : "us-east-1" }
This intrinsic function will get the availability zones specified for the specified region. This is usually used
with {"Ref": "AWS::Region"}. If it is an empty string, it will get t... | handle_fn_get_azs | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_transform(self, intrinsic_value, ignore_errors):
"""
{ "Fn::Transform" : { "Name" : macro name, "Parameters" : {key : value, ... } } }
This intrinsic function will transform the data with the body provided
This intrinsic function will resolve all the objects within the fun... |
{ "Fn::Transform" : { "Name" : macro name, "Parameters" : {key : value, ... } } }
This intrinsic function will transform the data with the body provided
This intrinsic function will resolve all the objects within the function's value and check their type.
Parameter
----------
... | handle_fn_transform | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_getatt(self, intrinsic_value, ignore_errors):
"""
{ "Fn::GetAtt" : [ "logicalNameOfResource", "attributeName" ] }
This intrinsic function gets the attribute for logical_resource specified. Each attribute might have a different
functionality depending on the type.
T... |
{ "Fn::GetAtt" : [ "logicalNameOfResource", "attributeName" ] }
This intrinsic function gets the attribute for logical_resource specified. Each attribute might have a different
functionality depending on the type.
This intrinsic function will resolve all the objects within the function... | handle_fn_getatt | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_ref(self, intrinsic_value, ignore_errors):
"""
{"Ref": "Logical ID"}
This intrinsic function gets the reference to a certain attribute. Some Ref's have different functionality with
different resource types.
This intrinsic function will resolve all the objects withi... |
{"Ref": "Logical ID"}
This intrinsic function gets the reference to a certain attribute. Some Ref's have different functionality with
different resource types.
This intrinsic function will resolve all the objects within the function's value and check their type.
This calls the ... | handle_fn_ref | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_sub(self, intrinsic_value, ignore_errors):
"""
{ "Fn::Sub" : [ String, { Var1Name: Var1Value, Var2Name: Var2Value } ] } or { "Fn::Sub" : String }
This intrinsic function will substitute the variables specified in the list into the string provided. The string
will also parse... |
{ "Fn::Sub" : [ String, { Var1Name: Var1Value, Var2Name: Var2Value } ] } or { "Fn::Sub" : String }
This intrinsic function will substitute the variables specified in the list into the string provided. The string
will also parse out pseudo properties and anything of the form ${}.
This i... | handle_fn_sub | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_if(self, intrinsic_value, ignore_errors):
"""
{"Fn::If": [condition_name, value_if_true, value_if_false]}
This intrinsic function will evaluate the condition from the Conditions dictionary and then return value_if_true
or value_if_false depending on the value.
The ... |
{"Fn::If": [condition_name, value_if_true, value_if_false]}
This intrinsic function will evaluate the condition from the Conditions dictionary and then return value_if_true
or value_if_false depending on the value.
The Conditions dictionary will have the following format:
{
... | handle_fn_if | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_equals(self, intrinsic_value, ignore_errors):
"""
{"Fn::Equals" : ["value_1", "value_2"]}
This intrinsic function will verify that both items in the intrinsic function are equal after resolving them.
This intrinsic function will resolve all the objects within the function'... |
{"Fn::Equals" : ["value_1", "value_2"]}
This intrinsic function will verify that both items in the intrinsic function are equal after resolving them.
This intrinsic function will resolve all the objects within the function's value and check their type.
Parameter
----------
... | handle_fn_equals | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_not(self, intrinsic_value, ignore_errors):
"""
{"Fn::Not": [{condition}]}
This intrinsic function will negate the evaluation of the condition specified.
This intrinsic function will resolve all the objects within the function's value and check their type.
Parameter... |
{"Fn::Not": [{condition}]}
This intrinsic function will negate the evaluation of the condition specified.
This intrinsic function will resolve all the objects within the function's value and check their type.
Parameter
----------
intrinsic_value: list, dict
T... | handle_fn_not | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def get_prefix_position_in_list(i):
"""
Gets the prefix for the string "ith element of the list", handling first, second, and third.
:param i:
:return:
"""
first, second, third = 1, 2, 3
prefix = "{} th ".format(str(i))
if i == first:
prefix = ... |
Gets the prefix for the string "ith element of the list", handling first, second, and third.
:param i:
:return:
| get_prefix_position_in_list | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_and(self, intrinsic_value, ignore_errors):
"""
{"Fn::And": [{condition}, {...}]}
This intrinsic checks that every item in the list evaluates to a boolean. The items in the list can either
be of the format {Condition: condition_name} which finds and evaluates the Conditions ... |
{"Fn::And": [{condition}, {...}]}
This intrinsic checks that every item in the list evaluates to a boolean. The items in the list can either
be of the format {Condition: condition_name} which finds and evaluates the Conditions dictionary of another
intrinsic function.
The Condi... | handle_fn_and | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def handle_fn_or(self, intrinsic_value, ignore_errors):
"""
{"Fn::Or": [{condition}, {...}]}
This intrinsic checks that a single item in the list evaluates to a boolean. The items in the list can either
be of the format {Condition: condition_name} which finds and evaluates the Conditions... |
{"Fn::Or": [{condition}, {...}]}
This intrinsic checks that a single item in the list evaluates to a boolean. The items in the list can either
be of the format {Condition: condition_name} which finds and evaluates the Conditions dictionary of another
intrinsic function.
The Con... | handle_fn_or | python | aws/aws-sam-cli | samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/intrinsic_resolver/intrinsic_property_resolver.py | Apache-2.0 |
def consume(self, data: InputType):
"""
Parameters
----------
data: TypeVar
Data for the consumer to print
""" |
Parameters
----------
data: TypeVar
Data for the consumer to print
| consume | python | aws/aws-sam-cli | samcli/lib/list/list_interfaces.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/list_interfaces.py | Apache-2.0 |
def map(self, data: InputType) -> OutputType:
"""
Parameters
----------
data: TypeVar
Data for the mapper to map
Returns
-------
Any
Mapped output given the data
""" |
Parameters
----------
data: TypeVar
Data for the mapper to map
Returns
-------
Any
Mapped output given the data
| map | python | aws/aws-sam-cli | samcli/lib/list/list_interfaces.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/list_interfaces.py | Apache-2.0 |
def produce(self):
"""
Produces the data for the mappers and consumers
""" |
Produces the data for the mappers and consumers
| produce | python | aws/aws-sam-cli | samcli/lib/list/list_interfaces.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/list_interfaces.py | Apache-2.0 |
def create(self, producer, output):
"""
Parameters
----------
producer: str
A string indicating which producer is calling the function
output: str
A string indicating the output type
Returns
-------
MapperConsumerContainer
... |
Parameters
----------
producer: str
A string indicating which producer is calling the function
output: str
A string indicating the output type
Returns
-------
MapperConsumerContainer
A container that contains a mapper and a co... | create | python | aws/aws-sam-cli | samcli/lib/list/list_interfaces.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/list_interfaces.py | Apache-2.0 |
def create(self, producer: ProducersEnum, output: str) -> MapperConsumerContainer:
"""
Creates a MapperConsumerContainer that contains the resulting mapper and consumer given
the producer and output format
Parameters
----------
producer: ProducersEnum
An enum... |
Creates a MapperConsumerContainer that contains the resulting mapper and consumer given
the producer and output format
Parameters
----------
producer: ProducersEnum
An enum representing the producers (stack-outputs, resources, or endpoints producer)
output: ... | create | python | aws/aws-sam-cli | samcli/lib/list/mapper_consumer_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/mapper_consumer_factory.py | Apache-2.0 |
def __init__(
self,
stack_name,
region,
profile,
template_file,
cloudformation_client,
iam_client,
cloudcontrol_client,
apigateway_client,
apigatewayv2_client,
mapper,
consumer,
parameter_overrides=None,
):
... |
Parameters
----------
stack_name: str
The name of the stack
region: Optional[str]
The region of the stack
profile: Optional[str]
Optional profile to be used
template_file: Optional[str]
The location of the template file. If... | __init__ | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_function_url(self, identifier: str) -> Any:
"""
Gets the function url of a Lambda Function
Parameters
----------
identifier: str
The identifier or physical ID
Returns
-------
furl: str
The function url in the form of a str... |
Gets the function url of a Lambda Function
Parameters
----------
identifier: str
The identifier or physical ID
Returns
-------
furl: str
The function url in the form of a string
| get_function_url | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_stage_list(self, api_id: str, api_type: APIGatewayEnum) -> List[Any]:
"""
Gets a list of stages for a given api of type AWS::ApiGateway::RestApi or AWS::ApiGatewayV2::Api
Parameters
----------
api_id: str
The api id or rest api id of the api
api_type:... |
Gets a list of stages for a given api of type AWS::ApiGateway::RestApi or AWS::ApiGatewayV2::Api
Parameters
----------
api_id: str
The api id or rest api id of the api
api_type: APIGatewayEnum
The type of api, AWS::ApiGateway::RestApi or AWS::ApiGatewayV... | get_stage_list | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def build_api_gw_endpoints(self, physical_id: str, stages: list) -> list:
"""
Builds the default api gateway endpoints
Parameters
----------
physical_id: str
The physical ID of the api resource
stages: list
A list of stages for the api resource
... |
Builds the default api gateway endpoints
Parameters
----------
physical_id: str
The physical ID of the api resource
stages: list
A list of stages for the api resource
Returns
-------
api_list: List[Any]
The list of de... | build_api_gw_endpoints | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_api_gateway_endpoint(
self, deployed_resource: Dict[Any, Any], custom_domain_substitute_dict: Dict[Any, Any]
) -> Any:
"""
Gets the API gateway endpoints for APIGateway and APIGatewayV2 APIs
Parameters
----------
deployed_resource: Dict[Any, Any]
... |
Gets the API gateway endpoints for APIGateway and APIGatewayV2 APIs
Parameters
----------
deployed_resource: Dict[Any, Any]
Dictionary containing the resource info of the deployed API
custom_domain_substitute_dict: Dict[Any, Any]
Dictionary containing th... | get_api_gateway_endpoint | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_cloud_endpoints(self, stacks: list) -> list:
"""
Gets a list of cloud endpoints resources
Parameters
----------
stacks: list
A list containing the local stack
Returns
-------
endpoints_list: List[Any]
A list of cloud endpo... |
Gets a list of cloud endpoints resources
Parameters
----------
stacks: list
A list containing the local stack
Returns
-------
endpoints_list: List[Any]
A list of cloud endpoints resources
| get_cloud_endpoints | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def produce(self):
"""
The producer function for the endpoints resources command
"""
sam_template = get_template_data(self.template_file)
translated_dict = self.get_translated_dict(template_file_dict=sam_template)
stacks, _ = SamLocalStackProvider.get_stacks(template_fil... |
The producer function for the endpoints resources command
| produce | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def validate_stack(stacks: list):
"""
Checks if the stack non-empty and contains stack resources and raises exceptions accordingly
Parameters
----------
stacks: list
A list containing the stack
"""
if not stacks or not hasattr(stacks[0], "resources") or not stacks[0].resources:
... |
Checks if the stack non-empty and contains stack resources and raises exceptions accordingly
Parameters
----------
stacks: list
A list containing the stack
| validate_stack | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_local_endpoints(stacks: list) -> list:
"""
Gets a list of local endpoints resources based on the local stack
Parameters
----------
stacks: list
A list containing the stack
Returns
-------
endpoints_list: list
A list containing the endpoints resources and their i... |
Gets a list of local endpoints resources based on the local stack
Parameters
----------
stacks: list
A list containing the stack
Returns
-------
endpoints_list: list
A list containing the endpoints resources and their information
| get_local_endpoints | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_api_type_enum(resource_type: str) -> APIGatewayEnum:
"""
Gets the APIGatewayEnum associated with the input resource type
Parameters
----------
resource_type: str
The type of the resource
Returns
-------
The APIGatewayEnum associated with the input resource type
"""
... |
Gets the APIGatewayEnum associated with the input resource type
Parameters
----------
resource_type: str
The type of the resource
Returns
-------
The APIGatewayEnum associated with the input resource type
| get_api_type_enum | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_custom_domain_substitute_list(
response: Dict[Any, Any], stacks: list, response_domain_dict: Dict[str, str]
) -> Dict[Any, Any]:
"""
Gets a dictionary containing the custom domain lists that map back to the original api
Parameters
----------
response: Dict[Any, Any]
The response... |
Gets a dictionary containing the custom domain lists that map back to the original api
Parameters
----------
response: Dict[Any, Any]
The response containing the cloud stack resources information
stacks: list
A list containing the local stack
response_domain_dict: Dict
... | get_custom_domain_substitute_list | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_response_domain_dict(response: Dict[Any, Any]) -> Dict[str, str]:
"""
Gets a dictionary containing the custom domains
Parameters
----------
response: Dict[Any, Any]
The response containing the cloud stack resources information
Returns
-------
response_domain_dict: Dict[... |
Gets a dictionary containing the custom domains
Parameters
----------
response: Dict[Any, Any]
The response containing the cloud stack resources information
Returns
-------
response_domain_dict: Dict[str, str]
A dict containing the custom domains
| get_response_domain_dict | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def get_methods_and_paths(logical_id: str, stack: Stack) -> list:
"""
Gets the methods and paths for apis based on the stack and the logical ID
Parameters
----------
logical_id: str
The logical ID of the api
stack: Stack
The stack to retrieve the methods and paths from
Retu... |
Gets the methods and paths for apis based on the stack and the logical ID
Parameters
----------
logical_id: str
The logical ID of the api
stack: Stack
The stack to retrieve the methods and paths from
Returns
-------
method_paths_list: list
A list containing the... | get_methods_and_paths | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_producer.py | Apache-2.0 |
def map(self, data: list) -> Dict[Any, Any]:
"""
Maps data to the format needed for consumption by the table consumer
Parameters
----------
data: list
List of dictionaries containing the entries of the endpoints data
Returns
-------
table_dat... |
Maps data to the format needed for consumption by the table consumer
Parameters
----------
data: list
List of dictionaries containing the entries of the endpoints data
Returns
-------
table_data: Dict[Any, Any]
Dictionary containing the ... | map | python | aws/aws-sam-cli | samcli/lib/list/endpoints/endpoints_to_table_mapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/endpoints/endpoints_to_table_mapper.py | Apache-2.0 |
def map(self, data: list) -> Dict[Any, Any]:
"""
Maps data to the format needed for consumption by the table consumer
Parameters
----------
data: list
List of dictionaries containing the entries of the resources data
Returns
-------
table_dat... |
Maps data to the format needed for consumption by the table consumer
Parameters
----------
data: list
List of dictionaries containing the entries of the resources data
Returns
-------
table_data: Dict[Any, Any]
Dictionary containing the ... | map | python | aws/aws-sam-cli | samcli/lib/list/resources/resources_to_table_mapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/resources/resources_to_table_mapper.py | Apache-2.0 |
def get_resources_info(self):
"""
Returns the stack resources information for the stack and raises exceptions accordingly
Returns
-------
A dictionary containing information about the stack's resources
"""
try:
all_resources = []
cfn_... |
Returns the stack resources information for the stack and raises exceptions accordingly
Returns
-------
A dictionary containing information about the stack's resources
| get_resources_info | python | aws/aws-sam-cli | samcli/lib/list/resources/resource_mapping_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/resources/resource_mapping_producer.py | Apache-2.0 |
def get_translated_dict(self, template_file_dict: Dict[Any, Any]) -> Dict[Any, Any]:
"""
Performs a sam translate on a template and returns the translated template in the form of a dictionary or
raises exceptions accordingly
Parameters
----------
template_file_dict: Dict... |
Performs a sam translate on a template and returns the translated template in the form of a dictionary or
raises exceptions accordingly
Parameters
----------
template_file_dict: Dict[Any, Any]
The template in dictionary format to be translated
Returns
... | get_translated_dict | python | aws/aws-sam-cli | samcli/lib/list/resources/resource_mapping_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/resources/resource_mapping_producer.py | Apache-2.0 |
def produce(self):
"""
Produces the resource data to be printed
"""
sam_template = get_template_data(self.template_file)
translated_dict = self.get_translated_dict(template_file_dict=sam_template)
stacks, _ = SamLocalStackProvider.get_stacks(template_file="", template_d... |
Produces the resource data to be printed
| produce | python | aws/aws-sam-cli | samcli/lib/list/resources/resource_mapping_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/resources/resource_mapping_producer.py | Apache-2.0 |
def get_stack_info(self) -> Optional[Any]:
"""
Returns the stack output information for the stack and raises exceptions accordingly
Returns
-------
A dictionary containing the stack's information
"""
try:
response = self.cloudformation_client.des... |
Returns the stack output information for the stack and raises exceptions accordingly
Returns
-------
A dictionary containing the stack's information
| get_stack_info | python | aws/aws-sam-cli | samcli/lib/list/stack_outputs/stack_outputs_producer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/stack_outputs/stack_outputs_producer.py | Apache-2.0 |
def map(self, data: list) -> Dict[Any, Any]:
"""
Maps data to the format needed for consumption by the table consumer
Parameters
----------
data: list
List of dictionaries containing the entries of the stack outputs data
Returns
-------
table... |
Maps data to the format needed for consumption by the table consumer
Parameters
----------
data: list
List of dictionaries containing the entries of the stack outputs data
Returns
-------
table_data: Dict[Any, Any]
Dictionary containing ... | map | python | aws/aws-sam-cli | samcli/lib/list/stack_outputs/stack_output_to_table_mapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/list/stack_outputs/stack_output_to_table_mapper.py | Apache-2.0 |
def __init__(self, event: InternalEventType, timestamp: int, resource_name: Optional[str] = None):
"""
Parameters
----------
event : EventType
Actual event object. This can be any type with generic definition (dict, str etc.)
timestamp : int
Timestamp of t... |
Parameters
----------
event : EventType
Actual event object. This can be any type with generic definition (dict, str etc.)
timestamp : int
Timestamp of the event
resource_name : Optional[str]
Resource name related to this event. This is option... | __init__ | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def tail(self, start_time: Optional[datetime] = None, filter_pattern: Optional[str] = None):
"""
Parameters
----------
start_time : Optional[datetime]
Optional parameter to tail information from earlier time
filter_pattern : Optional[str]
Optional paramet... |
Parameters
----------
start_time : Optional[datetime]
Optional parameter to tail information from earlier time
filter_pattern : Optional[str]
Optional parameter to filter events with given string
| tail | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def load_time_period(
self,
start_time: Optional[datetime] = None,
end_time: Optional[datetime] = None,
filter_pattern: Optional[str] = None,
):
"""
Parameters
----------
start_time : Optional[datetime]
Optional parameter to load events fro... |
Parameters
----------
start_time : Optional[datetime]
Optional parameter to load events from certain date time
end_time : Optional[datetime]
Optional parameter to load events until certain date time
filter_pattern : Optional[str]
Optional par... | load_time_period | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def load_events(self, event_ids: Union[List[Any], Dict]):
"""
This method will load specific events which is given by the event_ids parameter
Parameters
----------
event_ids : List[str] or Dict
List of event ids that will be pulled
""" |
This method will load specific events which is given by the event_ids parameter
Parameters
----------
event_ids : List[str] or Dict
List of event ids that will be pulled
| load_events | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def map(self, event: ObservabilityEventType) -> Any:
"""
Parameters
----------
event : ObservabilityEventType
Event object that will be mapped/converted to another event or any object
Returns
-------
Any
Return converted type
""" |
Parameters
----------
event : ObservabilityEventType
Event object that will be mapped/converted to another event or any object
Returns
-------
Any
Return converted type
| map | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def consume(self, event: ObservabilityEventType):
"""
Parameters
----------
event : ObservabilityEvent
Event that will be consumed
""" |
Parameters
----------
event : ObservabilityEvent
Event that will be consumed
| consume | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def __init__(self, mappers: List[ObservabilityEventMapper], consumer: ObservabilityEventConsumer):
"""
Parameters
----------
mappers : List[ObservabilityEventMapper]
List of event mappers which will be used to process events before passing to consumer
consumer : Obser... |
Parameters
----------
mappers : List[ObservabilityEventMapper]
List of event mappers which will be used to process events before passing to consumer
consumer : ObservabilityEventConsumer
Actual consumer which will handle the events after they are processed by map... | __init__ | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def tail(self, start_time: Optional[datetime] = None, filter_pattern: Optional[str] = None):
"""
Implementation of ObservabilityPuller.tail method with AsyncContext.
It will create tasks by calling tail methods of all given pullers, and execute them in async
"""
async_context = A... |
Implementation of ObservabilityPuller.tail method with AsyncContext.
It will create tasks by calling tail methods of all given pullers, and execute them in async
| tail | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
def load_time_period(
self,
start_time: Optional[datetime] = None,
end_time: Optional[datetime] = None,
filter_pattern: Optional[str] = None,
):
"""
Implementation of ObservabilityPuller.load_time_period method with AsyncContext.
It will create tasks by callin... |
Implementation of ObservabilityPuller.load_time_period method with AsyncContext.
It will create tasks by calling load_time_period methods of all given pullers, and execute them in async
| load_time_period | python | aws/aws-sam-cli | samcli/lib/observability/observability_info_puller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/observability/observability_info_puller.py | Apache-2.0 |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.