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_schema_metadata(self, registry_name, schema_name):
"""
Calls schemas service to get schema metadata.
Parameters
----------
registry_name:
Registry Name
schema_name:
Schema Name
Returns
-------
Schema metadata
... |
Calls schemas service to get schema metadata.
Parameters
----------
registry_name:
Registry Name
schema_name:
Schema Name
Returns
-------
Schema metadata
| get_schema_metadata | 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 |
def download_source_code_binding(self, runtime, registry_name, schema_name, schema_version, download_location):
"""
Calls schemas service to download code binding for given schema in download_location.
Parameters
----------
runtime:
Code binding runtime e.g: Java, Py... |
Calls schemas service to download code binding for given schema in download_location.
Parameters
----------
runtime:
Code binding runtime e.g: Java, Python, Go
registry_name:
Registry Name
schema_name:
Schema Name
schema_versi... | download_source_code_binding | 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 |
def put_code_binding(self, runtime, registry_name, schema_name, schema_version):
"""
Calls schemas service to generate code binding for given schema.
Parameters
----------
runtime:
Code binding runtime e.g: Java, Python, Go
registry_name:
Registry... |
Calls schemas service to generate code binding for given schema.
Parameters
----------
runtime:
Code binding runtime e.g: Java, Python, Go
registry_name:
Registry Name
schema_name:
Schema Name
schema_version:
Schem... | put_code_binding | 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 |
def poll_for_code_binding_status(self, schemas_runtime, registry_name, schema_name, schema_version):
"""
Calls schemas service and wait for code binding to be generated.
Parameters
----------
schemas_runtime:
Code binding runtime e.g: Java, Python, Go
registr... |
Calls schemas service and wait for code binding to be generated.
Parameters
----------
schemas_runtime:
Code binding runtime e.g: Java, Python, Go
registry_name:
Registry Name
schema_name:
Schema Name
schema_version:
... | poll_for_code_binding_status | 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 |
def discover_schema(self, event_data: str, schema_type: str) -> str:
"""
Returns a schema based on an event using the DiscoverSchema API
Parameters
----------
event_data:
A JSON test event as a string
schema_type:
Type of the schema to generate ("... |
Returns a schema based on an event using the DiscoverSchema API
Parameters
----------
event_data:
A JSON test event as a string
schema_type:
Type of the schema to generate ("OpenApi3" or "JSONSchemaDraft4")
Returns
-------
Generat... | discover_schema | 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 |
def create_schema(self, schema: str, registry_name: str, schema_name: str, schema_type: str):
"""
Creates a new schema in the specified registry
Parameters
----------
schema:
Contents for the schema to be created
registry_name:
The registry the sc... |
Creates a new schema in the specified registry
Parameters
----------
schema:
Contents for the schema to be created
registry_name:
The registry the schema will be created in
schema_name:
The name for the new created schema
sche... | create_schema | 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 |
def update_schema(self, schema: str, registry_name: str, schema_name: str, schema_type: str):
"""
Updates an existing schema
Parameters
----------
schema:
Contents for the updated schema
registry_name:
The registry of the schema that will be updat... |
Updates an existing schema
Parameters
----------
schema:
Contents for the updated schema
registry_name:
The registry of the schema that will be updated
schema_name:
The name of the schema to be updated
schema_type:
... | update_schema | 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 |
def get_schema(self, registry_name: str, schema_name: str) -> str:
"""
Gets a schema from the registry
Parameters
----------
registry_name:
The registry of the schema that will be updated
schema_name:
The name of the schema to be updated
R... |
Gets a schema from the registry
Parameters
----------
registry_name:
The registry of the schema that will be updated
schema_name:
The name of the schema to be updated
Returns
-------
A schema dict
| get_schema | 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 |
def check_registry_exists(self, registry_name: str) -> bool:
"""
Gets a registry with the specified name
Parameters
----------
registry_name:
The name of the registry to fetch
Returns
-------
The specified registry, or None if it does not exis... |
Gets a registry with the specified name
Parameters
----------
registry_name:
The name of the registry to fetch
Returns
-------
The specified registry, or None if it does not exist
| check_registry_exists | 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 |
def create_registry(self, registry_name: str):
"""
Creates a new registry with the specified name
Parameters
----------
registry_name:
The name of the registry to be created
"""
try:
LOG.debug("Creating registry %s.", registry_name)
... |
Creates a new registry with the specified name
Parameters
----------
registry_name:
The name of the registry to be created
| create_registry | 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 |
def delete_schema(self, registry_name, schema_name) -> bool:
"""
Deletes a schema from the EBSR
Parameters
----------
registry_name:
The registry that contains the schema that will be deleted
schema_name:
The name of the schema to be deleted
... |
Deletes a schema from the EBSR
Parameters
----------
registry_name:
The registry that contains the schema that will be deleted
schema_name:
The name of the schema to be deleted
| delete_schema | 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 |
def delete_version(self, registry_name, schema_name, schema_version: str):
"""
Delete a version of a schema
Parameters
----------
registry_name:
The registry that contains the schema
schema_name:
The name of the schema
schema_version:
... |
Delete a version of a schema
Parameters
----------
registry_name:
The registry that contains the schema
schema_name:
The name of the schema
schema_version:
Version to be deleted
| delete_version | 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 |
def get_aws_configuration_choice():
"""
Allow user to select their AWS Connection configuration (profile/region)
:return: AWS profile and region dictionary
"""
session = Session()
profile = session.profile_name
region = session.region_name
message = f"\nDo you want to use the default AW... |
Allow user to select their AWS Connection configuration (profile/region)
:return: AWS profile and region dictionary
| get_aws_configuration_choice | python | aws/aws-sam-cli | samcli/lib/schemas/schemas_aws_config.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/schemas/schemas_aws_config.py | Apache-2.0 |
def do_download_source_code_binding(runtime, schema_template_details, schemas_api_caller, download_location):
"""
Downloads source code binding for given registry and schema version,
generating the code bindings if they haven't been generated first
:param runtime: Lambda runtime
:param schema_templa... |
Downloads source code binding for given registry and schema version,
generating the code bindings if they haven't been generated first
:param runtime: Lambda runtime
:param schema_template_details: e.g: registry_name, schema_name, schema_version
:param schemas_api_caller: the schemas api caller obj... | do_download_source_code_binding | python | aws/aws-sam-cli | samcli/lib/schemas/schemas_code_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/schemas/schemas_code_manager.py | Apache-2.0 |
def do_extract_and_merge_schemas_code(download_location, output_dir, project_name, template_location):
"""
Unzips schemas generated code and merge it with cookiecutter genertaed source.
:param download_location:
:param output_dir:
:param project_name:
:param template_location:
"""
click.... |
Unzips schemas generated code and merge it with cookiecutter genertaed source.
:param download_location:
:param output_dir:
:param project_name:
:param template_location:
| do_extract_and_merge_schemas_code | python | aws/aws-sam-cli | samcli/lib/schemas/schemas_code_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/schemas/schemas_code_manager.py | Apache-2.0 |
def _validate_event_size(self, event: str):
"""
Raises an EventTooLarge exception if the event is bigger than accepted
Parameters
----------
event : str
Contents of the event to validate
Raises
------
EventTooLarge
When the event ... |
Raises an EventTooLarge exception if the event is bigger than accepted
Parameters
----------
event : str
Contents of the event to validate
Raises
------
EventTooLarge
When the event is bigger than the accepted Lambda invocation payload s... | _validate_event_size | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def _get_schema_name(self, function_resource: CloudFormationResourceSummary) -> str:
"""
Get the schema name for a specific function according to the Lambda convention
Parameters
----------
function_resource : CloudFormationResourceSummary
The function resource
... |
Get the schema name for a specific function according to the Lambda convention
Parameters
----------
function_resource : CloudFormationResourceSummary
The function resource
| _get_schema_name | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def add_event_to_schema(self, schema: str, event: str, event_name: str, replace_if_exists: bool = False) -> str:
"""
Adds an event to a schema
Parameters
---------
schema:
The schema the event will be added to
event:
The event that will be added t... |
Adds an event to a schema
Parameters
---------
schema:
The schema the event will be added to
event:
The event that will be added to the schema
event_name:
The name of the event that will be added to the schema
Returns
... | add_event_to_schema | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def get_event_from_schema(self, schema: str, event_name: str) -> Any:
"""
Gets the specified event from the provided schema
Parameters
----------
schema:
the schema string that contains the event
event_name:
the name of the event to retrieve from ... |
Gets the specified event from the provided schema
Parameters
----------
schema:
the schema string that contains the event
event_name:
the name of the event to retrieve from the schema
Returns
-------
The event data of the event "e... | get_event_from_schema | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def remove_event(self, schema: str, event_name: str) -> str:
"""
Removes an event from a schema dict. If there are none, returns None
Parameters
----------
schema:
The schema the event will be removed from
event_name:
The name of the event that wi... |
Removes an event from a schema dict. If there are none, returns None
Parameters
----------
schema:
The schema the event will be removed from
event_name:
The name of the event that will be removed from the schema
Returns
-------
Th... | remove_event | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def create_event(
self,
event_name: str,
function_resource: CloudFormationResourceSummary,
event_data: str,
force: bool = False,
registry_name: str = LAMBDA_TEST_EVENT_REGISTRY,
) -> str:
"""
Generates a new event and adds it to the EBSR
Param... |
Generates a new event and adds it to the EBSR
Parameters
----------
event_name: str
The name of the event to be created
function_resource: CloudFormationResourceSummary
The function where the event will be created
event_data: str
The ... | create_event | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def delete_event(
self,
event_name: str,
function_resource: CloudFormationResourceSummary,
registry_name: str = LAMBDA_TEST_EVENT_REGISTRY,
):
"""
Deletes a remote test event (and the schema if it contains only one event)
Parameters
----------
... |
Deletes a remote test event (and the schema if it contains only one event)
Parameters
----------
event_name: str
The name of the event to be deleted
function_resource: CloudFormationResourceSummary
The function that will have the event deleted
re... | delete_event | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def get_event(
self,
event_name: str,
function_resource: CloudFormationResourceSummary,
registry_name: str = LAMBDA_TEST_EVENT_REGISTRY,
) -> str:
"""
Returns a remote test event
Parameters
----------
event_name: str
The name of th... |
Returns a remote test event
Parameters
----------
event_name: str
The name of the event to be fetched
function_resource: CloudFormationResourceSummary
The function that has the event
registry_name: str
The name of the registry that co... | get_event | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def list_events(
self,
function_resource: CloudFormationResourceSummary,
registry_name: str = LAMBDA_TEST_EVENT_REGISTRY,
) -> str:
"""_summary_
Parameters
----------
function_resource : CloudFormationResourceSummary
The function to list the test ... | _summary_
Parameters
----------
function_resource : CloudFormationResourceSummary
The function to list the test events from
registry_name : str, optional
Registry name, by default LAMBDA_TEST_EVENT_REGISTRY
Returns
-------
str
... | list_events | python | aws/aws-sam-cli | samcli/lib/shared_test_events/lambda_shared_test_event.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/shared_test_events/lambda_shared_test_event.py | Apache-2.0 |
def stop(self, should_stop=True) -> None:
"""Stop executor after all current SyncFlows are finished."""
with self._flow_queue_lock:
self._stop_flag = should_stop
if should_stop:
self._flow_queue.queue.clear() | Stop executor after all current SyncFlows are finished. | stop | python | aws/aws-sam-cli | samcli/lib/sync/continuous_sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/continuous_sync_flow_executor.py | Apache-2.0 |
def _add_sync_flow_task(self, task: SyncFlowTask) -> None:
"""Add SyncFlowTask to the queue
Skips if the executor is in the state of being shut down.
Parameters
----------
task : SyncFlowTask
SyncFlowTask to be added.
"""
if self.should_stop():
... | Add SyncFlowTask to the queue
Skips if the executor is in the state of being shut down.
Parameters
----------
task : SyncFlowTask
SyncFlowTask to be added.
| _add_sync_flow_task | python | aws/aws-sam-cli | samcli/lib/sync/continuous_sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/continuous_sync_flow_executor.py | Apache-2.0 |
def execute(
self, exception_handler: Optional[Callable[[SyncFlowException], None]] = default_exception_handler
) -> None:
"""Blocking continuous execution of the SyncFlows
Parameters
----------
exception_handler : Optional[Callable[[Exception], None]], optional
... | Blocking continuous execution of the SyncFlows
Parameters
----------
exception_handler : Optional[Callable[[Exception], None]], optional
Function to be called if an exception is raised during the execution of a SyncFlow,
by default default_exception_handler.__func__
... | execute | python | aws/aws-sam-cli | samcli/lib/sync/continuous_sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/continuous_sync_flow_executor.py | Apache-2.0 |
def __init__(self, sync_flow: "SyncFlow", exception: Exception):
"""
Parameters
----------
sync_flow : SyncFlow
SyncFlow that raised the exception
exception : Exception
exception raised
"""
super().__init__(f"SyncFlow Exception for {sync_fl... |
Parameters
----------
sync_flow : SyncFlow
SyncFlow that raised the exception
exception : Exception
exception raised
| __init__ | python | aws/aws-sam-cli | samcli/lib/sync/exceptions.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/exceptions.py | Apache-2.0 |
def __init__(self, resource_identifier: Optional[str] = None, reason: Optional[str] = ""):
"""
Parameters
----------
resource_identifier : str
Logical resource identifier
reason : str
Reason for requiring infra sync
"""
super().__init__(f"{... |
Parameters
----------
resource_identifier : str
Logical resource identifier
reason : str
Reason for requiring infra sync
| __init__ | python | aws/aws-sam-cli | samcli/lib/sync/exceptions.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/exceptions.py | Apache-2.0 |
def __init__(
self, resource_identifier: Optional[str] = None, physical_resource_mapping: Optional[Dict[str, str]] = None
):
"""
Parameters
----------
resource_identifier : str
Logical resource identifier
physical_resource_mapping: Dict[str, str]
... |
Parameters
----------
resource_identifier : str
Logical resource identifier
physical_resource_mapping: Dict[str, str]
Current mapping between logical and physical IDs
| __init__ | python | aws/aws-sam-cli | samcli/lib/sync/exceptions.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/exceptions.py | Apache-2.0 |
def __init__(self, layer_name_arn: str):
"""
Parameters
----------
layer_name_arn : str
Layer ARN without version info at the end of it
"""
super().__init__(f"{layer_name_arn} doesn't have any versions in remote.")
self._layer_name_arn = layer_name_arn |
Parameters
----------
layer_name_arn : str
Layer ARN without version info at the end of it
| __init__ | python | aws/aws-sam-cli | samcli/lib/sync/exceptions.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/exceptions.py | Apache-2.0 |
def __init__(self, executed: bool, code_sync_resources: Set[ResourceIdentifier] = set()) -> None:
"""
Constructor
Parameters
----------
Executed: bool
Infra sync execution happened or not
code_sync_resources: Set[ResourceIdentifier]
Resources that... |
Constructor
Parameters
----------
Executed: bool
Infra sync execution happened or not
code_sync_resources: Set[ResourceIdentifier]
Resources that needs a code sync
| __init__ | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def __init__(
self,
build_context: BuildContext,
package_context: PackageContext,
deploy_context: DeployContext,
sync_context: "SyncContext",
):
"""Constructs the sync for infra executor.
Parameters
----------
build_context : BuildContext
... | Constructs the sync for infra executor.
Parameters
----------
build_context : BuildContext
package_context : PackageContext
deploy_context : DeployContext
sync_context : SyncContext
| __init__ | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def execute_infra_sync(self, first_sync: bool = False) -> InfraSyncResult:
"""
Compares the local template with the deployed one, executes infra sync if different
Parameters
----------
first_sync: bool
A flag that signals the inital run, only true when it's the first... |
Compares the local template with the deployed one, executes infra sync if different
Parameters
----------
first_sync: bool
A flag that signals the inital run, only true when it's the first time running infra sync
Returns
-------
InfraSyncResult
... | execute_infra_sync | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def _auto_skip_infra_sync(
self,
packaged_template_path: str,
built_template_path: str,
stack_name: str,
parameter_overrides: Optional[Dict[str, str]] = None,
nested_prefix: Optional[str] = None,
) -> bool:
"""
Recursively compares two templates, inclu... |
Recursively compares two templates, including the nested templates referenced inside
Parameters
----------
packaged_template_path : str
The template location of the current template packaged
built_template_path : str
The template location of the current ... | _auto_skip_infra_sync | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def _sanitize_template(
self,
template_dict: Dict,
linked_resources: Optional[Set[str]] = None,
built_template_dict: Optional[Dict] = None,
) -> Set[str]:
"""
Fields skipped during template comparison because sync --code can handle the difference:
* CodeUri or... |
Fields skipped during template comparison because sync --code can handle the difference:
* CodeUri or ImageUri property of AWS::Serverless::Function
* ImageUri, S3Bucket, S3Key, S3ObjectVersion fields in Code property of AWS::Lambda::Function
* ContentUri property of AWS::Serverless::La... | _sanitize_template | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def _remove_resource_field(
self,
resource_logical_id: str,
resource_type: str,
resource_dict: Dict,
linked_resources: Optional[Set[str]] = None,
built_resource_dict: Optional[Dict] = None,
) -> Optional[str]:
"""
Helper method to process resource dict... |
Helper method to process resource dict
Parameters
----------
resource_logical_id: str
Logical ID of the resource
resource_type: str
Resource type
resource_dict: Dict
The resource level dict containing Properties field
linked_r... | _remove_resource_field | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def get_template(self, template_path: str) -> Optional[Dict]:
"""
Returns the template dict based on local or remote read logic
Parameters
----------
template_path: str
The location of the template
Returns
-------
Dict
The parsed ... |
Returns the template dict based on local or remote read logic
Parameters
----------
template_path: str
The location of the template
Returns
-------
Dict
The parsed template dict
| get_template | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def _param_overrides_subset_of_stack_params(self, stack_name: str, param_overrides: Dict[str, str]) -> bool:
"""
Returns whether or not the supplied parameter overrides are a subset of the current stack parameters
Parameters
----------
stack_name: str
param_overrides: D... |
Returns whether or not the supplied parameter overrides are a subset of the current stack parameters
Parameters
----------
stack_name: str
param_overrides: Dict[str, str]
Parameter overrides supplied by the sam sync command, taking the following format
... | _param_overrides_subset_of_stack_params | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def _get_stack_parameters(self, stack_name: str) -> List[Dict[str, str]]:
"""
Returns the stack parameters for a given stack
Parameters
----------
stack_name: str
The name of the stack
Returns
-------
List of Dicts in the form { 'Paramete... |
Returns the stack parameters for a given stack
Parameters
----------
stack_name: str
The name of the stack
Returns
-------
List of Dicts in the form { 'ParameterKey': Foo, 'ParameterValue': Bar }
| _get_stack_parameters | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def _get_remote_template_data(self, template_path: str) -> Optional[Dict]:
"""
Get template dict from remote location
Parameters
----------
template_path: str
The s3 location of the template
Returns
-------
Dict
The parsed templat... |
Get template dict from remote location
Parameters
----------
template_path: str
The s3 location of the template
Returns
-------
Dict
The parsed template dict from s3
| _get_remote_template_data | python | aws/aws-sam-cli | samcli/lib/sync/infra_sync_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/infra_sync_executor.py | Apache-2.0 |
def get_default_retry_config() -> Optional[Dict]:
"""
Returns a default retry config if nothing is overriden by environment variables
"""
if environ.get("AWS_MAX_ATTEMPTS") or environ.get("AWS_RETRY_MODE"):
return None
return {"max_attempts": 10, "mode": "standard"} |
Returns a default retry config if nothing is overriden by environment variables
| get_default_retry_config | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def __init__(
self,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
log_name: str,
stacks: Optional[List[Stack]] = None,
application_build_result: Optional[ApplicationBuildRe... |
Parameters
----------
build_context : BuildContext
BuildContext used for build related parameters
deploy_context : BuildContext
DeployContext used for this deploy related parameters
sync_context: SyncContext
SyncContext object that obtains syn... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def _update_local_hash(self) -> None:
"""Updates the latest local hash of the sync flow which then can be used for comparison for next run"""
if not self._local_sha:
LOG.debug("%sNo local hash is configured, skipping to update local hash", self.log_prefix)
return
self._s... | Updates the latest local hash of the sync flow which then can be used for comparison for next run | _update_local_hash | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def compare_local(self) -> bool:
"""Comparison between local resource and its local stored state.
If the resources are identical, sync and gather dependencies will be skipped.
Simply return False if there is no comparison needed.
Ex: Comparing local Lambda function artifact with stored S... | Comparison between local resource and its local stored state.
If the resources are identical, sync and gather dependencies will be skipped.
Simply return False if there is no comparison needed.
Ex: Comparing local Lambda function artifact with stored SHA256
Returns
-------
... | compare_local | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def get_lock_keys(self) -> Set[str]:
"""Get a list of function + API calls that can be used as keys for LockDistributor
Returns
-------
Set[str]
Set of keys for all resources and their API calls
"""
lock_keys = set()
for resource_api_calls in self._ge... | Get a list of function + API calls that can be used as keys for LockDistributor
Returns
-------
Set[str]
Set of keys for all resources and their API calls
| get_lock_keys | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def _get_lock_chain(self) -> LockChain:
"""Return a LockChain object for all the locks
Returns
-------
Optional[LockChain]
A LockChain object containing all locks. None if there are no locks.
"""
if self._locks:
return LockChain(self._locks)
... | Return a LockChain object for all the locks
Returns
-------
Optional[LockChain]
A LockChain object containing all locks. None if there are no locks.
| _get_lock_chain | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def get_physical_id(self, resource_identifier: str) -> str:
"""Get the physical ID of a resource using physical_id_mapping. This does not directly check with remote.
Parameters
----------
resource_identifier : str
Resource identifier
Returns
-------
... | Get the physical ID of a resource using physical_id_mapping. This does not directly check with remote.
Parameters
----------
resource_identifier : str
Resource identifier
Returns
-------
str
Resource physical ID
Raises
------
... | get_physical_id | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def execute(self) -> List["SyncFlow"]:
"""Execute the sync flow and returns a list of dependent sync flows.
Skips sync() and gather_dependencies() if compare() is True
Returns
-------
List[SyncFlow]
A list of dependent sync flows
"""
dependencies: Lis... | Execute the sync flow and returns a list of dependent sync flows.
Skips sync() and gather_dependencies() if compare() is True
Returns
-------
List[SyncFlow]
A list of dependent sync flows
| execute | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def get_definition_path(
resource: Dict, identifier: str, use_base_dir: bool, base_dir: str, stacks: List[Stack]
) -> Optional[Path]:
"""
A helper method used by non-function sync flows to resolve definition file path
that are relative to the child stack to absolute path for nested stacks
Parameter... |
A helper method used by non-function sync flows to resolve definition file path
that are relative to the child stack to absolute path for nested stacks
Parameters
-------
resource: Dict
The resource's template dict
identifier: str
The logical ID identifier of the resource
u... | get_definition_path | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow.py | Apache-2.0 |
def default_exception_handler(sync_flow_exception: SyncFlowException) -> None:
"""Default exception handler for SyncFlowExecutor
This will try log and parse common SyncFlow exceptions.
Parameters
----------
sync_flow_exception : SyncFlowException
SyncFlowException containing exception to be... | Default exception handler for SyncFlowExecutor
This will try log and parse common SyncFlow exceptions.
Parameters
----------
sync_flow_exception : SyncFlowException
SyncFlowException containing exception to be handled and SyncFlow that raised it
Raises
------
exception
Unha... | default_exception_handler | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_executor.py | Apache-2.0 |
def _add_sync_flow_task(self, task: SyncFlowTask) -> None:
"""Add SyncFlowTask to the queue
Parameters
----------
task : SyncFlowTask
SyncFlowTask to be added.
"""
# Lock flow_queue as check dedup and add is not atomic
with self._flow_queue_lock:
... | Add SyncFlowTask to the queue
Parameters
----------
task : SyncFlowTask
SyncFlowTask to be added.
| _add_sync_flow_task | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_executor.py | Apache-2.0 |
def execute(
self, exception_handler: Optional[Callable[[SyncFlowException], None]] = default_exception_handler
) -> None:
"""Blocking execution of the SyncFlows
Parameters
----------
exception_handler : Optional[Callable[[Exception], None]], optional
Function to... | Blocking execution of the SyncFlows
Parameters
----------
exception_handler : Optional[Callable[[Exception], None]], optional
Function to be called if an exception is raised during the execution of a SyncFlow,
by default default_exception_handler.__func__
| execute | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_executor.py | Apache-2.0 |
def _execute_step(
self,
executor: ThreadPoolExecutor,
exception_handler: Optional[Callable[[SyncFlowException], None]],
) -> None:
"""A single step in the execution flow
Parameters
----------
executor : ThreadPoolExecutor
THreadPoolExecutor to be... | A single step in the execution flow
Parameters
----------
executor : ThreadPoolExecutor
THreadPoolExecutor to be used for execution
exception_handler : Optional[Callable[[SyncFlowException], None]]
Exception handler
| _execute_step | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_executor.py | Apache-2.0 |
def _handle_result(
self, sync_flow_future: SyncFlowFuture, exception_handler: Optional[Callable[[SyncFlowException], None]]
) -> bool:
"""Checks and handles the result of a SyncFlowFuture
Parameters
----------
sync_flow_future : SyncFlowFuture
The SyncFlowFuture... | Checks and handles the result of a SyncFlowFuture
Parameters
----------
sync_flow_future : SyncFlowFuture
The SyncFlowFuture that needs to be handled
exception_handler : Optional[Callable[[SyncFlowException], None]]
Exception handler that will be called if an exc... | _handle_result | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_executor.py | Apache-2.0 |
def _sync_flow_execute_wrapper(sync_flow: SyncFlow) -> SyncFlowResult:
"""Simple wrapper method for executing SyncFlow and converting all Exceptions into SyncFlowException
Parameters
----------
sync_flow : SyncFlow
SyncFlow to be executed
Returns
-------
... | Simple wrapper method for executing SyncFlow and converting all Exceptions into SyncFlowException
Parameters
----------
sync_flow : SyncFlow
SyncFlow to be executed
Returns
-------
SyncFlowResult
SyncFlowResult for the SyncFlow executed
... | _sync_flow_execute_wrapper | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_executor.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_executor.py | Apache-2.0 |
def __init__(
self,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
stacks: List[Stack],
auto_dependency_layer: bool,
) -> None:
"""
Parameters
----------
build_context : BuildContext
... |
Parameters
----------
build_context : BuildContext
BuildContext to be passed into each individual SyncFlow
deploy_context : DeployContext
DeployContext to be passed into each individual SyncFlow
sync_context: SyncContext
SyncContext object tha... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_factory.py | Apache-2.0 |
def load_physical_id_mapping(self) -> None:
"""Load physical IDs of the stack resources from remote"""
LOG.debug("Loading physical ID mapping")
resource_provider = get_boto_resource_provider_with_config(
region=self._deploy_context.region, profile=self._deploy_context.profile
... | Load physical IDs of the stack resources from remote | load_physical_id_mapping | python | aws/aws-sam-cli | samcli/lib/sync/sync_flow_factory.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/sync_flow_factory.py | Apache-2.0 |
def __init__(
self,
template: str,
build_context: "BuildContext",
package_context: "PackageContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
auto_dependency_layer: bool,
disable_infra_syncs: bool,
watch_exclude: Dict[str, List... | Manager for sync watch execution logic.
This manager will observe template and its code resources.
Automatically execute infra/code syncs when changes are detected.
Parameters
----------
template : str
Template file path
build_context : BuildContext
... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def queue_infra_sync(self) -> None:
"""Queue up an infra structure sync.
A simple bool flag is suffice
"""
if self._disable_infra_syncs:
LOG.info(
self._color.color_log(
msg="You have enabled the --code flag, which limits sam sync updates t... | Queue up an infra structure sync.
A simple bool flag is suffice
| queue_infra_sync | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _update_stacks(self) -> None:
"""
Reloads template and its stacks.
Update all other member that also depends on the stacks.
This should be called whenever there is a change to the template.
"""
self._stacks = SamLocalStackProvider.get_stacks(self._template, use_sam_tr... |
Reloads template and its stacks.
Update all other member that also depends on the stacks.
This should be called whenever there is a change to the template.
| _update_stacks | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _add_code_triggers(self) -> None:
"""Create CodeResourceTrigger for all resources and add their handlers to observer"""
if not self._stacks or not self._trigger_factory:
return
resource_ids = get_all_resource_ids(self._stacks)
for resource_id in resource_ids:
... | Create CodeResourceTrigger for all resources and add their handlers to observer | _add_code_triggers | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _add_template_triggers(self) -> None:
"""Create TemplateTrigger and add its handlers to observer"""
stacks = SamLocalStackProvider.get_stacks(self._template, use_sam_transform=False)[0]
for stack in stacks:
template = stack.location
template_trigger = TemplateTrigger(... | Create TemplateTrigger and add its handlers to observer | _add_template_triggers | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _execute_infra_context(self, first_sync: bool = False) -> InfraSyncResult:
"""Execute infrastructure sync
Returns
----------
InfraSyncResult
Returns information containing whether infra sync executed plus resources to do code sync on
"""
self._infra_sync_... | Execute infrastructure sync
Returns
----------
InfraSyncResult
Returns information containing whether infra sync executed plus resources to do code sync on
| _execute_infra_context | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def start(self) -> None:
"""Start WatchManager and watch for changes to the template and its code resources."""
# The actual execution is done in _start()
# This is a wrapper for gracefully handling Ctrl+C or other termination cases.
try:
self.queue_infra_sync()
... | Start WatchManager and watch for changes to the template and its code resources. | start | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _start(self) -> None:
"""Start WatchManager and watch for changes to the template and its code resources."""
first_sync = True
self._observer.start()
while True:
if self._waiting_infra_sync:
self._execute_infra_sync(first_sync)
first_sync = Fal... | Start WatchManager and watch for changes to the template and its code resources. | _start | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _start_sync(self) -> None:
"""Update stacks and populate all triggers"""
self._observer.unschedule_all()
self._update_stacks()
self._add_template_triggers()
self._add_code_triggers()
self._start_code_sync() | Update stacks and populate all triggers | _start_sync | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _queue_up_code_syncs(self, resource_ids_with_code_sync: Set[ResourceIdentifier]) -> None:
"""
For ther given resource IDs, create sync flow tasks in the queue
Parameters
----------
resource_ids_with_code_sync: Set[ResourceIdentifier]
The set of resource IDs to be... |
For ther given resource IDs, create sync flow tasks in the queue
Parameters
----------
resource_ids_with_code_sync: Set[ResourceIdentifier]
The set of resource IDs to be synced
| _queue_up_code_syncs | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _on_code_change_wrapper(self, resource_id: ResourceIdentifier) -> OnChangeCallback:
"""Wrapper method that generates a callback for code changes.
Parameters
----------
resource_id : ResourceIdentifier
Resource that associates to the callback
Returns
----... | Wrapper method that generates a callback for code changes.
Parameters
----------
resource_id : ResourceIdentifier
Resource that associates to the callback
Returns
-------
OnChangeCallback
Callback function
| _on_code_change_wrapper | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def on_code_change(event: Optional[FileSystemEvent] = None) -> None:
"""
Custom event handling to create a new sync flow if a file was modified.
Parameters
----------
event: Optional[FileSystemEvent]
The event that triggered the change
... |
Custom event handling to create a new sync flow if a file was modified.
Parameters
----------
event: Optional[FileSystemEvent]
The event that triggered the change
| on_code_change | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def _watch_sync_flow_exception_handler(self, sync_flow_exception: SyncFlowException) -> None:
"""Exception handler for watch.
Simply logs unhandled exceptions instead of failing the entire process.
Parameters
----------
sync_flow_exception : SyncFlowException
SyncFlo... | Exception handler for watch.
Simply logs unhandled exceptions instead of failing the entire process.
Parameters
----------
sync_flow_exception : SyncFlowException
SyncFlowException
| _watch_sync_flow_exception_handler | python | aws/aws-sam-cli | samcli/lib/sync/watch_manager.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/watch_manager.py | Apache-2.0 |
def __init__(
self,
function_identifier: str,
alias_name: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
stacks: Optional[List[Stack]] = None,
):
"""
... |
Parameters
----------
function_identifier : str
Function resource identifier that need to have associated Alias and Version updated.
alias_name : str
Alias name for the function
build_context : BuildContext
BuildContext
deploy_context ... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/alias_version_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/alias_version_sync_flow.py | Apache-2.0 |
def gather_dependencies(self) -> List[SyncFlow]:
"""
Return auto dependency layer sync flow along with parent dependencies
"""
parent_dependencies = super().gather_dependencies()
function_build_definitions = cast(BuildGraph, self._build_graph).get_function_build_definitions()
... |
Return auto dependency layer sync flow along with parent dependencies
| gather_dependencies | python | aws/aws-sam-cli | samcli/lib/sync/flows/auto_dependency_layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/auto_dependency_layer_sync_flow.py | Apache-2.0 |
def __init__(
self,
function_identifier: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
stacks: List[Stack],
application_build_result: Optional[ApplicationBuildResult],... |
Parameters
----------
function_identifier : str
Function resource identifier that need to be synced.
build_context : BuildContext
BuildContext
deploy_context : DeployContext
DeployContext
sync_context: SyncContext
SyncConte... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/function_sync_flow.py | Apache-2.0 |
def gather_dependencies(self) -> List[SyncFlow]:
"""Gathers alias and versions related to a function.
Currently only handles serverless function AutoPublishAlias field
since a manually created function version resource behaves statically in a stack.
Redeploying a version resource through... | Gathers alias and versions related to a function.
Currently only handles serverless function AutoPublishAlias field
since a manually created function version resource behaves statically in a stack.
Redeploying a version resource through CFN will not create a new version.
| gather_dependencies | python | aws/aws-sam-cli | samcli/lib/sync/flows/function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/function_sync_flow.py | Apache-2.0 |
def wait_for_function_update_complete(lambda_client: BaseClient, physical_id: str) -> None:
"""
Checks on cloud side to wait for the function update status to be complete
Parameters
----------
lambda_client : boto.core.BaseClient
Lambda client that performs get_function API call.
physic... |
Checks on cloud side to wait for the function update status to be complete
Parameters
----------
lambda_client : boto.core.BaseClient
Lambda client that performs get_function API call.
physical_id : str
Physical identifier of the function resource
| wait_for_function_update_complete | python | aws/aws-sam-cli | samcli/lib/sync/flows/function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/function_sync_flow.py | Apache-2.0 |
def __init__(
self,
api_identifier: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
log_name: str,
stacks: List[Stack],
):
"""
Parameters
---... |
Parameters
----------
api_identifier : str
HttpApi resource identifier that needs to have associated Api updated.
build_context : BuildContext
BuildContext used for build related parameters
deploy_context : BuildContext
DeployContext used for ... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/generic_api_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/generic_api_sync_flow.py | Apache-2.0 |
def __init__(
self,
httpapi_identifier: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
stacks: List[Stack],
):
"""
Parameters
----------
htt... |
Parameters
----------
httpapi_identifier : str
HttpApi resource identifier that needs to have associated HttpApi updated.
build_context : BuildContext
BuildContext used for build related parameters
deploy_context : BuildContext
DeployContext u... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/http_api_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/http_api_sync_flow.py | Apache-2.0 |
def __init__(
self,
function_identifier: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
stacks: List[Stack],
application_build_result: Optional[ApplicationBuildResult],... |
Parameters
----------
function_identifier : str
Image function resource identifier that need to be synced.
build_context : BuildContext
BuildContext
deploy_context : DeployContext
DeployContext
sync_context: SyncContext
Syn... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/image_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/image_function_sync_flow.py | Apache-2.0 |
def _get_docker_client(self) -> DockerClient:
"""Lazy instantiates and returns the docker client"""
if not self._docker_client:
self._docker_client = docker.from_env(version=DOCKER_MIN_API_VERSION)
return self._docker_client | Lazy instantiates and returns the docker client | _get_docker_client | python | aws/aws-sam-cli | samcli/lib/sync/flows/image_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/image_function_sync_flow.py | Apache-2.0 |
def _get_ecr_client(self) -> Any:
"""Lazy instantiates and returns the boto3 ecr client"""
if not self._ecr_client:
self._ecr_client = self._boto_client("ecr")
return self._ecr_client | Lazy instantiates and returns the boto3 ecr client | _get_ecr_client | python | aws/aws-sam-cli | samcli/lib/sync/flows/image_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/image_function_sync_flow.py | Apache-2.0 |
def gather_resources(self) -> None:
"""Build function image and save it in self._image_name"""
if self._application_build_result:
LOG.debug("Using pre-built resources for function %s", self._function_identifier)
self._use_prebuilt_resources(self._application_build_result)
... | Build function image and save it in self._image_name | gather_resources | python | aws/aws-sam-cli | samcli/lib/sync/flows/image_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/image_function_sync_flow.py | Apache-2.0 |
def _build_resources_from_scratch(self) -> None:
"""Builds function from scratch and assigns the image name"""
builder = ApplicationBuilder(
self._build_context.collect_build_resources(self._function_identifier),
self._build_context.build_dir,
self._build_context.base... | Builds function from scratch and assigns the image name | _build_resources_from_scratch | python | aws/aws-sam-cli | samcli/lib/sync/flows/image_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/image_function_sync_flow.py | Apache-2.0 |
def _get_local_image_id(self, image: str) -> Optional[str]:
"""Returns the local hash of the image"""
docker_img = self._get_docker_client().images.get(image)
if not docker_img or not docker_img.attrs.get("Id"):
return None
return str(docker_img.attrs.get("Id")) | Returns the local hash of the image | _get_local_image_id | python | aws/aws-sam-cli | samcli/lib/sync/flows/image_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/image_function_sync_flow.py | Apache-2.0 |
def get_latest_layer_version(lambda_client: Any, layer_arn: str) -> int:
"""Fetches all layer versions from remote and returns the latest one"""
layer_versions = lambda_client.list_layer_versions(LayerName=layer_arn).get("LayerVersions", [])
if not layer_versions:
raise NoLayerVersionsFoundError(lay... | Fetches all layer versions from remote and returns the latest one | get_latest_layer_version | python | aws/aws-sam-cli | samcli/lib/sync/flows/layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/layer_sync_flow.py | Apache-2.0 |
def compare_remote(self) -> bool:
"""
Compare Sha256 of the deployed layer code vs the one just built, True if they are same, False otherwise
"""
self._old_layer_version = get_latest_layer_version(self._lambda_client, cast(str, self._layer_arn))
old_layer_info = self._lambda_clie... |
Compare Sha256 of the deployed layer code vs the one just built, True if they are same, False otherwise
| compare_remote | python | aws/aws-sam-cli | samcli/lib/sync/flows/layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/layer_sync_flow.py | Apache-2.0 |
def sync(self) -> None:
"""
Publish new layer version, and delete the existing (old) one
"""
LOG.debug("%sPublishing new Layer Version", self.log_prefix)
self._new_layer_version = self._publish_new_layer_version()
self._delete_old_layer_version() |
Publish new layer version, and delete the existing (old) one
| sync | python | aws/aws-sam-cli | samcli/lib/sync/flows/layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/layer_sync_flow.py | Apache-2.0 |
def _publish_new_layer_version(self) -> int:
"""
Publish new layer version and keep new layer version arn so that we can update related functions
"""
compatible_runtimes = self._get_compatible_runtimes()
with open(cast(str, self._zip_file), "rb") as zip_file:
data = z... |
Publish new layer version and keep new layer version arn so that we can update related functions
| _publish_new_layer_version | python | aws/aws-sam-cli | samcli/lib/sync/flows/layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/layer_sync_flow.py | Apache-2.0 |
def gather_resources(self) -> None:
"""Build layer and ZIP it into a temp file in self._zip_file"""
if self._application_build_result:
LOG.debug("Using pre-built resources for layer %s", self._layer_identifier)
self._use_prebuilt_resources(self._application_build_result)
... | Build layer and ZIP it into a temp file in self._zip_file | gather_resources | python | aws/aws-sam-cli | samcli/lib/sync/flows/layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/layer_sync_flow.py | Apache-2.0 |
def _build_resources_from_scratch(self) -> None:
"""Builds layer from scratch and assigns artifact_folder"""
with self._get_lock_chain():
rmtree_if_exists(self._layer.get_build_dir(self._build_context.build_dir))
builder = ApplicationBuilder(
self._build_context.c... | Builds layer from scratch and assigns artifact_folder | _build_resources_from_scratch | python | aws/aws-sam-cli | samcli/lib/sync/flows/layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/layer_sync_flow.py | Apache-2.0 |
def sync(self) -> None:
"""
First read the current Layers property and update the old layer version arn with new one
then call the update function configuration to update the function with new layer version arn
"""
new_layer_arn = f"{self._layer_arn}:{self._new_layer_version}"
... |
First read the current Layers property and update the old layer version arn with new one
then call the update function configuration to update the function with new layer version arn
| sync | python | aws/aws-sam-cli | samcli/lib/sync/flows/layer_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/layer_sync_flow.py | Apache-2.0 |
def __init__(
self,
restapi_identifier: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
stacks: List[Stack],
):
"""
Parameters
----------
res... |
Parameters
----------
restapi_identifier : str
RestApi resource identifier that needs to have associated RestApi updated.
build_context : BuildContext
BuildContext used for build related parameters
deploy_context : BuildContext
DeployContext u... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/rest_api_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/rest_api_sync_flow.py | Apache-2.0 |
def _create_deployment(self) -> Optional[str]:
"""
Create a deployment using the updated API and record the created deployment ID
Returns
----------
Optional[str]: The newly created deployment ID
"""
LOG.debug("%sTrying to create a deployment through client", sel... |
Create a deployment using the updated API and record the created deployment ID
Returns
----------
Optional[str]: The newly created deployment ID
| _create_deployment | python | aws/aws-sam-cli | samcli/lib/sync/flows/rest_api_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/rest_api_sync_flow.py | Apache-2.0 |
def _collect_stages(self) -> Set[str]:
"""
Collect all stages needed to be updated
Returns
----------
Set[str]: The set of stage names to be updated
"""
# Get the stage name associated with the previous deployment and update stage
# Stage needs to be flus... |
Collect all stages needed to be updated
Returns
----------
Set[str]: The set of stage names to be updated
| _collect_stages | python | aws/aws-sam-cli | samcli/lib/sync/flows/rest_api_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/rest_api_sync_flow.py | Apache-2.0 |
def _update_stages(self, stages: Set[str], deployment_id: Optional[str]) -> Set[str]:
"""
Update all the relevant stages
Parameters
----------
stages: Set[str]
The set of stage names to be updated
deployment_id: Optional[str]
The newly created dep... |
Update all the relevant stages
Parameters
----------
stages: Set[str]
The set of stage names to be updated
deployment_id: Optional[str]
The newly created deployment ID to be used in the stages
Returns
----------
Set[str]: A set of... | _update_stages | python | aws/aws-sam-cli | samcli/lib/sync/flows/rest_api_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/rest_api_sync_flow.py | Apache-2.0 |
def _delete_deployments(self, prev_deployment_ids: Set[str]) -> None:
"""
Delete the previous deployment
Parameters
----------
prev_deployment_ids: Set[str]
A set of previous deployment IDs to be cleaned up
"""
for prev_dep_id in prev_deployment_ids:
... |
Delete the previous deployment
Parameters
----------
prev_deployment_ids: Set[str]
A set of previous deployment IDs to be cleaned up
| _delete_deployments | python | aws/aws-sam-cli | samcli/lib/sync/flows/rest_api_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/rest_api_sync_flow.py | Apache-2.0 |
def __init__(
self,
state_machine_identifier: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
stacks: List[Stack],
):
"""
Parameters
----------
... |
Parameters
----------
state_machine_identifier : str
State Machine resource identifier that need to be synced.
build_context : BuildContext
BuildContext used for build related parameters
deploy_context : BuildContext
DeployContext used for thi... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/stepfunctions_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/stepfunctions_sync_flow.py | Apache-2.0 |
def __init__(
self,
function_identifier: str,
build_context: "BuildContext",
deploy_context: "DeployContext",
sync_context: "SyncContext",
physical_id_mapping: Dict[str, str],
stacks: List[Stack],
application_build_result: Optional[ApplicationBuildResult],... |
Parameters
----------
function_identifier : str
ZIP function resource identifier that need to be synced.
build_context : BuildContext
BuildContext
deploy_context : DeployContext
DeployContext
sync_context: SyncContext
SyncC... | __init__ | python | aws/aws-sam-cli | samcli/lib/sync/flows/zip_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/zip_function_sync_flow.py | Apache-2.0 |
def gather_resources(self) -> None:
"""Build function and ZIP it into a temp file in self._zip_file"""
if self._application_build_result:
LOG.debug("Using pre-built resources for function %s", self._function_identifier)
self._use_prebuilt_resources(self._application_build_result)... | Build function and ZIP it into a temp file in self._zip_file | gather_resources | python | aws/aws-sam-cli | samcli/lib/sync/flows/zip_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/zip_function_sync_flow.py | Apache-2.0 |
def _use_prebuilt_resources(self, application_build_result: ApplicationBuildResult) -> None:
"""Uses pre-built artifacts and assigns build_graph and artifacts_folder"""
self._build_graph = application_build_result.build_graph
self._artifact_folder = application_build_result.artifacts.get(self._f... | Uses pre-built artifacts and assigns build_graph and artifacts_folder | _use_prebuilt_resources | python | aws/aws-sam-cli | samcli/lib/sync/flows/zip_function_sync_flow.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/lib/sync/flows/zip_function_sync_flow.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.