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 extract_cors_from_method(self, cors_dict: Dict) -> Optional[Cors]:
"""
Extract the cors parameters from an AWS::ApiGateway::Method.
Parameters
----------
cors_dict : dict
A dict of cors parameters in the format of ResponseParameters
Return
------
... |
Extract the cors parameters from an AWS::ApiGateway::Method.
Parameters
----------
cors_dict : dict
A dict of cors parameters in the format of ResponseParameters
Return
------
A Cors object with the relevant cors headers from the ResponseParameters
... | extract_cors_from_method | python | aws/aws-sam-cli | samcli/lib/providers/cfn_base_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/cfn_base_api_provider.py | Apache-2.0 |
def _get_cors_prop(cors_dict: Dict, prop_name: str, allow_bool: bool = False) -> Optional[str]:
"""
Extract cors properties from dictionary and remove extra quotes.
Parameters
----------
cors_dict : dict
Resource properties for Cors
prop_name : str
... |
Extract cors properties from dictionary and remove extra quotes.
Parameters
----------
cors_dict : dict
Resource properties for Cors
prop_name : str
Cors property to get the value for
allow_bool : bool
If a boolean value is allowed ... | _get_cors_prop | python | aws/aws-sam-cli | samcli/lib/providers/cfn_base_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/cfn_base_api_provider.py | Apache-2.0 |
def extract_cors_http(
self,
cors_prop: Union[bool, Dict],
) -> Optional[Cors]:
"""
Extract Cors property from AWS::Serverless::HttpApi resource by reading and parsing Swagger documents.
The result is added to the HttpApi.
Parameters
----------
cors_p... |
Extract Cors property from AWS::Serverless::HttpApi resource by reading and parsing Swagger documents.
The result is added to the HttpApi.
Parameters
----------
cors_prop : dict
Resource properties for CorsConfiguration
| extract_cors_http | python | aws/aws-sam-cli | samcli/lib/providers/cfn_base_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/cfn_base_api_provider.py | Apache-2.0 |
def _get_cors_prop_http(
cors_dict: Dict,
prop_name: str,
expect_type: Type,
) -> Optional[Any]:
"""
Extract cors properties from dictionary.
Parameters
----------
cors_dict : dict
Resource properties for Cors
prop_name : str
... |
Extract cors properties from dictionary.
Parameters
----------
cors_dict : dict
Resource properties for Cors
prop_name : str
Property name
expect_type : type
Expect property type
Return
------
Value with match... | _get_cors_prop_http | python | aws/aws-sam-cli | samcli/lib/providers/cfn_base_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/cfn_base_api_provider.py | Apache-2.0 |
def normalize_cors_allow_methods(allow_methods: Union[str, List[str]]) -> str:
"""
Normalize cors AllowMethods and Options to the methods if it's missing.
Parameters
----------
allow_methods : str
The allow_methods string provided in the query
Return
... |
Normalize cors AllowMethods and Options to the methods if it's missing.
Parameters
----------
allow_methods : str
The allow_methods string provided in the query
Return
-------
A string with normalized route
| normalize_cors_allow_methods | python | aws/aws-sam-cli | samcli/lib/providers/cfn_base_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/cfn_base_api_provider.py | Apache-2.0 |
def __init__(self, template: str, stack_name: str) -> None:
"""Exception when template validation fails
Parameters
----------
template : str
Template location that failed to validate
stack_name : str
Stack name of the template
"""
self._te... | Exception when template validation fails
Parameters
----------
template : str
Template location that failed to validate
stack_name : str
Stack name of the template
| __init__ | python | aws/aws-sam-cli | samcli/lib/providers/exceptions.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/exceptions.py | Apache-2.0 |
def __init__(self, resource_identifier: "ResourceIdentifier", property_name: str) -> None:
"""Exception when a resource does not have local path in it's property
Parameters
----------
resource_identifier : ResourceIdentifier
Resource Identifer
property_name : str
... | Exception when a resource does not have local path in it's property
Parameters
----------
resource_identifier : ResourceIdentifier
Resource Identifer
property_name : str
Property name that's missing
| __init__ | python | aws/aws-sam-cli | samcli/lib/providers/exceptions.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/exceptions.py | Apache-2.0 |
def architecture(self) -> str:
"""
Returns the architecture to use to build and invoke the function
Returns
-------
str
Architecture
Raises
------
InvalidFunctionPropertyType
If the architectures value is invalid
"""
... |
Returns the architecture to use to build and invoke the function
Returns
-------
str
Architecture
Raises
------
InvalidFunctionPropertyType
If the architectures value is invalid
| architecture | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def __init__(
self,
arn: str,
codeuri: Optional[str],
compatible_runtimes: Optional[List[str]] = None,
metadata: Optional[Dict] = None,
compatible_architectures: Optional[List[str]] = None,
stack_path: str = "",
) -> None:
"""
Parameters
... |
Parameters
----------
stack_path str
The path of the stack relative to the root stack, it is empty for layers in root stack
name str
Name of the layer, this can be the ARN or Logical Id in the template
codeuri str
CodeURI of the layer. This sh... | __init__ | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def _compute_layer_version(is_defined_within_template: bool, arn: str) -> Optional[int]:
"""
Parses out the Layer version from the arn
Parameters
----------
is_defined_within_template bool
True if the resource is a Ref to a resource otherwise False
arn str
... |
Parses out the Layer version from the arn
Parameters
----------
is_defined_within_template bool
True if the resource is a Ref to a resource otherwise False
arn str
ARN of the Resource
Returns
-------
int
The Version o... | _compute_layer_version | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def _compute_layer_name(is_defined_within_template: bool, arn: str) -> str:
"""
Computes a unique name based on the LayerVersion Arn
Format:
<Name of the LayerVersion>-<Version of the LayerVersion>-<sha256 of the arn>
Parameters
----------
is_defined_within_temp... |
Computes a unique name based on the LayerVersion Arn
Format:
<Name of the LayerVersion>-<Version of the LayerVersion>-<sha256 of the arn>
Parameters
----------
is_defined_within_template bool
True if the resource is a Ref to a resource otherwise False
... | _compute_layer_name | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def name(self) -> str:
"""
A unique name from the arn or logical id of the Layer
A LayerVersion Arn example:
arn:aws:lambda:region:account-id:layer:layer-name:version
Returns
-------
str
A name of the Layer that is used on the system to uniquely iden... |
A unique name from the arn or logical id of the Layer
A LayerVersion Arn example:
arn:aws:lambda:region:account-id:layer:layer-name:version
Returns
-------
str
A name of the Layer that is used on the system to uniquely identify the layer
| name | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def cors_to_headers(
cors: Optional["Cors"], request_origin: Optional[str], event_type: str
) -> Dict[str, Union[int, str]]:
"""
Convert CORS object to headers dictionary
Parameters
----------
cors list(samcli.commands.local.lib.provider.Cors)
CORS configu... |
Convert CORS object to headers dictionary
Parameters
----------
cors list(samcli.commands.local.lib.provider.Cors)
CORS configuration objcet
request_origin str
Origin of the request, e.g. https://example.com:8080
event_type str
The typ... | cors_to_headers | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def resources(self) -> Dict:
"""
Return the resources dictionary where SAM plugins have been run
and parameter values have been substituted.
"""
if self._resources is not None:
return self._resources
processed_template_dict: Dict[str, Dict] = SamBaseProvider.g... |
Return the resources dictionary where SAM plugins have been run
and parameter values have been substituted.
| resources | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def raw_resources(self) -> Dict:
"""
Return the resources dictionary without running SAM Transform
"""
if self._raw_resources is not None:
return self._raw_resources
self._raw_resources = cast(Dict, self.template_dict.get("Resources", {}))
return self._raw_res... |
Return the resources dictionary without running SAM Transform
| raw_resources | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_output_template_path(self, build_root: str) -> str:
"""
Return the path of the template yaml file output by "sam build."
"""
# stack_path is always posix path, we need to convert it to path that matches the OS
return os.path.join(build_root, self.stack_path.replace(posixp... |
Return the path of the template yaml file output by "sam build."
| get_output_template_path | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_parent_stack(child_stack: "Stack", stacks: List["Stack"]) -> Optional["Stack"]:
"""
Return parent stack for the given child stack
Parameters
----------
child_stack Stack
the child stack
stacks : List[Stack]
a list of stack for searching
... |
Return parent stack for the given child stack
Parameters
----------
child_stack Stack
the child stack
stacks : List[Stack]
a list of stack for searching
Returns
-------
Stack
parent stack of the given child stack, if th... | get_parent_stack | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_stack_by_full_path(full_path: str, stacks: List["Stack"]) -> Optional["Stack"]:
"""
Return the stack with given full path
Parameters
----------
full_path str
full path of the stack like ChildStack/ChildChildStack
stacks : List[Stack]
a list... |
Return the stack with given full path
Parameters
----------
full_path str
full path of the stack like ChildStack/ChildChildStack
stacks : List[Stack]
a list of stack for searching
Returns
-------
Stack
The stack with th... | get_stack_by_full_path | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_child_stacks(stack: "Stack", stacks: List["Stack"]) -> List["Stack"]:
"""
Return child stacks for the given parent stack
Parameters
----------
stack Stack
the parent stack
stacks : List[Stack]
a list of stack for searching
Returns
... |
Return child stacks for the given parent stack
Parameters
----------
stack Stack
the parent stack
stacks : List[Stack]
a list of stack for searching
Returns
-------
List[Stack]
child stacks of the given parent stack
... | get_child_stacks | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def __init__(self, resource_identifier_str: str):
"""
Parameters
----------
resource_identifier_str : str
Resource identifier in the format of:
Stack1/Stack2/ResourceID
"""
parts = resource_identifier_str.rsplit(posixpath.sep, 1)
if len(par... |
Parameters
----------
resource_identifier_str : str
Resource identifier in the format of:
Stack1/Stack2/ResourceID
| __init__ | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_full_path(stack_path: str, resource_id: str) -> str:
"""
Return the unique posix path-like identifier
while will used for identify a resource from resources in a multi-stack situation
"""
if not stack_path:
return resource_id
return posixpath.join(stack_path, resource_id) |
Return the unique posix path-like identifier
while will used for identify a resource from resources in a multi-stack situation
| get_full_path | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_resource_by_id(
stacks: List[Stack], identifier: ResourceIdentifier, explicit_nested: bool = False
) -> Optional[Dict[str, Any]]:
"""Seach resource in stacks based on identifier
Parameters
----------
stacks : List[Stack]
List of stacks to be searched
identifier : ResourceIdentif... | Seach resource in stacks based on identifier
Parameters
----------
stacks : List[Stack]
List of stacks to be searched
identifier : ResourceIdentifier
Resource identifier for the resource to be returned
explicit_nested : bool, optional
Set to True to only search in root stack... | get_resource_by_id | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_resource_full_path_by_id(stacks: List[Stack], identifier: ResourceIdentifier) -> Optional[str]:
"""Seach resource in stacks based on identifier
Parameters
----------
stacks : List[Stack]
List of stacks to be searched
identifier : ResourceIdentifier
Resource identifier for th... | Seach resource in stacks based on identifier
Parameters
----------
stacks : List[Stack]
List of stacks to be searched
identifier : ResourceIdentifier
Resource identifier for the resource to be returned
Returns
-------
str
return resource full path
| get_resource_full_path_by_id | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_resource_ids_by_type(stacks: List[Stack], resource_type: str) -> List[ResourceIdentifier]:
"""Return list of resource IDs
Parameters
----------
stacks : List[Stack]
List of stacks
resource_type : str
Resource type to be used for searching related resources.
Returns
... | Return list of resource IDs
Parameters
----------
stacks : List[Stack]
List of stacks
resource_type : str
Resource type to be used for searching related resources.
Returns
-------
List[ResourceIdentifier]
List of ResourceIdentifiers with the type provided
| get_resource_ids_by_type | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_all_resource_ids(stacks: List[Stack]) -> List[ResourceIdentifier]:
"""Return all resource IDs in stacks
Parameters
----------
stacks : List[Stack]
List of stacks
Returns
-------
List[ResourceIdentifier]
List of ResourceIdentifiers
"""
resource_ids: List[Reso... | Return all resource IDs in stacks
Parameters
----------
stacks : List[Stack]
List of stacks
Returns
-------
List[ResourceIdentifier]
List of ResourceIdentifiers
| get_all_resource_ids | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_unique_resource_ids(
stacks: List[Stack],
resource_ids: Optional[Union[List[str]]],
resource_types: Optional[Union[List[str]]],
) -> Set[ResourceIdentifier]:
"""Get unique resource IDs for resource_ids and resource_types
Parameters
----------
stacks : List[Stack]
Stacks
... | Get unique resource IDs for resource_ids and resource_types
Parameters
----------
stacks : List[Stack]
Stacks
resource_ids : Optional[Union[List[str]]]
Resource ID strings
resource_types : Optional[Union[List[str]]]
Resource types
Returns
-------
Set[ResourceIde... | get_unique_resource_ids | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def get_function_build_info(
full_path: str,
packagetype: str,
inlinecode: Optional[str],
codeuri: Optional[str],
imageuri: Optional[str],
metadata: Optional[Dict],
) -> FunctionBuildInfo:
"""
Populates FunctionBuildInfo from the given information.
"""
if inlinecode:
LOG.... |
Populates FunctionBuildInfo from the given information.
| get_function_build_info | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def _get_build_dir(resource: Union[Function, LayerVersion], build_root: str) -> str:
"""
Return the build directory to place build artifact
"""
# stack_path is always posix path, we need to convert it to path that matches the OS
return os.path.join(build_root, resource.stack_path.replace(posixpath.s... |
Return the build directory to place build artifact
| _get_build_dir | python | aws/aws-sam-cli | samcli/lib/providers/provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/provider.py | Apache-2.0 |
def extract_resources(
self,
stacks: List[Stack],
collector: ApiCollector,
cwd: Optional[str] = None,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Extract the Route Object from a given resource and adds it to the RouteCollector.
Paramete... |
Extract the Route Object from a given resource and adds it to the RouteCollector.
Parameters
----------
stacks: List[Stack]
List of stacks apis are extracted from
collector: samcli.commands.local.lib.route_collector.ApiCollector
Instance of the API colle... | extract_resources | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _extract_from_serverless_api(
self,
stack_path: str,
logical_id: str,
api_resource: Dict,
collector: ApiCollector,
cwd: Optional[str] = None,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Extract APIs from AWS::Serverless::Api ... |
Extract APIs from AWS::Serverless::Api resource by reading and parsing Swagger documents. The result is added
to the collector.
Parameters
----------
stack_path : str
Path of the stack the resource is located
logical_id : str
Logical ID of the r... | _extract_from_serverless_api | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _extract_request_lambda_authorizer(
auth_name: str, function_name: str, prefix: str, properties: dict, event_type: str
) -> LambdaAuthorizer:
"""
Generates a request Lambda Authorizer from the given identity object
Parameters
----------
auth_name: str
... |
Generates a request Lambda Authorizer from the given identity object
Parameters
----------
auth_name: str
Name of the authorizer
function_name: str
Name of the Lambda function this authorizer uses
prefix: str
The prefix to prepend to ... | _extract_request_lambda_authorizer | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _extract_token_lambda_authorizer(
auth_name: str, function_name: str, prefix: str, identity_object: dict
) -> LambdaAuthorizer:
"""
Generates a token Lambda Authorizer from the given identity object
Parameters
----------
auth_name: str
Name of the aut... |
Generates a token Lambda Authorizer from the given identity object
Parameters
----------
auth_name: str
Name of the authorizer
function_name: str
Name of the Lambda function this authorizer uses
prefix: str
The prefix to prepend to id... | _extract_token_lambda_authorizer | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _extract_authorizers_from_props(logical_id: str, auth: dict, collector: ApiCollector, event_type: str) -> None:
"""
Extracts Authorizers from the Auth properties section of Serverless resources
Parameters
----------
logical_id: str
The logical ID of the Serverles... |
Extracts Authorizers from the Auth properties section of Serverless resources
Parameters
----------
logical_id: str
The logical ID of the Serverless resource
auth: dict
The Auth property dictionary
collector: ApiCollector
The Api Coll... | _extract_authorizers_from_props | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _extract_from_serverless_http(
self,
stack_path: str,
logical_id: str,
api_resource: Dict,
collector: ApiCollector,
cwd: Optional[str] = None,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Extract APIs from AWS::Serverless::Htt... |
Extract APIs from AWS::Serverless::HttpApi resource by reading and parsing Swagger documents.
The result is added to the collector.
Parameters
----------
stack_path : str
Path of the stack the resource is located
logical_id : str
Logical ID of t... | _extract_from_serverless_http | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _extract_routes_from_function(
self,
stack_path: str,
logical_id: str,
function_resource: Dict,
collector: ApiCollector,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Fetches a list of routes configured for this SAM Function resource.
... |
Fetches a list of routes configured for this SAM Function resource.
Parameters
----------
stack_path : str
Path of the stack the resource is located
logical_id : str
Logical ID of the resource
function_resource : dict
Contents of th... | _extract_routes_from_function | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def extract_routes_from_events(
self,
stack_path: str,
function_logical_id: str,
serverless_function_events: Dict,
collector: ApiCollector,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Given an AWS::Serverless::Function Event Dictionary, ... |
Given an AWS::Serverless::Function Event Dictionary, extract out all 'route' events and store within the
collector
Parameters
----------
stack_path : str
Path of the stack the resource is located
function_logical_id : str
LogicalId of the AWS::... | extract_routes_from_events | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _convert_event_route(
stack_path: str,
lambda_logical_id: str,
event_properties: Dict,
event_type: str,
disable_authorizer: Optional[bool] = False,
) -> Tuple[str, Route]:
"""
Converts a AWS::Serverless::Function's Event Property to an Route configuration ... |
Converts a AWS::Serverless::Function's Event Property to an Route configuration usable by the provider.
:param str stack_path: Path of the stack the resource is located
:param str lambda_logical_id: Logical Id of the AWS::Serverless::Function
:param dict event_properties: Dictionary of... | _convert_event_route | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def merge_routes(collector: ApiCollector) -> List[Route]:
"""
Quite often, an API is defined both in Implicit and Explicit Route definitions. In such cases, Implicit API
definition wins because that conveys clear intent that the API is backed by a function. This method will
merge two suc... |
Quite often, an API is defined both in Implicit and Explicit Route definitions. In such cases, Implicit API
definition wins because that conveys clear intent that the API is backed by a function. This method will
merge two such list of routes with the right order of precedence. If a Path+Method... | merge_routes | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _get_route_stack_depth(route: Route) -> int:
"""
Returns stack depth, used for sorted(routes, _get_route_stack_depth).
Examples:
"" (root stack), depth = 0
"A" (1-level nested stack), depth = 1
"A/B/C" (3-level nested stack), depth = 3
"""
... |
Returns stack depth, used for sorted(routes, _get_route_stack_depth).
Examples:
"" (root stack), depth = 0
"A" (1-level nested stack), depth = 1
"A/B/C" (3-level nested stack), depth = 3
| _get_route_stack_depth | python | aws/aws-sam-cli | samcli/lib/providers/sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_api_provider.py | Apache-2.0 |
def _extract_codeuri(resource_properties: Dict, code_property_key: str) -> str:
"""
Extracts the Function/Layer code path from the Resource Properties
Parameters
----------
resource_properties dict
Dictionary representing the Properties of the Resource
code_p... |
Extracts the Function/Layer code path from the Resource Properties
Parameters
----------
resource_properties dict
Dictionary representing the Properties of the Resource
code_property_key str
Property Key of the code on the Resource
Returns
... | _extract_codeuri | python | aws/aws-sam-cli | samcli/lib/providers/sam_base_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_base_provider.py | Apache-2.0 |
def _is_s3_location(location: Optional[Union[str, Dict]]) -> bool:
"""
the input could be:
- CodeUri of Serverless::Function
- Code of Lambda::Function
- ContentUri of Serverless::LayerVersion
- Content of Lambda::LayerVersion
"""
return (isinstance(locati... |
the input could be:
- CodeUri of Serverless::Function
- Code of Lambda::Function
- ContentUri of Serverless::LayerVersion
- Content of Lambda::LayerVersion
| _is_s3_location | python | aws/aws-sam-cli | samcli/lib/providers/sam_base_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_base_provider.py | Apache-2.0 |
def _is_ecr_uri(location: Optional[Union[str, Dict]]) -> bool:
"""
the input could be:
- ImageUri of Serverless::Function
- Code of Lambda::Function
"""
return location is not None and is_ecr_url(
str(location.get("ImageUri", "")) if isinstance(location, dict)... |
the input could be:
- ImageUri of Serverless::Function
- Code of Lambda::Function
| _is_ecr_uri | python | aws/aws-sam-cli | samcli/lib/providers/sam_base_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_base_provider.py | Apache-2.0 |
def get_template(
template_dict: Dict, parameter_overrides: Optional[Dict[str, str]] = None, use_sam_transform: bool = True
) -> Dict:
"""
Given a SAM template dictionary, return a cleaned copy of the template where SAM plugins have been run
and parameter values have been substituted... |
Given a SAM template dictionary, return a cleaned copy of the template where SAM plugins have been run
and parameter values have been substituted.
Parameters
----------
template_dict : dict
unprocessed SAM template dictionary
parameter_overrides: dict
... | get_template | python | aws/aws-sam-cli | samcli/lib/providers/sam_base_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_base_provider.py | Apache-2.0 |
def get_resolved_template_dict(
template_dict: Stack,
parameter_overrides: Optional[Dict[str, str]] = None,
normalize_resource_metadata: bool = True,
) -> Stack:
"""
Given a SAM template dictionary, return a cleaned copy of the template where SAM plugins have been run
... |
Given a SAM template dictionary, return a cleaned copy of the template where SAM plugins have been run
and parameter values have been substituted.
Parameters
----------
template_dict : dict
unprocessed SAM template dictionary
parameter_overrides: dict
... | get_resolved_template_dict | python | aws/aws-sam-cli | samcli/lib/providers/sam_base_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_base_provider.py | Apache-2.0 |
def _get_parameter_values(template_dict: Any, parameter_overrides: Optional[Dict]) -> Dict:
"""
Construct a final list of values for CloudFormation template parameters based on user-supplied values,
default values provided in template, and sane defaults for pseudo-parameters.
Parameters... |
Construct a final list of values for CloudFormation template parameters based on user-supplied values,
default values provided in template, and sane defaults for pseudo-parameters.
Parameters
----------
template_dict : dict
SAM template dictionary
parameter... | _get_parameter_values | python | aws/aws-sam-cli | samcli/lib/providers/sam_base_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_base_provider.py | Apache-2.0 |
def _get_default_parameter_values(sam_template: Dict) -> Dict:
"""
Method to read default values for template parameters and return it
Example:
If the template contains the following parameters defined
Parameters:
Param1:
Type: String
D... |
Method to read default values for template parameters and return it
Example:
If the template contains the following parameters defined
Parameters:
Param1:
Type: String
Default: default_value1
Param2:
Type: String
... | _get_default_parameter_values | python | aws/aws-sam-cli | samcli/lib/providers/sam_base_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_base_provider.py | Apache-2.0 |
def __init__(
self,
stacks: List[Stack],
use_raw_codeuri: bool = False,
ignore_code_extraction_warnings: bool = False,
locate_layer_nested: bool = False,
) -> None:
"""
Initialize the class with SAM template data. The SAM template passed to this provider is as... |
Initialize the class with SAM template data. The SAM template passed to this provider is assumed
to be valid, normalized and a dictionary. It should be normalized by running all pre-processing
before passing to this class. The process of normalization will remove structures like ``Globals``, re... | __init__ | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def update(
self,
stacks: List[Stack],
use_raw_codeuri: bool = False,
ignore_code_extraction_warnings: bool = False,
locate_layer_nested: bool = False,
) -> None:
"""
Hydrate the function provider with updated stacks
:param dict stacks: List of stacks ... |
Hydrate the function provider with updated stacks
:param dict stacks: List of stacks functions are extracted from
:param bool use_raw_codeuri: Do not resolve adjust core_uri based on the template path, use the raw uri.
Note(xinhol): use_raw_codeuri is temporary to fix a bug, and wil... | update | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def get(self, name: str) -> Optional[Function]:
"""
Returns the function given name or LogicalId of the function. Every SAM resource has a logicalId, but it may
also have a function name. This method searches only for LogicalID and returns the function that matches.
If it is in a nested ... |
Returns the function given name or LogicalId of the function. Every SAM resource has a logicalId, but it may
also have a function name. This method searches only for LogicalID and returns the function that matches.
If it is in a nested stack, "name" can be prefixed with stack path to avoid ambi... | get | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _extract_functions(
stacks: List[Stack],
use_raw_codeuri: bool = False,
ignore_code_extraction_warnings: bool = False,
locate_layer_nested: bool = False,
) -> Dict[str, Function]:
"""
Extracts and returns function information from the given dictionary of SAM/Cloud... |
Extracts and returns function information from the given dictionary of SAM/CloudFormation resources. This
method supports functions defined with AWS::Serverless::Function and AWS::Lambda::Function
:param stacks: List of SAM/CloudFormation stacks to extract functions from
:param bool us... | _extract_functions | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _convert_sam_function_resource(
stack: Stack,
name: str,
resource_properties: Dict,
layers: List[LayerVersion],
use_raw_codeuri: bool = False,
) -> Function:
"""
Converts a AWS::Serverless::Function resource to a Function configuration usable by the provid... |
Converts a AWS::Serverless::Function resource to a Function configuration usable by the provider.
Parameters
----------
name str
LogicalID of the resource NOTE: This is *not* the function name because not all functions declare a name
resource_properties dict
... | _convert_sam_function_resource | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _get_function_id(resource_properties: Dict, logical_id: str) -> str:
"""
Get unique id for Function resource.
For CFN/SAM project, this function id is the logical id.
For CDK project, this function id is the user-defined resource id, or the logical id if the resource id is not
... |
Get unique id for Function resource.
For CFN/SAM project, this function id is the logical id.
For CDK project, this function id is the user-defined resource id, or the logical id if the resource id is not
found.
Parameters
----------
resource_properties str
... | _get_function_id | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _convert_lambda_function_resource(
stack: Stack,
name: str,
resource_properties: Dict,
layers: List[LayerVersion],
use_raw_codeuri: bool = False,
) -> Function:
"""
Converts a AWS::Lambda::Function resource to a Function configuration usable by the provide... |
Converts a AWS::Lambda::Function resource to a Function configuration usable by the provider.
Parameters
----------
name str
LogicalID of the resource NOTE: This is *not* the function name because not all functions declare a name
resource_properties dict
... | _convert_lambda_function_resource | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _build_function_configuration(
stack: Stack,
function_id: str,
name: str,
codeuri: Optional[str],
resource_properties: Dict,
layers: List,
inlinecode: Optional[str],
imageuri: Optional[str],
use_raw_codeuri: bool = False,
) -> Function:
... |
Builds a Function configuration usable by the provider.
Parameters
----------
name str
LogicalID of the resource NOTE: This is *not* the function name because not all functions declare a name
function_id str
Unique function id
codeuri str
... | _build_function_configuration | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _parse_layer_info(
stack: Stack,
list_of_layers: List[Any],
use_raw_codeuri: bool = False,
ignore_code_extraction_warnings: bool = False,
locate_layer_nested: bool = False,
stacks: Optional[List[Stack]] = None,
function_id: Optional[str] = None,
) -> List[... |
Creates a list of Layer objects that are represented by the resources and the list of layers
Parameters
----------
stack : Stack
The stack the layer is defined in
list_of_layers : List[Any]
List of layers that are defined within the Layers Property on a ... | _parse_layer_info | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _locate_layer_from_nested( # pylint: disable=too-many-return-statements
stack: Stack,
stacks: List[Stack],
layer: Any,
use_raw_codeuri: bool = False,
ignore_code_extraction_warnings: bool = False,
) -> Optional[LayerVersion]:
"""
Search the layer referenc... |
Search the layer reference through all the local templates and try to find it's actual location then create a
layer object and return
Right now this method does not support more complicated intrinsics like Fn:Sub and Fn:If, future task to
expand support. One of possible solutions can b... | _locate_layer_from_nested | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def __init__(
self,
stacks: List[Stack],
parameter_overrides: Optional[Dict] = None,
global_parameter_overrides: Optional[Dict] = None,
use_raw_codeuri: bool = False,
ignore_code_extraction_warnings: bool = False,
) -> None:
"""
Initialize the class wi... |
Initialize the class with SAM template data. The SAM template passed to this provider is assumed
to be valid, normalized and a dictionary. It should be normalized by running all pre-processing
before passing to this class. The process of normalization will remove structures like ``Globals``, re... | __init__ | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def stacks(self) -> List[Stack]:
"""
It Checks if any template got changed, then refresh the loaded stacks, and functions.
Returns the list of stacks (including the root stack and all children stacks)
:return list: list of stacks
"""
if self.is_changed:
self... |
It Checks if any template got changed, then refresh the loaded stacks, and functions.
Returns the list of stacks (including the root stack and all children stacks)
:return list: list of stacks
| stacks | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def get(self, name: str) -> Optional[Function]:
"""
It Checks if any template got changed, then refresh the loaded functions before finding the required function.
Returns the function given name or LogicalId of the function. Every SAM resource has a logicalId, but it may
also have a fun... |
It Checks if any template got changed, then refresh the loaded functions before finding the required function.
Returns the function given name or LogicalId of the function. Every SAM resource has a logicalId, but it may
also have a function name. This method searches only for LogicalID and ret... | get | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def get_all(self) -> Iterator[Function]:
"""
It Checks if any template got changed, then refresh the loaded functions before returning all available
functions.
Yields all the Lambda functions available in the SAM Template.
:yields Function: namedtuple containing the function in... |
It Checks if any template got changed, then refresh the loaded functions before returning all available
functions.
Yields all the Lambda functions available in the SAM Template.
:yields Function: namedtuple containing the function information
| get_all | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def _refresh_loaded_functions(self) -> None:
"""
Reload the stacks, and lambda functions from template files.
"""
LOG.debug("A change got detected in one of the stack templates. Reload the lambda function resources")
self._stacks = []
for template_file in self.parent_tem... |
Reload the stacks, and lambda functions from template files.
| _refresh_loaded_functions | python | aws/aws-sam-cli | samcli/lib/providers/sam_function_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_function_provider.py | Apache-2.0 |
def __init__(self, stacks: List[Stack], use_raw_codeuri: bool = False) -> None:
"""
Initialize the class with SAM template data. The SAM template passed to this provider is assumed
to be valid, normalized and a dictionary. It should be normalized by running all pre-processing
before pass... |
Initialize the class with SAM template data. The SAM template passed to this provider is assumed
to be valid, normalized and a dictionary. It should be normalized by running all pre-processing
before passing to this class. The process of normalization will remove structures like ``Globals``, re... | __init__ | python | aws/aws-sam-cli | samcli/lib/providers/sam_layer_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_layer_provider.py | Apache-2.0 |
def get(self, name: str) -> Optional[LayerVersion]:
"""
Returns the layer with given name or logical id.
If it is in a nested stack, name can be prefixed with stack path to avoid ambiguity
Parameters
----------
name: name or logical id of the layer.
Returns
... |
Returns the layer with given name or logical id.
If it is in a nested stack, name can be prefixed with stack path to avoid ambiguity
Parameters
----------
name: name or logical id of the layer.
Returns
-------
LayerVersion object of one layer.
| get | python | aws/aws-sam-cli | samcli/lib/providers/sam_layer_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_layer_provider.py | Apache-2.0 |
def _extract_layers(self) -> List[LayerVersion]:
"""
Extracts all resources with Type AWS::Lambda::LayerVersion and AWS::Serverless::LayerVersion and return a list
of those resources.
"""
layers = []
for stack in self._stacks:
for name, resource in stack.resou... |
Extracts all resources with Type AWS::Lambda::LayerVersion and AWS::Serverless::LayerVersion and return a list
of those resources.
| _extract_layers | python | aws/aws-sam-cli | samcli/lib/providers/sam_layer_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_layer_provider.py | Apache-2.0 |
def _convert_lambda_layer_resource(
self,
stack: Stack,
layer_logical_id: str,
codeuri: str,
compatible_runtimes: Optional[List[str]],
metadata: Optional[Dict],
compatible_architectures: Optional[List[str]],
) -> LayerVersion:
"""
Convert layer... |
Convert layer resource into {LayerVersion} object.
Parameters
----------
stack
layer_logical_id
LogicalID of resource.
codeuri
codeuri of the layer
compatible_runtimes
list of compatible runtimes
metadata
di... | _convert_lambda_layer_resource | python | aws/aws-sam-cli | samcli/lib/providers/sam_layer_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_layer_provider.py | Apache-2.0 |
def __init__(
self,
template_file: str,
stack_path: str,
template_dict: Dict,
parameter_overrides: Optional[Dict] = None,
global_parameter_overrides: Optional[Dict] = None,
use_sam_transform: bool = True,
):
"""
Initialize the class with SAM te... |
Initialize the class with SAM template data. The SAM template passed to this provider is assumed
to be valid and a dictionary. This class will perform template normalization to remove structures
like ``Globals``, resolve intrinsic functions etc.
This class does not perform any syntactic... | __init__ | python | aws/aws-sam-cli | samcli/lib/providers/sam_stack_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_stack_provider.py | Apache-2.0 |
def get(self, name: str) -> Optional[Stack]:
"""
Returns the application given name or LogicalId of the application.
Every SAM resource has a logicalId, but it may
also have a application name. This method searches only for LogicalID and returns the application that matches
it.
... |
Returns the application given name or LogicalId of the application.
Every SAM resource has a logicalId, but it may
also have a application name. This method searches only for LogicalID and returns the application that matches
it.
:param string name: Name of the application
... | get | python | aws/aws-sam-cli | samcli/lib/providers/sam_stack_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_stack_provider.py | Apache-2.0 |
def _extract_stacks(self) -> None:
"""
Extracts and returns nested application information from the given dictionary of SAM/CloudFormation resources.
This method supports applications defined with AWS::Serverless::Application
The dictionary of application LogicalId to the Application obj... |
Extracts and returns nested application information from the given dictionary of SAM/CloudFormation resources.
This method supports applications defined with AWS::Serverless::Application
The dictionary of application LogicalId to the Application object will be assigned to self._stacks.
... | _extract_stacks | python | aws/aws-sam-cli | samcli/lib/providers/sam_stack_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_stack_provider.py | Apache-2.0 |
def get_stacks(
template_file: Optional[str] = None,
stack_path: str = "",
name: str = "",
parameter_overrides: Optional[Dict] = None,
global_parameter_overrides: Optional[Dict] = None,
metadata: Optional[Dict] = None,
template_dictionary: Optional[Dict] = None,
... |
Recursively extract stacks from a template file.
Parameters
----------
template_file: str
the file path of the template to extract stacks from. Only one of either template_dict or template_file
is required
stack_path: str
the stack path of th... | get_stacks | python | aws/aws-sam-cli | samcli/lib/providers/sam_stack_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_stack_provider.py | Apache-2.0 |
def merge_parameter_overrides(
parameter_overrides: Optional[Dict], global_parameter_overrides: Optional[Dict]
) -> Dict:
"""
Combine global parameters and stack-specific parameters.
Right now the only global parameter override available is AWS::Region (via --region in "sam local"),
... |
Combine global parameters and stack-specific parameters.
Right now the only global parameter override available is AWS::Region (via --region in "sam local"),
and AWS::Region won't appear in normal stack-specific parameter_overrides, so we don't
specify which type of parameters have high... | merge_parameter_overrides | python | aws/aws-sam-cli | samcli/lib/providers/sam_stack_provider.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/providers/sam_stack_provider.py | Apache-2.0 |
def validate_action_parameters(self, parameters: dict) -> None:
"""
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
"""
for parameter_key, pa... |
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
| validate_action_parameters | python | aws/aws-sam-cli | samcli/lib/remote_invoke/kinesis_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/kinesis_invoke_executors.py | Apache-2.0 |
def _execute_action(self, payload: str) -> RemoteInvokeIterableResponseType:
"""
Calls "put_record" method to write single data record to Kinesis data stream.
Parameters
----------
payload: str
The Data record which will be sent to the Kinesis stream
Yields
... |
Calls "put_record" method to write single data record to Kinesis data stream.
Parameters
----------
payload: str
The Data record which will be sent to the Kinesis stream
Yields
------
RemoteInvokeIterableResponseType
Response that is con... | _execute_action | python | aws/aws-sam-cli | samcli/lib/remote_invoke/kinesis_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/kinesis_invoke_executors.py | Apache-2.0 |
def validate_action_parameters(self, parameters: dict) -> None:
"""
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
"""
for parameter_key, pa... |
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
| validate_action_parameters | python | aws/aws-sam-cli | samcli/lib/remote_invoke/lambda_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/lambda_invoke_executors.py | Apache-2.0 |
def _is_function_invoke_mode_response_stream(lambda_client: LambdaClient, function_name: str):
"""
Returns True if given function has RESPONSE_STREAM as InvokeMode, False otherwise
"""
try:
function_url_config = lambda_client.get_function_url_config(FunctionName=function_name)
function_i... |
Returns True if given function has RESPONSE_STREAM as InvokeMode, False otherwise
| _is_function_invoke_mode_response_stream | python | aws/aws-sam-cli | samcli/lib/remote_invoke/lambda_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/lambda_invoke_executors.py | Apache-2.0 |
def execute(self, remote_invoke_input: RemoteInvokeExecutionInfo) -> RemoteInvokeIterableResponseType:
"""
Executes boto3 API and updates response or exception object depending on the result
Parameters
----------
remote_invoke_input : RemoteInvokeExecutionInfo
Remote... |
Executes boto3 API and updates response or exception object depending on the result
Parameters
----------
remote_invoke_input : RemoteInvokeExecutionInfo
Remote execution details which contains payload or payload file information
Returns
-------
Rem... | execute | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executors.py | Apache-2.0 |
def execute(self, remote_invoke_input: RemoteInvokeExecutionInfo) -> None:
"""
First runs all mappers for request object to get the final version of it.
Then validates all the input boto parameters and invokes the BotoActionExecutor to get the result
And finally, runs all mappers for the... |
First runs all mappers for request object to get the final version of it.
Then validates all the input boto parameters and invokes the BotoActionExecutor to get the result
And finally, runs all mappers for the response object to get the final form of it.
| execute | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executors.py | Apache-2.0 |
def _map_input(self, remote_invoke_input: RemoteInvokeExecutionInfo) -> RemoteInvokeExecutionInfo:
"""
Maps the given input through the request mapper list.
Parameters
----------
remote_invoke_input : RemoteInvokeExecutionInfo
Given remote invoke execution info which... |
Maps the given input through the request mapper list.
Parameters
----------
remote_invoke_input : RemoteInvokeExecutionInfo
Given remote invoke execution info which contains the request information
Returns
-------
RemoteInvokeExecutionInfo
... | _map_input | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executors.py | Apache-2.0 |
def _map_output(self, remote_invoke_output: RemoteInvokeResponse) -> RemoteInvokeResponse:
"""
Maps the given response through the response mapper list.
Parameters
----------
remote_invoke_output : RemoteInvokeResponse
Given remote invoke response which contains the ... |
Maps the given response through the response mapper list.
Parameters
----------
remote_invoke_output : RemoteInvokeResponse
Given remote invoke response which contains the payload itself
Returns
-------
RemoteInvokeResponse
Returns the m... | _map_output | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executors.py | Apache-2.0 |
def create_remote_invoke_executor(
self,
cfn_resource_summary: CloudFormationResourceSummary,
output_format: RemoteInvokeOutputFormat,
response_consumer: RemoteInvokeConsumer[RemoteInvokeResponse],
log_consumer: RemoteInvokeConsumer[RemoteInvokeLogOutput],
) -> Optional[Remot... |
Creates remote invoker with given CloudFormationResourceSummary
Parameters
----------
cfn_resource_summary : CloudFormationResourceSummary
Information about the resource, which RemoteInvokeExecutor will be created for
output_format: RemoteInvokeOutputFormat
... | create_remote_invoke_executor | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executor_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executor_factory.py | Apache-2.0 |
def _create_lambda_boto_executor(
self,
cfn_resource_summary: CloudFormationResourceSummary,
remote_invoke_output_format: RemoteInvokeOutputFormat,
response_consumer: RemoteInvokeConsumer[RemoteInvokeResponse],
log_consumer: RemoteInvokeConsumer[RemoteInvokeLogOutput],
) -> R... | Creates a remote invoke executor for Lambda resource type based on
the boto action being called.
Parameters
----------
cfn_resource_summary: CloudFormationResourceSummary
Information about the Lambda resource
remote_invoke_output_format: RemoteInvokeOutputFormat
... | _create_lambda_boto_executor | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executor_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executor_factory.py | Apache-2.0 |
def _create_stepfunctions_boto_executor(
self,
cfn_resource_summary: CloudFormationResourceSummary,
remote_invoke_output_format: RemoteInvokeOutputFormat,
response_consumer: RemoteInvokeConsumer[RemoteInvokeResponse],
log_consumer: RemoteInvokeConsumer[RemoteInvokeLogOutput],
... | Creates a remote invoke executor for Step Functions resource type based on
the boto action being called.
Parameters
----------
cfn_resource_summary: CloudFormationResourceSummary
Information about the Step Function resource
remote_invoke_output_format: RemoteInvokeOu... | _create_stepfunctions_boto_executor | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executor_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executor_factory.py | Apache-2.0 |
def _create_sqs_boto_executor(
self,
cfn_resource_summary: CloudFormationResourceSummary,
remote_invoke_output_format: RemoteInvokeOutputFormat,
response_consumer: RemoteInvokeConsumer[RemoteInvokeResponse],
log_consumer: RemoteInvokeConsumer[RemoteInvokeLogOutput],
) -> Remo... | Creates a remote invoke executor for SQS resource type based on
the boto action being called.
Parameters
----------
cfn_resource_summary: CloudFormationResourceSummary
Information about the SQS resource
remote_invoke_output_format: RemoteInvokeOutputFormat
... | _create_sqs_boto_executor | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executor_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executor_factory.py | Apache-2.0 |
def _create_kinesis_boto_executor(
self,
cfn_resource_summary: CloudFormationResourceSummary,
remote_invoke_output_format: RemoteInvokeOutputFormat,
response_consumer: RemoteInvokeConsumer[RemoteInvokeResponse],
log_consumer: RemoteInvokeConsumer[RemoteInvokeLogOutput],
) -> ... | Creates a remote invoke executor for Kinesis resource type based on
the boto action being called.
Parameters
----------
cfn_resource_summary: CloudFormationResourceSummary
Information about the Kinesis stream resource
remote_invoke_output_format: RemoteInvokeOutputFo... | _create_kinesis_boto_executor | python | aws/aws-sam-cli | samcli/lib/remote_invoke/remote_invoke_executor_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/remote_invoke_executor_factory.py | Apache-2.0 |
def validate_action_parameters(self, parameters: dict) -> None:
"""
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
"""
try:
for ... |
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
| validate_action_parameters | python | aws/aws-sam-cli | samcli/lib/remote_invoke/sqs_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/sqs_invoke_executors.py | Apache-2.0 |
def _execute_action(self, payload: str) -> RemoteInvokeIterableResponseType:
"""
Calls "send_message" method to send a message to the SQS queue.
Parameters
----------
payload: str
The MessageBody which will be sent to the SQS
Yields
------
Re... |
Calls "send_message" method to send a message to the SQS queue.
Parameters
----------
payload: str
The MessageBody which will be sent to the SQS
Yields
------
RemoteInvokeIterableResponseType
Response that is consumed by remote invoke co... | _execute_action | python | aws/aws-sam-cli | samcli/lib/remote_invoke/sqs_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/sqs_invoke_executors.py | Apache-2.0 |
def get_queue_url_from_arn(sqs_client: SQSClient, queue_name: str) -> str:
"""
This function gets the queue url of the provided SQS queue name
Parameters
----------
sqs_client: SQSClient
SQS client to call boto3 APIs
queue_name: str
Name of SQS queue used to get the queue_url
... |
This function gets the queue url of the provided SQS queue name
Parameters
----------
sqs_client: SQSClient
SQS client to call boto3 APIs
queue_name: str
Name of SQS queue used to get the queue_url
Returns
-------
str
Returns the SQS queue url
| get_queue_url_from_arn | python | aws/aws-sam-cli | samcli/lib/remote_invoke/sqs_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/sqs_invoke_executors.py | Apache-2.0 |
def validate_action_parameters(self, parameters: dict) -> None:
"""
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
"""
for parameter_key, pa... |
Validates the input boto parameters and prepares the parameters for calling the API.
Parameters
----------
parameters: dict
Boto parameters provided as input
| validate_action_parameters | python | aws/aws-sam-cli | samcli/lib/remote_invoke/stepfunctions_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/stepfunctions_invoke_executors.py | Apache-2.0 |
def _execute_action(self, payload: str) -> RemoteInvokeIterableResponseType:
"""
Calls "start_execution" method to start the execution and waits
for the execution to complete using the "describe_execution" method
Parameters
----------
payload: str
The input w... |
Calls "start_execution" method to start the execution and waits
for the execution to complete using the "describe_execution" method
Parameters
----------
payload: str
The input which is passed to the execution
Yields
------
RemoteInvokeItera... | _execute_action | python | aws/aws-sam-cli | samcli/lib/remote_invoke/stepfunctions_invoke_executors.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/remote_invoke/stepfunctions_invoke_executors.py | Apache-2.0 |
def normalize(template_dict, normalize_parameters=False):
"""
Normalize all Resources in the template with the Metadata Key on the resource.
This method will mutate the template
Parameters
----------
template_dict dict
Dictionary representing the template
... |
Normalize all Resources in the template with the Metadata Key on the resource.
This method will mutate the template
Parameters
----------
template_dict dict
Dictionary representing the template
| normalize | python | aws/aws-sam-cli | samcli/lib/samlib/resource_metadata_normalizer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/resource_metadata_normalizer.py | Apache-2.0 |
def _replace_property(property_key, property_value, resource, logical_id):
"""
Replace a property with an asset on a given resource
This method will mutate the template
Parameters
----------
property str
The property to replace on the resource
proper... |
Replace a property with an asset on a given resource
This method will mutate the template
Parameters
----------
property str
The property to replace on the resource
property_value str
The new value of the property
resource dict
... | _replace_property | python | aws/aws-sam-cli | samcli/lib/samlib/resource_metadata_normalizer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/resource_metadata_normalizer.py | Apache-2.0 |
def _extract_image_asset_metadata(metadata):
"""
Extract/create relevant metadata properties for image assets
Parameters
----------
metadata dict
Metadata to use for extracting image assets properties
Returns
-------
dict
metadata... |
Extract/create relevant metadata properties for image assets
Parameters
----------
metadata dict
Metadata to use for extracting image assets properties
Returns
-------
dict
metadata properties for image-type lambda function
| _extract_image_asset_metadata | python | aws/aws-sam-cli | samcli/lib/samlib/resource_metadata_normalizer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/resource_metadata_normalizer.py | Apache-2.0 |
def _update_resource_metadata(metadata, updated_values):
"""
Update the metadata values for image-type lambda functions
This method will mutate the template
Parameters
----------
metadata dict
Metadata dict to be updated
updated_values dict
... |
Update the metadata values for image-type lambda functions
This method will mutate the template
Parameters
----------
metadata dict
Metadata dict to be updated
updated_values dict
Dict of key-value pairs to append to the existing metadata
... | _update_resource_metadata | python | aws/aws-sam-cli | samcli/lib/samlib/resource_metadata_normalizer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/resource_metadata_normalizer.py | Apache-2.0 |
def get_resource_id(resource_properties, logical_id):
"""
Get unique id for a resource.
for any resource, the resource id can be the customer defined id if exist, if not exist it can be the
cdk-defined resource id, or the logical id if the resource id is not found.
Parameters
... |
Get unique id for a resource.
for any resource, the resource id can be the customer defined id if exist, if not exist it can be the
cdk-defined resource id, or the logical id if the resource id is not found.
Parameters
----------
resource_properties dict
Pro... | get_resource_id | python | aws/aws-sam-cli | samcli/lib/samlib/resource_metadata_normalizer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/resource_metadata_normalizer.py | Apache-2.0 |
def normalize_build_properties(build_props) -> Dict:
"""
Convert PascalCase properties in the template to snake case to be consistent with
what Lambda Builders expects from its properties
:param build_props: Properties to be passed to Lambda Builders
:return: dict of normalized ... |
Convert PascalCase properties in the template to snake case to be consistent with
what Lambda Builders expects from its properties
:param build_props: Properties to be passed to Lambda Builders
:return: dict of normalized properties
| normalize_build_properties | python | aws/aws-sam-cli | samcli/lib/samlib/resource_metadata_normalizer.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/resource_metadata_normalizer.py | Apache-2.0 |
def __init__(self, sam_template, parameter_values=None, offline_fallback=True):
"""
Parameters
----------
sam_template dict:
SAM Template dictionary
parameter_values dict:
SAM Template parameters (must contain psuedo and default parameters)
offlin... |
Parameters
----------
sam_template dict:
SAM Template dictionary
parameter_values dict:
SAM Template parameters (must contain psuedo and default parameters)
offline_fallback bool:
Set it to True to make the translator work entirely offline, i... | __init__ | python | aws/aws-sam-cli | samcli/lib/samlib/wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/wrapper.py | Apache-2.0 |
def _patch_language_extensions(self) -> None:
"""
Monkey patch SamResource.valid function to exclude checking DeletionPolicy
and UpdateReplacePolicy when language extensions are set
"""
template_copy = self.template
if self._check_using_language_extension(template_copy):
... |
Monkey patch SamResource.valid function to exclude checking DeletionPolicy
and UpdateReplacePolicy when language extensions are set
| _patch_language_extensions | python | aws/aws-sam-cli | samcli/lib/samlib/wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/wrapper.py | Apache-2.0 |
def _check_using_language_extension(template: Dict) -> bool:
"""
Check if language extensions are set in the template's Transform
:param template: template to check
:return: True if language extensions are set in the template, False otherwise
"""
transform = template.get(... |
Check if language extensions are set in the template's Transform
:param template: template to check
:return: True if language extensions are set in the template, False otherwise
| _check_using_language_extension | python | aws/aws-sam-cli | samcli/lib/samlib/wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/wrapper.py | Apache-2.0 |
def _validate(sam_template: Dict) -> None:
"""Validates the template and parameter values and raises exceptions if there's an issue
:param dict sam_template: SAM template
"""
if (
"Resources" not in sam_template
or not isinstance(sam_template["Resources"], dict)... | Validates the template and parameter values and raises exceptions if there's an issue
:param dict sam_template: SAM template
| _validate | python | aws/aws-sam-cli | samcli/lib/samlib/wrapper.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/samlib/wrapper.py | Apache-2.0 |
def do_paginate_cli(pages, page_to_be_rendered, items_per_page, is_last_page, cli_display_message):
"""
Responsible for displaying a generic CLI page with available user choices for pagination/seletion
:param pages:
:param page_to_be_rendered:
:param items_per_page:
:param is_last_page:
:par... |
Responsible for displaying a generic CLI page with available user choices for pagination/seletion
:param pages:
:param page_to_be_rendered:
:param items_per_page:
:param is_last_page:
:param cli_display_message:
:return: User decision on displayed page
| do_paginate_cli | python | aws/aws-sam-cli | samcli/lib/schemas/cli_paginator.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/schemas/cli_paginator.py | Apache-2.0 |
def list_schema_versions(self, registry_name, schema_name):
"""
Calls schemas service to list all schema versions.
Parameters
----------
registry_name:
Registry name
schema_name:
Schema Name
Returns
-------
List of Schema ... |
Calls schemas service to list all schema versions.
Parameters
----------
registry_name:
Registry name
schema_name:
Schema Name
Returns
-------
List of Schema versions
| list_schema_versions | python | aws/aws-sam-cli | samcli/lib/schemas/schemas_api_caller.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/schemas/schemas_api_caller.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.