Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def client_factory_instance():
with mock.patch.object(ClientFactory, "__init__", return_value=None):
aws_clients = ClientFactory(None)
aws_clients._credential_sets = {"default": [None, None, None, None]}
return aws_clients
def client_factory_instance():
with mock.patch.object(ClientFactory, "__init__", return_value=None):
aws_clients = ClientFactory(None)
aws_clients._credential_sets = {"default": [None, None, None, None]}
return aws_clients
def client_factory_instance():
with mock.patch.object(ClientFactory, "__init__", return_value=None):
aws_clients = ClientFactory(None)
aws_clients._credential_sets = {"default": [None, None, None, None]}
return aws_clients
def client_factory_instance():
with mock.patch.object(ClientFactory, "__init__", return_value=None):
aws_clients = ClientFactory(None)
aws_clients._credential_sets = {"default": [None, None, None, None]}
return aws_clients
def __init__(
self,
path_to_templates,
user_config_file=None,
use_upstream_mappings=True,
client_factory=None,
):
if client_factory:
AMIUpdater.client_factory = client_factory
else:
AMIUpdater.client_factory = ClientFactory()
self.all_regions = False
if use_upstream_mappings:
Config.load(self.upstream_config_file, configtype="Upstream")
if user_config_file:
Config.load(user_config_file, configtype="User")
self._template_path = path_to_templates
:param target_bucket_name: Target S3 bucket to use as replacement and to upload to
:param source_bucket_name: Source S3 bucket to search for replacement
:param target_key_prefix: Target S3 key prefix to prepend to all object (including an ending forward slash '/')
:param output_directory: Directory to save rewritten assets to
:param rewrite_mode: Mode for rewriting like CFNAlchemist.OBJECT_REWRITE_MODE or CFNAlchemist.BASIC_REWRITE_MODE
:param verbose: Set to True to log debug messages
:param dry_run: Set to True to perform a dry run
"""
# Constants
self._TEMPLATE_EXT = [".template", ".json", ".yaml", ".yml"]
self._GIT_EXT = [".git", ".gitmodules", ".gitignore", ".gitattributes"]
self._EXCLUDED_DIRS = [".git", "ci", ".idea", ".vs"]
# properties
self._boto_clients = ClientFactory(logger=self.logger)
self._auth_mode = None
self._aws_profile = None
self._aws_access_key_id = None
self._aws_secret_access_key = None
self._aws_session_token = None
# properties with setters/getters
self._input_path = None
self._target_bucket_name = None
self._target_key_prefix = None
self._output_directory = None
self._rewrite_mode = self.OBJECT_REWRITE_MODE
self._excluded_prefixes = None
self._verbose = False
self._dry_run = False
self._prod_bucket_name = "aws-quickstart"