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_cwd(self) -> str:
"""
Get the working directory. This is usually relative to the directory that contains the template. If a Docker
volume location is specified, it takes preference
All Lambda function code paths are resolved relative to this working directory
:return st... |
Get the working directory. This is usually relative to the directory that contains the template. If a Docker
volume location is specified, it takes preference
All Lambda function code paths are resolved relative to this working directory
:return string: Working directory
| get_cwd | 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 _get_env_vars_value(filename: Optional[str]) -> Optional[Dict]:
"""
If the user provided a file containing values of environment variables, this method will read the file and
return its value
:param string filename: Path to file containing environment variable values
:return... |
If the user provided a file containing values of environment variables, this method will read the file and
return its value
:param string filename: Path to file containing environment variable values
:return dict: Value of environment variables, if provided. None otherwise
:rai... | _get_env_vars_value | 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 _setup_log_file(log_file: Optional[str]) -> Optional[TextIO]:
"""
Open a log file if necessary and return the file handle. This will create a file if it does not exist
:param string log_file: Path to a file where the logs should be written to
:return: Handle to the opened log file, ... |
Open a log file if necessary and return the file handle. This will create a file if it does not exist
:param string log_file: Path to a file where the logs should be written to
:return: Handle to the opened log file, if necessary. None otherwise
| _setup_log_file | 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 _get_debug_context(
debug_ports: Optional[Tuple[int]],
debug_args: Optional[str],
debugger_path: Optional[str],
container_env_vars: Optional[Dict[str, str]],
debug_function: Optional[str] = None,
) -> DebugContext:
"""
Creates a DebugContext if the InvokeC... |
Creates a DebugContext if the InvokeContext is in a debugging mode
Parameters
----------
debug_ports tuple(int)
Ports to bind the debugger to
debug_args str
Additional arguments passed to the debugger
debugger_path str
Path to the di... | _get_debug_context | 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 _get_container_manager(
docker_network: Optional[str], skip_pull_image: Optional[bool], shutdown: Optional[bool]
) -> ContainerManager:
"""
Creates a ContainerManager with specified options
Parameters
----------
docker_network str
Docker network ident... |
Creates a ContainerManager with specified options
Parameters
----------
docker_network str
Docker network identifier
skip_pull_image bool
Should the manager skip pulling the image
shutdown bool
Should SHUTDOWN events be sent when tear... | _get_container_manager | 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 get_application_dir():
"""
Returns
-------
Path
Path representing the application config directory
"""
# TODO: Get the config directory directly from `GlobalConfig`
return Path(click.get_app_dir("AWS SAM", force_posix=True)) |
Returns
-------
Path
Path representing the application config directory
| get_application_dir | python | aws/aws-sam-cli | samcli/commands/local/cli_common/options.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/options.py | Apache-2.0 |
def local_common_options(f):
"""
Common CLI options shared by "local invoke", "local start-api", and "local start-lambda" commands
:param f: Callback passed by Click
"""
local_options = [
click.option(
"--shutdown",
is_flag=True,
default=False,
... |
Common CLI options shared by "local invoke", "local start-api", and "local start-lambda" commands
:param f: Callback passed by Click
| local_common_options | python | aws/aws-sam-cli | samcli/commands/local/cli_common/options.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/options.py | Apache-2.0 |
def service_common_options(port):
"""
Construct common CLI Options that are shared for service related commands ('start-api' and 'start_lambda')
Parameters
----------
port
The port number to listen to
"""
def construct_options(f):
"""
Common CLI Options that are sha... |
Construct common CLI Options that are shared for service related commands ('start-api' and 'start_lambda')
Parameters
----------
port
The port number to listen to
| service_common_options | python | aws/aws-sam-cli | samcli/commands/local/cli_common/options.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/options.py | Apache-2.0 |
def construct_options(f):
"""
Common CLI Options that are shared for service related commands ('start-api' and 'start_lambda')
Parameters
----------
f function
Callback passed by Click
port int
port number to use
Returns
-------
... |
Common CLI Options that are shared for service related commands ('start-api' and 'start_lambda')
Parameters
----------
f function
Callback passed by Click
port int
port number to use
Returns
-------
function
The callb... | construct_options | python | aws/aws-sam-cli | samcli/commands/local/cli_common/options.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/options.py | Apache-2.0 |
def invoke_common_options(f):
"""
Common CLI options shared by "local invoke" and "local start-api" commands
:param f: Callback passed by Click
"""
invoke_options = (
[
template_click_option(),
click.option(
"--env-vars",
"-n",
... |
Common CLI options shared by "local invoke" and "local start-api" commands
:param f: Callback passed by Click
| invoke_common_options | python | aws/aws-sam-cli | samcli/commands/local/cli_common/options.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/options.py | Apache-2.0 |
def warm_containers_common_options(f):
"""
Warm containers related CLI options shared by "local start-api" and "local start_lambda" commands
:param f: Callback passed by Click
"""
warm_containers_options = [
click.option(
"--warm-containers",
help="""
\b... |
Warm containers related CLI options shared by "local start-api" and "local start_lambda" commands
:param f: Callback passed by Click
| warm_containers_common_options | python | aws/aws-sam-cli | samcli/commands/local/cli_common/options.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/cli_common/options.py | Apache-2.0 |
def cli(self):
"""
Generate an event for one of the services listed below:
""" |
Generate an event for one of the services listed below:
| cli | python | aws/aws-sam-cli | samcli/commands/local/generate_event/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/generate_event/cli.py | Apache-2.0 |
def __init__(self, events_lib: events.Events, *args, **kwargs):
"""
Constructor for the ServiceCommand class
Parameters
----------
events_lib: samcli.commands.local.lib.generated_sample_events.events
The events library that allows for CLI population and substitution
... |
Constructor for the ServiceCommand class
Parameters
----------
events_lib: samcli.commands.local.lib.generated_sample_events.events
The events library that allows for CLI population and substitution
args: list
any arguments passed in before kwargs
... | __init__ | python | aws/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/generate_event/event_generation.py | Apache-2.0 |
def get_command(self, ctx, cmd_name):
"""
gets the subcommands under the service name
Parameters
----------
ctx : Context
the context object passed into the method
cmd_name : str
the service name
Returns
-------
EventTypeSu... |
gets the subcommands under the service name
Parameters
----------
ctx : Context
the context object passed into the method
cmd_name : str
the service name
Returns
-------
EventTypeSubCommand:
returns subcommand if succe... | get_command | python | aws/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/generate_event/event_generation.py | Apache-2.0 |
def __init__(self, events_lib: events.Events, top_level_cmd_name, subcmd_definition, *args, **kwargs):
"""
constructor for the EventTypeSubCommand class
Parameters
----------
events_lib: samcli.commands.local.lib.generated_sample_events.events
The events library that... |
constructor for the EventTypeSubCommand class
Parameters
----------
events_lib: samcli.commands.local.lib.generated_sample_events.events
The events library that allows for CLI population and substitution
top_level_cmd_name: string
the service name
... | __init__ | python | aws/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/generate_event/event_generation.py | Apache-2.0 |
def get_command(self, ctx, cmd_name):
"""
gets the Click Commands underneath a service name
Parameters
----------
ctx: Context
context object passed in
cmd_name: string
the service name
Returns
-------
cmd: Click.Command
... |
gets the Click Commands underneath a service name
Parameters
----------
ctx: Context
context object passed in
cmd_name: string
the service name
Returns
-------
cmd: Click.Command
the Click Commands that can be called f... | get_command | python | aws/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/generate_event/event_generation.py | Apache-2.0 |
def cmd_implementation(
events_lib: events.Events, top_level_cmd_name: str, subcmd_name: str, *args, **kwargs
) -> str:
"""
calls for value substitution in the event json and returns the
customized json as a string
Parameters
----------
events_lib : events.Ev... |
calls for value substitution in the event json and returns the
customized json as a string
Parameters
----------
events_lib : events.Events
the Events library for generating events
top_level_cmd_name : string
the name of the service
subcm... | cmd_implementation | python | aws/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/generate_event/event_generation.py | Apache-2.0 |
def cli(
ctx,
function_logical_id,
template_file,
event,
no_event,
env_vars,
debug_port,
debug_args,
debugger_path,
container_env_vars,
docker_volume_basedir,
docker_network,
log_file,
layer_cache_basedir,
skip_pull_image,
force_image_build,
shutdown,
... |
`sam local invoke` command entry point
| cli | python | aws/aws-sam-cli | samcli/commands/local/invoke/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/invoke/cli.py | Apache-2.0 |
def do_cli( # pylint: disable=R0914
ctx,
function_identifier,
template,
event,
no_event,
env_vars,
debug_port,
debug_args,
debugger_path,
container_env_vars,
docker_volume_basedir,
docker_network,
log_file,
layer_cache_basedir,
skip_pull_image,
force_imag... |
Implementation of the ``cli`` method, just separated out for unit testing purposes
| do_cli | python | aws/aws-sam-cli | samcli/commands/local/invoke/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/invoke/cli.py | Apache-2.0 |
def _get_event(event_file_name, exception_class):
"""
Read the event JSON data from the given file. If no file is provided, read the event from stdin.
:param string event_file_name: Path to event file, or '-' for stdin
:return string: Contents of the event file or stdin
"""
if event_file_name ... |
Read the event JSON data from the given file. If no file is provided, read the event from stdin.
:param string event_file_name: Path to event file, or '-' for stdin
:return string: Contents of the event file or stdin
| _get_event | python | aws/aws-sam-cli | samcli/commands/local/invoke/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/invoke/cli.py | Apache-2.0 |
def __init__(
self, debug_ports=None, debugger_path=None, debug_args=None, debug_function=None, container_env_vars=None
):
"""
Initialize the Debug Context with Lambda debugger options
:param tuple(int) debug_ports: Collection of debugger ports to be exposed from a docker container
... |
Initialize the Debug Context with Lambda debugger options
:param tuple(int) debug_ports: Collection of debugger ports to be exposed from a docker container
:param Path debugger_path: Path to a debugger to be launched
:param string debug_args: Additional arguments to be passed to the de... | __init__ | python | aws/aws-sam-cli | samcli/commands/local/lib/debug_context.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/debug_context.py | Apache-2.0 |
def __init__(self, lambda_invoke_context, port, host, static_dir, disable_authorizer, ssl_context):
"""
Initialize the local API service.
:param samcli.commands.local.cli_common.invoke_context.InvokeContext lambda_invoke_context: Context object
that can help with Lambda invocation
... |
Initialize the local API service.
:param samcli.commands.local.cli_common.invoke_context.InvokeContext lambda_invoke_context: Context object
that can help with Lambda invocation
:param int port: Port to listen on
:param string host: Local hostname or IP address to bind to
... | __init__ | python | aws/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_api_service.py | Apache-2.0 |
def start(self):
"""
Creates and starts the local API Gateway service. This method will block until the service is stopped
manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint
to invoke the Lambda function and receive a response.
... |
Creates and starts the local API Gateway service. This method will block until the service is stopped
manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint
to invoke the Lambda function and receive a response.
NOTE: This is a blocking... | start | python | aws/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_api_service.py | Apache-2.0 |
def _print_routes(routes, host, port, ssl_enabled=False):
"""
Helper method to print the APIs that will be mounted. This method is purely for printing purposes.
This method takes in a list of Route Configurations and prints out the Routes grouped by path.
Grouping routes by Function Name... |
Helper method to print the APIs that will be mounted. This method is purely for printing purposes.
This method takes in a list of Route Configurations and prints out the Routes grouped by path.
Grouping routes by Function Name + Path is the bulk of the logic.
Example output:
... | _print_routes | python | aws/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_api_service.py | Apache-2.0 |
def _make_static_dir_path(cwd, static_dir):
"""
This method returns the path to the directory where static files are to be served from. If static_dir is a
relative path, then it is resolved to be relative to the current working directory. If no static directory is
provided, or if the res... |
This method returns the path to the directory where static files are to be served from. If static_dir is a
relative path, then it is resolved to be relative to the current working directory. If no static directory is
provided, or if the resolved directory does not exist, this method will return... | _make_static_dir_path | python | aws/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_api_service.py | Apache-2.0 |
def __init__(
self,
local_runtime: LambdaRuntime,
function_provider: SamFunctionProvider,
cwd: str,
real_path: str,
aws_profile: Optional[str] = None,
aws_region: Optional[str] = None,
env_vars_values: Optional[Dict[Any, Any]] = None,
debug_context... |
Initializes the class
:param samcli.local.lambdafn.runtime.LambdaRuntime local_runtime: Lambda runtime capable of running a function
:param samcli.commands.local.lib.provider.FunctionProvider function_provider: Provider that can return a
Lambda function
:param string cwd: C... | __init__ | python | aws/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_lambda.py | Apache-2.0 |
def invoke(
self,
function_identifier: str,
event: str,
stdout: Optional[StreamWriter] = None,
stderr: Optional[StreamWriter] = None,
override_runtime: Optional[str] = None,
) -> None:
"""
Find the Lambda function with given name and invoke it. Pass th... |
Find the Lambda function with given name and invoke it. Pass the given event to the function and return
response through the given streams.
This function will block until either the function completes or times out.
Parameters
----------
function_identifier str
... | invoke | python | aws/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_lambda.py | Apache-2.0 |
def get_invoke_config(self, function: Function, override_runtime: Optional[str] = None) -> FunctionConfig:
"""
Returns invoke configuration to pass to Lambda Runtime to invoke the given function
:param samcli.commands.local.lib.provider.Function function: Lambda function to generate the configu... |
Returns invoke configuration to pass to Lambda Runtime to invoke the given function
:param samcli.commands.local.lib.provider.Function function: Lambda function to generate the configuration for
:return samcli.local.lambdafn.config.FunctionConfig: Function configuration to pass to Lambda runti... | get_invoke_config | python | aws/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_lambda.py | Apache-2.0 |
def _make_env_vars(self, function: Function) -> EnvironmentVariables:
"""Returns the environment variables configuration for this function
Priority order for environment variables (high to low):
1. Function specific env vars from json file
2. Global env vars from json file
Para... | Returns the environment variables configuration for this function
Priority order for environment variables (high to low):
1. Function specific env vars from json file
2. Global env vars from json file
Parameters
----------
function : samcli.commands.local.lib.provider.F... | _make_env_vars | python | aws/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_lambda.py | Apache-2.0 |
def get_aws_creds(self) -> Dict[str, str]:
"""
Returns AWS credentials obtained from the shell environment or given profile
:return dict: A dictionary containing credentials. This dict has the structure
{"region": "", "key": "", "secret": "", "sessiontoken": ""}. If credentials cou... |
Returns AWS credentials obtained from the shell environment or given profile
:return dict: A dictionary containing credentials. This dict has the structure
{"region": "", "key": "", "secret": "", "sessiontoken": ""}. If credentials could not be resolved,
this returns None
... | get_aws_creds | python | aws/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_lambda.py | Apache-2.0 |
def __init__(self, lambda_invoke_context, port, host, ssl_context=None):
"""
Initialize the Local Lambda Invoke service.
:param samcli.commands.local.cli_common.invoke_context.InvokeContext lambda_invoke_context: Context object
that can help with Lambda invocation
:param int... |
Initialize the Local Lambda Invoke service.
:param samcli.commands.local.cli_common.invoke_context.InvokeContext lambda_invoke_context: Context object
that can help with Lambda invocation
:param int port: Port to listen on
:param string host: Local hostname or IP address to... | __init__ | python | aws/aws-sam-cli | samcli/commands/local/lib/local_lambda_service.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_lambda_service.py | Apache-2.0 |
def start(self):
"""
Creates and starts the Local Lambda Invoke service. This method will block until the service is stopped
manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint
to invoke the Lambda function and receive a response.
... |
Creates and starts the Local Lambda Invoke service. This method will block until the service is stopped
manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint
to invoke the Lambda function and receive a response.
NOTE: This is a blocki... | start | python | aws/aws-sam-cli | samcli/commands/local/lib/local_lambda_service.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/local_lambda_service.py | Apache-2.0 |
def get_function_name(integration_uri) -> Optional[str]:
"""
Gets the name of the function from the Integration URI ARN. This is a best effort service which returns None
if function name could not be parsed. This can happen when the ARN is an intrinsic function which is too
complex or th... |
Gets the name of the function from the Integration URI ARN. This is a best effort service which returns None
if function name could not be parsed. This can happen when the ARN is an intrinsic function which is too
complex or the ARN is not a Lambda integration.
Parameters
-----... | get_function_name | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/integration_uri.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/integration_uri.py | Apache-2.0 |
def _get_function_arn(uri_data):
"""
Integration URI can be expressed in various shapes and forms. This method normalizes the Integration URI ARN
and returns the Lambda Function ARN. Here are the different forms of Integration URI ARN:
- String:
- Fully resolved ARN
... |
Integration URI can be expressed in various shapes and forms. This method normalizes the Integration URI ARN
and returns the Lambda Function ARN. Here are the different forms of Integration URI ARN:
- String:
- Fully resolved ARN
- ARN with Stage Variables:
... | _get_function_arn | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/integration_uri.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/integration_uri.py | Apache-2.0 |
def _get_function_name_from_arn(function_arn) -> Optional[str]:
"""
Given the integration ARN, extract the Lambda function name from the ARN. If there
are stage variables, or other unsupported formats, this function will return None.
Parameters
----------
function_arn : ... |
Given the integration ARN, extract the Lambda function name from the ARN. If there
are stage variables, or other unsupported formats, this function will return None.
Parameters
----------
function_arn : basestring or None
Function ARN from the swagger document
... | _get_function_name_from_arn | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/integration_uri.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/integration_uri.py | Apache-2.0 |
def _resolve_fn_sub(uri_data):
"""
Tries to resolve an Integration URI which contains Fn::Sub intrinsic function. This method tries to resolve
and produce a string output.
Example:
{
"Fn::Sub":
"arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/funct... |
Tries to resolve an Integration URI which contains Fn::Sub intrinsic function. This method tries to resolve
and produce a string output.
Example:
{
"Fn::Sub":
"arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
... | _resolve_fn_sub | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/integration_uri.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/integration_uri.py | Apache-2.0 |
def __init__(self, stack_path: str, swagger):
"""
Constructs an Swagger Parser object
:param str stack_path: Path of the stack the resource is located
:param dict swagger: Dictionary representation of a Swagger document
"""
self.swagger = swagger or {}
self.stack... |
Constructs an Swagger Parser object
:param str stack_path: Path of the stack the resource is located
:param dict swagger: Dictionary representation of a Swagger document
| __init__ | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def get_authorizers(self, event_type: str = Route.API) -> Dict[str, Authorizer]:
"""
Parse Swagger document and returns a list of Authorizer objects
Parameters
----------
event_type: str
String indicating what type of API Gateway this is
Returns
----... |
Parse Swagger document and returns a list of Authorizer objects
Parameters
----------
event_type: str
String indicating what type of API Gateway this is
Returns
-------
dict[str, Authorizer]
A map of authorizer names and Authorizer objec... | get_authorizers | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def _get_lambda_identity_sources(
auth_name: str, auth_type: str, event_type: str, properties: dict, authorizer_object: dict
) -> List[str]:
"""
Parses the properties depending on the Lambda Authorizer type (token or request) and retrieves identity sources
Parameters
-------... |
Parses the properties depending on the Lambda Authorizer type (token or request) and retrieves identity sources
Parameters
----------
auth_name: str
Name of the authorizer used for logging
auth_type: str
Type of authorizer (token, request)
event_... | _get_lambda_identity_sources | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def get_default_authorizer(self, event_type: str) -> Union[str, None]:
"""
Parses the body definition to find root level Authorizer definitions
Parameters
----------
event_type: str
String representing the type of API the definition body is defined as
Return... |
Parses the body definition to find root level Authorizer definitions
Parameters
----------
event_type: str
String representing the type of API the definition body is defined as
Returns
-------
Union[str, None]
Returns the name of the aut... | get_default_authorizer | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def get_routes(self, event_type=Route.API) -> List[Route]:
"""
Parses a swagger document and returns a list of APIs configured in the document.
Swagger documents have the following structure
{
"/path1": { # path
"get": { # method
"x-a... |
Parses a swagger document and returns a list of APIs configured in the document.
Swagger documents have the following structure
{
"/path1": { # path
"get": { # method
"x-amazon-apigateway-integration": { # integration
... | get_routes | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def _get_integration(self, method_config):
"""
Get Integration defined in the method configuration.
Integration configuration is defined under the special "x-amazon-apigateway-integration" key. We care only
about Lambda integrations, which are of type aws_proxy, and ignore the rest.
... |
Get Integration defined in the method configuration.
Integration configuration is defined under the special "x-amazon-apigateway-integration" key. We care only
about Lambda integrations, which are of type aws_proxy, and ignore the rest.
Parameters
----------
method_conf... | _get_integration | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def _get_integration_function_name(self, method_config):
"""
Tries to parse the Lambda Function name from the Integration defined in the method configuration.
Integration configuration is defined under the special "x-amazon-apigateway-integration" key. We care only
about Lambda integrati... |
Tries to parse the Lambda Function name from the Integration defined in the method configuration.
Integration configuration is defined under the special "x-amazon-apigateway-integration" key. We care only
about Lambda integrations, which are of type aws_proxy, and ignore the rest. Integration U... | _get_integration_function_name | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def _get_payload_format_version(self, method_config):
"""
Get the "payloadFormatVersion" from the Integration defined in the method configuration.
Parameters
----------
method_config : dict
Dictionary containing the method configuration which might contain integratio... |
Get the "payloadFormatVersion" from the Integration defined in the method configuration.
Parameters
----------
method_config : dict
Dictionary containing the method configuration which might contain integration settings
Returns
-------
string or Non... | _get_payload_format_version | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/parser.py | Apache-2.0 |
def parse_aws_include_transform(data):
"""
If the input data is an AWS::Include data, then parse and return the location of the included file.
AWS::Include transform data usually has the following format:
{
"Fn::Transform": {
"Name": "AWS::Include",
"Parameters": {
... |
If the input data is an AWS::Include data, then parse and return the location of the included file.
AWS::Include transform data usually has the following format:
{
"Fn::Transform": {
"Name": "AWS::Include",
"Parameters": {
"Location": "s3://MyAmazonS3BucketN... | parse_aws_include_transform | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/reader.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/reader.py | Apache-2.0 |
def __init__(self, definition_body=None, definition_uri=None, working_dir=None):
"""
Initialize the class with swagger location
Parameters
----------
definition_body : dict
Swagger document as a dictionary directly or inlined using AWS::Include transform.
de... |
Initialize the class with swagger location
Parameters
----------
definition_body : dict
Swagger document as a dictionary directly or inlined using AWS::Include transform.
definition_uri : str or dict
Location of the Swagger file. Supports three formats:... | __init__ | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/reader.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/reader.py | Apache-2.0 |
def read(self):
"""
Gets the Swagger document from either of the given locations. If we fail to retrieve or parse the Swagger
file, this method will return None.
Returns
-------
dict:
Swagger document. None, if we cannot retrieve the document
"""
... |
Gets the Swagger document from either of the given locations. If we fail to retrieve or parse the Swagger
file, this method will return None.
Returns
-------
dict:
Swagger document. None, if we cannot retrieve the document
| read | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/reader.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/reader.py | Apache-2.0 |
def _read_from_definition_body(self):
"""
Read the Swagger document from DefinitionBody. It could either be an inline Swagger dictionary or an
AWS::Include macro that contains location of the included Swagger. In the later case, we will download and
parse the Swagger document.
R... |
Read the Swagger document from DefinitionBody. It could either be an inline Swagger dictionary or an
AWS::Include macro that contains location of the included Swagger. In the later case, we will download and
parse the Swagger document.
Returns
-------
dict
S... | _read_from_definition_body | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/reader.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/reader.py | Apache-2.0 |
def _download_swagger(self, location):
"""
Download the file from given local or remote location and return it
Parameters
----------
location : str or dict
Local path or S3 path to Swagger file to download. Consult the ``__init__.py`` documentation for specifics
... |
Download the file from given local or remote location and return it
Parameters
----------
location : str or dict
Local path or S3 path to Swagger file to download. Consult the ``__init__.py`` documentation for specifics
on structure of this property.
Re... | _download_swagger | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/reader.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/reader.py | Apache-2.0 |
def _download_from_s3(bucket, key, version=None):
"""
Download a file from given S3 location, if available.
Parameters
----------
bucket : str
S3 Bucket name
key : str
S3 Bucket Key aka file path
version : str
Optional Versio... |
Download a file from given S3 location, if available.
Parameters
----------
bucket : str
S3 Bucket name
key : str
S3 Bucket Key aka file path
version : str
Optional Version ID of the file
Returns
-------
str... | _download_from_s3 | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/reader.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/reader.py | Apache-2.0 |
def _parse_s3_location(location):
"""
Parses the given location input as a S3 Location and returns the file's bucket, key and version as separate
values. Input can be in two different formats:
1. Dictionary with ``Bucket``, ``Key``, ``Version`` keys
2. String of S3 URI in format... |
Parses the given location input as a S3 Location and returns the file's bucket, key and version as separate
values. Input can be in two different formats:
1. Dictionary with ``Bucket``, ``Key``, ``Version`` keys
2. String of S3 URI in format ``s3://<bucket>/<key>?versionId=<version>``
... | _parse_s3_location | python | aws/aws-sam-cli | samcli/commands/local/lib/swagger/reader.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/swagger/reader.py | Apache-2.0 |
def validate_identity_source(identity_source: str, event_type: str = Route.API) -> bool:
"""
Validates if the identity source is valid for the provided event type
Parameters
----------
identity_source: str
The identity source to validate
event_type: str
... |
Validates if the identity source is valid for the provided event type
Parameters
----------
identity_source: str
The identity source to validate
event_type: str
The type of API Gateway to validate against (API or HTTP)
Returns
-------
... | validate_identity_source | python | aws/aws-sam-cli | samcli/commands/local/lib/validators/identity_source_validator.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/validators/identity_source_validator.py | Apache-2.0 |
def validate(logical_id: str, resource: dict) -> bool:
"""
Validates if all the required properties for a Lambda Authorizer are present and valid.
Parameters
----------
logical_id: str
The logical ID of the authorizer
resource: dict
The resource d... |
Validates if all the required properties for a Lambda Authorizer are present and valid.
Parameters
----------
logical_id: str
The logical ID of the authorizer
resource: dict
The resource dictionary for the authorizer containing the `Properties`
... | validate | python | aws/aws-sam-cli | samcli/commands/local/lib/validators/lambda_auth_props.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/validators/lambda_auth_props.py | Apache-2.0 |
def _validate_common_properties(logical_id: str, properties: dict, type_key: str, api_key: str):
"""
Validates if the common required properties are present and valid, will raise an exception
if they are missing or invalid.
Parameters
----------
logical_id: str
... |
Validates if the common required properties are present and valid, will raise an exception
if they are missing or invalid.
Parameters
----------
logical_id: str
The logical ID of the authorizer
properties: dict
The `Properties` dictionary for the... | _validate_common_properties | python | aws/aws-sam-cli | samcli/commands/local/lib/validators/lambda_auth_props.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/validators/lambda_auth_props.py | Apache-2.0 |
def validate(
logical_id: str,
resource: dict,
):
"""
Validates if all the required properties for a Lambda Authorizer V1 are present and valid.
Parameters
----------
logical_id: str
The logical ID of the authorizer
resource: dict
... |
Validates if all the required properties for a Lambda Authorizer V1 are present and valid.
Parameters
----------
logical_id: str
The logical ID of the authorizer
resource: dict
The resource dictionary for the authorizer containing the `Properties`
... | validate | python | aws/aws-sam-cli | samcli/commands/local/lib/validators/lambda_auth_props.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/validators/lambda_auth_props.py | Apache-2.0 |
def validate(
logical_id: str,
resource: dict,
):
"""
Validates if all the required properties for a Lambda Authorizer V2 are present and valid.
Parameters
----------
logical_id: str
The logical ID of the authorizer
resource: dict
... |
Validates if all the required properties for a Lambda Authorizer V2 are present and valid.
Parameters
----------
logical_id: str
The logical ID of the authorizer
resource: dict
The resource dictionary for the authorizer containing the `Properties`
... | validate | python | aws/aws-sam-cli | samcli/commands/local/lib/validators/lambda_auth_props.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/lib/validators/lambda_auth_props.py | Apache-2.0 |
def cli(
ctx,
# start-api Specific Options
host,
port,
static_dir,
disable_authorizer,
# Common Options for Lambda Invoke
template_file,
env_vars,
debug_port,
debug_args,
debugger_path,
container_env_vars,
docker_volume_basedir,
docker_network,
log_file,
... |
`sam local start-api` command entry point
| cli | python | aws/aws-sam-cli | samcli/commands/local/start_api/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/start_api/cli.py | Apache-2.0 |
def do_cli( # pylint: disable=R0914
ctx,
host,
port,
disable_authorizer,
static_dir,
template,
env_vars,
debug_port,
debug_args,
debugger_path,
container_env_vars,
docker_volume_basedir,
docker_network,
log_file,
layer_cache_basedir,
skip_pull_image,
... |
Implementation of the ``cli`` method, just separated out for unit testing purposes
| do_cli | python | aws/aws-sam-cli | samcli/commands/local/start_api/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/start_api/cli.py | Apache-2.0 |
def cli(
ctx, # pylint: disable=R0914
# start-lambda Specific Options
host,
port,
# Common Options for Lambda Invoke
template_file,
env_vars,
debug_port,
debug_args,
debugger_path,
container_env_vars,
docker_volume_basedir,
docker_network,
log_file,
layer_cac... |
`sam local start-lambda` command entry point
| cli | python | aws/aws-sam-cli | samcli/commands/local/start_lambda/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/start_lambda/cli.py | Apache-2.0 |
def do_cli( # pylint: disable=R0914
ctx,
host,
port,
template,
env_vars,
debug_port,
debug_args,
debugger_path,
container_env_vars,
docker_volume_basedir,
docker_network,
log_file,
layer_cache_basedir,
skip_pull_image,
force_image_build,
parameter_overrid... |
Implementation of the ``cli`` method, just separated out for unit testing purposes
| do_cli | python | aws/aws-sam-cli | samcli/commands/local/start_lambda/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/local/start_lambda/cli.py | Apache-2.0 |
def parse_time(time_str: str, property_name: str):
"""
Parse the time from the given string, convert to UTC, and return the datetime object
Parameters
----------
time_str : str
The time to parse
property_name : str
Name of the property where this time came from. Used in the exc... |
Parse the time from the given string, convert to UTC, and return the datetime object
Parameters
----------
time_str : str
The time to parse
property_name : str
Name of the property where this time came from. Used in the exception raised if time is not parseable
Returns
--... | parse_time | python | aws/aws-sam-cli | samcli/commands/logs/logs_context.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/logs_context.py | Apache-2.0 |
def get_resource_information(self, fetch_all_when_no_resource_name_given: bool = True) -> List[Any]:
"""
Returns the list of resource information for the given stack.
Parameters
----------
fetch_all_when_no_resource_name_given : bool
When given, it will fetch all res... |
Returns the list of resource information for the given stack.
Parameters
----------
fetch_all_when_no_resource_name_given : bool
When given, it will fetch all resources if no specific resource name is provided, default value is True
Returns
-------
... | get_resource_information | python | aws/aws-sam-cli | samcli/commands/logs/logs_context.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/logs_context.py | Apache-2.0 |
def _fetch_resources_from_stack(
self, selected_resource_names: Optional[Set[str]] = None
) -> List[CloudFormationResourceSummary]:
"""
Returns list of all resources from given stack name
If any resource is not supported, it will discard them
Parameters
----------
... |
Returns list of all resources from given stack name
If any resource is not supported, it will discard them
Parameters
----------
selected_resource_names : Optional[Set[str]]
An optional set of string parameter, which will filter resource names. If none is given, it ... | _fetch_resources_from_stack | python | aws/aws-sam-cli | samcli/commands/logs/logs_context.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/logs_context.py | Apache-2.0 |
def _get_selected_resources(
resource_summaries: Dict[str, CloudFormationResourceSummary],
selected_resource_names: Set[str],
) -> List[CloudFormationResourceSummary]:
"""
Returns list of resources which matches with selected_resource_names.
selected_resource_names can be;
... |
Returns list of resources which matches with selected_resource_names.
selected_resource_names can be;
- resource name like HelloWorldFunction
- or it could be pointing to a resource in nested stack like NestedApp/HelloWorldFunction
Parameters
----------
resource... | _get_selected_resources | python | aws/aws-sam-cli | samcli/commands/logs/logs_context.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/logs_context.py | Apache-2.0 |
def generate_puller(
boto_client_provider: BotoProviderType,
resource_information_list: List[CloudFormationResourceSummary],
filter_pattern: Optional[str] = None,
additional_cw_log_groups: Optional[List[str]] = None,
output: OutputOption = OutputOption.text,
include_tracing: bool = False,
) -> O... |
This function will generate generic puller which can be used to
pull information from various observability resources.
Parameters
----------
boto_client_provider: BotoProviderType
Boto3 client generator, which will create a new instance of the client with a new session that could be
... | generate_puller | python | aws/aws-sam-cli | samcli/commands/logs/puller_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/puller_factory.py | Apache-2.0 |
def generate_consumer(
filter_pattern: Optional[str] = None, output: OutputOption = OutputOption.text, resource_name: Optional[str] = None
):
"""
Generates consumer instance with the given variables.
If output is JSON, then it will return consumer with formatters for just JSON.
Otherwise, it will re... |
Generates consumer instance with the given variables.
If output is JSON, then it will return consumer with formatters for just JSON.
Otherwise, it will return regular text console consumer
| generate_consumer | python | aws/aws-sam-cli | samcli/commands/logs/puller_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/puller_factory.py | Apache-2.0 |
def generate_json_consumer() -> ObservabilityEventConsumer:
"""
Creates event consumer, which prints CW Log Events as JSON into terminal
Returns
-------
ObservabilityEventConsumer which will store events into a file
"""
return ObservabilityEventConsumerDecorator(
[
C... |
Creates event consumer, which prints CW Log Events as JSON into terminal
Returns
-------
ObservabilityEventConsumer which will store events into a file
| generate_json_consumer | python | aws/aws-sam-cli | samcli/commands/logs/puller_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/puller_factory.py | Apache-2.0 |
def generate_text_consumer(filter_pattern: Optional[str]) -> ObservabilityEventConsumer:
"""
Creates a console event consumer, which is used to display events in the user's console
Parameters
----------
filter_pattern : str
Filter pattern is used to display certain words in a different patt... |
Creates a console event consumer, which is used to display events in the user's console
Parameters
----------
filter_pattern : str
Filter pattern is used to display certain words in a different pattern then
the rest of the messages.
Returns
-------
A consumer which wil... | generate_text_consumer | python | aws/aws-sam-cli | samcli/commands/logs/puller_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/puller_factory.py | Apache-2.0 |
def stack_name_cw_log_group_validation(func):
"""
Wrapper Validation function that will run last after the all cli parmaters have been loaded
to check for conditions surrounding `--stack-name` and `--cw-log-group`. The
reason they are done last instead of in callback functions, is because the options de... |
Wrapper Validation function that will run last after the all cli parmaters have been loaded
to check for conditions surrounding `--stack-name` and `--cw-log-group`. The
reason they are done last instead of in callback functions, is because the options depend
on each other, and this breaks cyclic depend... | stack_name_cw_log_group_validation | python | aws/aws-sam-cli | samcli/commands/logs/validation_and_exception_handlers.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/validation_and_exception_handlers.py | Apache-2.0 |
def _handle_client_error(ex: ClientError) -> None:
"""
Handles client error which was caused by ListStackResources event
"""
operation_name = ex.operation_name
client_error_code = get_client_error_code(ex)
if client_error_code == "ValidationError" and operation_name == "ListStackResources":
... |
Handles client error which was caused by ListStackResources event
| _handle_client_error | python | aws/aws-sam-cli | samcli/commands/logs/validation_and_exception_handlers.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/logs/validation_and_exception_handlers.py | Apache-2.0 |
def resources_and_properties_help_string():
"""
Total list of resources and their property locations that are supported for `sam package`
:return: str
"""
return "".join(
f"\nResource : {resource} | Location : {location}\n".format(resource=resource, location=location)
for resource, l... |
Total list of resources and their property locations that are supported for `sam package`
:return: str
| resources_and_properties_help_string | python | aws/aws-sam-cli | samcli/commands/package/command.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/package/command.py | Apache-2.0 |
def run(self):
"""
Execute packaging based on the argument provided by customers and samconfig.toml.
"""
stacks, _ = SamLocalStackProvider.get_stacks(
self.template_file,
global_parameter_overrides=self._global_parameter_overrides,
parameter_overrides=... |
Execute packaging based on the argument provided by customers and samconfig.toml.
| run | python | aws/aws-sam-cli | samcli/commands/package/package_context.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/package/package_context.py | Apache-2.0 |
def cli() -> None:
"""
Manage the continuous delivery of the application
""" |
Manage the continuous delivery of the application
| cli | python | aws/aws-sam-cli | samcli/commands/pipeline/pipeline.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/pipeline.py | Apache-2.0 |
def cli(
ctx: Any,
interactive: bool,
stage: Optional[str],
pipeline_user: Optional[str],
pipeline_execution_role: Optional[str],
cloudformation_execution_role: Optional[str],
bucket: Optional[str],
create_image_repository: bool,
image_repository: Optional[str],
confirm_changeset... |
`sam pipeline bootstrap` command entry point
| cli | python | aws/aws-sam-cli | samcli/commands/pipeline/bootstrap/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/bootstrap/cli.py | Apache-2.0 |
def do_cli(
region: Optional[str],
profile: Optional[str],
interactive: bool,
stage_configuration_name: Optional[str],
pipeline_user_arn: Optional[str],
pipeline_execution_role_arn: Optional[str],
cloudformation_execution_role_arn: Optional[str],
artifacts_bucket_arn: Optional[str],
... |
implementation of `sam pipeline bootstrap` command
| do_cli | python | aws/aws-sam-cli | samcli/commands/pipeline/bootstrap/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/bootstrap/cli.py | Apache-2.0 |
def run(self) -> None: # pylint: disable=too-many-branches
"""
Runs an interactive questionnaire to prompt the user for the ARNs of the AWS resources(infrastructure) required
for the pipeline to work. Users can provide all, none or some resources' ARNs and leave the remaining empty
and ... |
Runs an interactive questionnaire to prompt the user for the ARNs of the AWS resources(infrastructure) required
for the pipeline to work. Users can provide all, none or some resources' ARNs and leave the remaining empty
and it will be created by the bootstrap command
| run | python | aws/aws-sam-cli | samcli/commands/pipeline/bootstrap/guided_context.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/bootstrap/guided_context.py | Apache-2.0 |
def verify_parameters(self) -> None:
"""
Makes sure that all required parameters have been provided
-------
"""
error_string = ""
for parameter_name in self.oidc_parameter_names:
if not self.oidc_parameters[parameter_name]:
error_string += f"Mi... |
Makes sure that all required parameters have been provided
-------
| verify_parameters | python | aws/aws-sam-cli | samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | Apache-2.0 |
def save_values(self, samconfig: SamConfig, cmd_names: List[str], section: str) -> None:
"""
Saves provided values into config file so they can be reused for future calls to bootstrap
"""
for parameter_name in self.oidc_parameter_names:
samconfig.put(
cmd_name... |
Saves provided values into config file so they can be reused for future calls to bootstrap
| save_values | python | aws/aws-sam-cli | samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | Apache-2.0 |
def get_subject_claim(self) -> str:
"""
Returns the subject claim that will be used to establish trust between the OIDC provider and AWS.
To read more about OIDC claims see the following: https://openid.net/specs/openid-connect-core-1_0.html#Claims
https://tinyurl.com/github-oidc-token
... |
Returns the subject claim that will be used to establish trust between the OIDC provider and AWS.
To read more about OIDC claims see the following: https://openid.net/specs/openid-connect-core-1_0.html#Claims
https://tinyurl.com/github-oidc-token
In GitHubs case when using the official ... | get_subject_claim | python | aws/aws-sam-cli | samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | Apache-2.0 |
def get_subject_claim(self) -> str:
"""
Returns the subject claim that will be used to establish trust between the OIDC provider and AWS.
To read more about OIDC claims see the following: https://openid.net/specs/openid-connect-core-1_0.html#Claims
https://docs.gitlab.com/ee/ci/cloud_ser... |
Returns the subject claim that will be used to establish trust between the OIDC provider and AWS.
To read more about OIDC claims see the following: https://openid.net/specs/openid-connect-core-1_0.html#Claims
https://docs.gitlab.com/ee/ci/cloud_services/aws/#configure-a-role-and-trust
T... | get_subject_claim | python | aws/aws-sam-cli | samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/bootstrap/pipeline_oidc_provider.py | Apache-2.0 |
def cli(ctx: Any, config_env: Optional[str], config_file: Optional[str], bootstrap: bool, save_params: bool) -> None:
"""
`sam pipeline init` command entry point
"""
# Currently we support interactive mode only, i.e. the user doesn't provide the required arguments during the call
# so we call do_cl... |
`sam pipeline init` command entry point
| cli | python | aws/aws-sam-cli | samcli/commands/pipeline/init/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/cli.py | Apache-2.0 |
def do_cli(bootstrap: bool) -> None:
"""
implementation of `sam pipeline init` command
"""
# TODO non-interactive mode
init_flow = InteractiveInitFlow(bootstrap)
init_flow.do_interactive() |
implementation of `sam pipeline init` command
| do_cli | python | aws/aws-sam-cli | samcli/commands/pipeline/init/cli.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/cli.py | Apache-2.0 |
def do_interactive(self) -> None:
"""
An interactive flow that prompts the user for pipeline template (cookiecutter template) location, downloads it,
runs its specific questionnaire then generates the pipeline config file
based on the template and user's responses
"""
cli... |
An interactive flow that prompts the user for pipeline template (cookiecutter template) location, downloads it,
runs its specific questionnaire then generates the pipeline config file
based on the template and user's responses
| do_interactive | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _generate_from_app_pipeline_templates(
self,
) -> List[str]:
"""
Prompts the user to choose a pipeline template from SAM predefined set of pipeline templates hosted in the git
repository: aws/aws-sam-cli-pipeline-init-templates.git
downloads locally, then generates the pi... |
Prompts the user to choose a pipeline template from SAM predefined set of pipeline templates hosted in the git
repository: aws/aws-sam-cli-pipeline-init-templates.git
downloads locally, then generates the pipeline configuration file from the selected pipeline template.
Finally, return t... | _generate_from_app_pipeline_templates | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _generate_from_custom_location(
self,
) -> List[str]:
"""
Prompts the user for a custom pipeline template location, downloads locally,
then generates the pipeline config file and return the list of generated files
"""
pipeline_template_git_location: str = click.pr... |
Prompts the user for a custom pipeline template location, downloads locally,
then generates the pipeline config file and return the list of generated files
| _generate_from_custom_location | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _select_and_generate_from_pipeline_template(self, pipeline_template_local_dir: Path) -> List[str]:
"""
Determine if the specified custom pipeline template directory contains
more than one template, prompt the user to choose one if it does, and
then generate the template and return th... |
Determine if the specified custom pipeline template directory contains
more than one template, prompt the user to choose one if it does, and
then generate the template and return the list of files.
| _select_and_generate_from_pipeline_template | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _prompt_run_bootstrap_within_pipeline_init(
self, stage_configuration_names: List[str], number_of_stages: int, cicd_provider: Optional[str] = None
) -> bool:
"""
Prompt bootstrap if `--bootstrap` flag is provided. Return True if bootstrap process is executed.
"""
if not s... |
Prompt bootstrap if `--bootstrap` flag is provided. Return True if bootstrap process is executed.
| _prompt_run_bootstrap_within_pipeline_init | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _generate_from_pipeline_template(
self, pipeline_template_dir: Path, cicd_provider: Optional[str] = None
) -> List[str]:
"""
Generates a pipeline config file from a given pipeline template local location
and return the list of generated files.
"""
pipeline_templat... |
Generates a pipeline config file from a given pipeline template local location
and return the list of generated files.
| _generate_from_pipeline_template | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _copy_dir_contents_to_cwd(source_dir: str) -> List[str]:
"""
Copy the contents of source_dir into the current cwd.
If existing files are encountered, ask for confirmation.
If not confirmed, all files will be written to
.aws-sam/pipeline/generated-files/
"""
file_paths: List[str] = []
... |
Copy the contents of source_dir into the current cwd.
If existing files are encountered, ask for confirmation.
If not confirmed, all files will be written to
.aws-sam/pipeline/generated-files/
| _copy_dir_contents_to_cwd | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _clone_app_pipeline_templates() -> Path:
"""
clone aws/aws-sam-cli-pipeline-init-templates.git Git repo to the local machine in SAM shared directory.
Returns:
the local directory path where the repo is cloned.
"""
try:
return _clone_pipeline_templates(
repo_url=APP_PI... |
clone aws/aws-sam-cli-pipeline-init-templates.git Git repo to the local machine in SAM shared directory.
Returns:
the local directory path where the repo is cloned.
| _clone_app_pipeline_templates | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _clone_pipeline_templates(repo_url: str, clone_dir: Path, clone_name: str) -> Path:
"""
clone a given pipeline templates' Git repo to the user machine inside the given clone_dir directory
under the given clone name. For example, if clone_name is "custom-pipeline-template" then the location to clone
... |
clone a given pipeline templates' Git repo to the user machine inside the given clone_dir directory
under the given clone name. For example, if clone_name is "custom-pipeline-template" then the location to clone
to is "/clone/dir/path/custom-pipeline-template/"
Parameters:
repo_url: the URL of... | _clone_pipeline_templates | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _prompt_pipeline_template(pipeline_templates_manifest: PipelineTemplatesManifest) -> PipelineTemplateMetadata:
"""
Prompts the user a list of the available CI/CD systems along with associated app pipeline templates to choose
one of them
Parameters:
pipeline_templates_manifest: A manifest fi... |
Prompts the user a list of the available CI/CD systems along with associated app pipeline templates to choose
one of them
Parameters:
pipeline_templates_manifest: A manifest file lists the available providers and the associated pipeline templates
Returns:
The manifest (A section in t... | _prompt_pipeline_template | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _prompt_cicd_provider(available_providers: List[Provider]) -> Provider:
"""
Prompts the user a list of the available CI/CD systems to choose from
Parameters:
available_providers: List of available CI/CD systems such as Jenkins, Gitlab and CircleCI
Returns:
The chosen provider
"... |
Prompts the user a list of the available CI/CD systems to choose from
Parameters:
available_providers: List of available CI/CD systems such as Jenkins, Gitlab and CircleCI
Returns:
The chosen provider
| _prompt_cicd_provider | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _prompt_provider_pipeline_template(
provider_available_pipeline_templates_metadata: List[PipelineTemplateMetadata],
) -> PipelineTemplateMetadata:
"""
Prompts the user a list of the available pipeline templates to choose from
Parameters:
provider_available_pipeline_templates_metadata: List ... |
Prompts the user a list of the available pipeline templates to choose from
Parameters:
provider_available_pipeline_templates_metadata: List of available pipeline templates manifests
Returns:
The chosen pipeline template manifest
| _prompt_provider_pipeline_template | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _initialize_pipeline_template(pipeline_template_dir: Path) -> Template:
"""
Initialize a pipeline template from a given pipeline template (cookiecutter template) location
Parameters:
pipeline_template_dir: The local location of the pipeline cookiecutter template
Returns:
The initia... |
Initialize a pipeline template from a given pipeline template (cookiecutter template) location
Parameters:
pipeline_template_dir: The local location of the pipeline cookiecutter template
Returns:
The initialized pipeline's cookiecutter template
| _initialize_pipeline_template | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def _get_pipeline_template_metadata(pipeline_template_dir: Path) -> Dict:
"""
Load the metadata from the file metadata.json located in the template directory,
raise an exception if anything wrong.
"""
metadata_path = Path(pipeline_template_dir, "metadata.json")
if not metadata_path.exists():
... |
Load the metadata from the file metadata.json located in the template directory,
raise an exception if anything wrong.
| _get_pipeline_template_metadata | python | aws/aws-sam-cli | samcli/commands/pipeline/init/interactive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/pipeline/init/interactive_init_flow.py | Apache-2.0 |
def do_cli(ctx, template, semantic_version, fail_on_same_version):
"""Publish the application based on command line inputs."""
from samcli.commands.exceptions import UserException
from samcli.vendor.serverlessrepo import publish_application
from samcli.vendor.serverlessrepo.exceptions import (
... | Publish the application based on command line inputs. | do_cli | python | aws/aws-sam-cli | samcli/commands/publish/command.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/publish/command.py | Apache-2.0 |
def _gen_success_message(publish_output):
"""
Generate detailed success message for published applications.
Parameters
----------
publish_output : dict
Output from serverlessrepo publish_application
Returns
-------
str
Detailed success message
"""
application_id... |
Generate detailed success message for published applications.
Parameters
----------
publish_output : dict
Output from serverlessrepo publish_application
Returns
-------
str
Detailed success message
| _gen_success_message | python | aws/aws-sam-cli | samcli/commands/publish/command.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/publish/command.py | Apache-2.0 |
def _print_console_link(region, application_id):
"""
Print link for the application in AWS Serverless Application Repository console.
Parameters
----------
region : str
AWS region name
application_id : str
The Amazon Resource Name (ARN) of the application
"""
if not reg... |
Print link for the application in AWS Serverless Application Repository console.
Parameters
----------
region : str
AWS region name
application_id : str
The Amazon Resource Name (ARN) of the application
| _print_console_link | python | aws/aws-sam-cli | samcli/commands/publish/command.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/publish/command.py | Apache-2.0 |
def cli():
"""
Interact with your Serverless application in the cloud for quick development & testing
""" |
Interact with your Serverless application in the cloud for quick development & testing
| cli | python | aws/aws-sam-cli | samcli/commands/remote/remote.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/commands/remote/remote.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.