本文整理匯總了Python中cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver.is_parameter_reference方法的典型用法代碼示例。如果您正苦於以下問題:Python DependencyResolver.is_parameter_reference方法的具體用法?Python DependencyResolver.is_parameter_reference怎麽用?Python DependencyResolver.is_parameter_reference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver
的用法示例。
在下文中一共展示了DependencyResolver.is_parameter_reference方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: resolve_parameter_values
# 需要導入模塊: from cfn_sphere.stack_configuration.dependency_resolver import DependencyResolver [as 別名]
# 或者: from cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver import is_parameter_reference [as 別名]
def resolve_parameter_values(self, stack_name, stack_config, cli_parameters=None):
resolved_parameters = {}
stack_outputs = self.cfn.get_stacks_outputs()
for key, value in stack_config.parameters.items():
if isinstance(value, list):
self.logger.debug("List parameter found for {0}".format(key))
for i, item in enumerate(value):
if DependencyResolver.is_parameter_reference(item):
referenced_stack, output_name = DependencyResolver.parse_stack_reference_value(item)
value[i] = str(self.get_output_value(stack_outputs, referenced_stack, output_name))
value_string = self.convert_list_to_string(value)
resolved_parameters[key] = value_string
elif isinstance(value, str):
if DependencyResolver.is_parameter_reference(value):
referenced_stack, output_name = DependencyResolver.parse_stack_reference_value(value)
resolved_parameters[key] = str(self.get_output_value(stack_outputs, referenced_stack, output_name))
elif self.is_keep_value(value):
resolved_parameters[key] = str(self.get_latest_value(key, value, stack_name))
elif self.is_taupage_ami_reference(value):
resolved_parameters[key] = str(self.ec2.get_latest_taupage_image_id())
elif self.is_kms(value):
resolved_parameters[key] = str(self.kms.decrypt(value.split('|', 2)[2]))
elif self.is_file(value):
url = value.split('|', 2)[2]
resolved_parameters[key] = FileLoader.get_file(url, stack_config.working_dir)
else:
resolved_parameters[key] = value
elif isinstance(value, bool):
resolved_parameters[key] = str(value).lower()
elif isinstance(value, (int, float)):
resolved_parameters[key] = str(value)
else:
raise NotImplementedError("Cannot handle {0} type for key: {1}".format(type(value), key))
if cli_parameters:
return self.update_parameters_with_cli_parameters(resolved_parameters, cli_parameters, stack_name)
else:
return resolved_parameters
示例2: resolve_parameter_values
# 需要導入模塊: from cfn_sphere.stack_configuration.dependency_resolver import DependencyResolver [as 別名]
# 或者: from cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver import is_parameter_reference [as 別名]
def resolve_parameter_values(self, parameters_dict, stack_name):
parameters = {}
for key, value in parameters_dict.items():
if isinstance(value, list):
self.logger.debug("List parameter found for {0}".format(key))
for i, item in enumerate(value):
if DependencyResolver.is_parameter_reference(item):
referenced_stack, output_name = DependencyResolver.parse_stack_reference_value(item)
value[i] = str(self.get_output_value(referenced_stack + '.' + output_name))
value_string = self.convert_list_to_string(value)
parameters[key] = value_string
elif isinstance(value, str):
if DependencyResolver.is_parameter_reference(value):
referenced_stack, output_name = DependencyResolver.parse_stack_reference_value(value)
parameters[key] = str(self.get_output_value(referenced_stack + '.' + output_name))
elif self.is_keep_value(value):
parameters[key] = str(self.get_latest_value(key, value, stack_name))
elif self.is_taupage_ami_reference(value):
parameters[key] = str(self.ec2.get_latest_taupage_image_id())
elif self.is_kms(value):
parameters[key] = str(self.kms.decrypt(value.split('|', 2)[2]))
else:
parameters[key] = value
elif isinstance(value, bool):
parameters[key] = str(value).lower()
elif isinstance(value, (int, float)):
parameters[key] = str(value)
else:
raise NotImplementedError("Cannot handle {0} value for key: {1}".format(type(value), key))
return parameters
示例3: test_is_parameter_reference_returns_true_for_uppercase_ref
# 需要導入模塊: from cfn_sphere.stack_configuration.dependency_resolver import DependencyResolver [as 別名]
# 或者: from cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver import is_parameter_reference [as 別名]
def test_is_parameter_reference_returns_true_for_uppercase_ref(self):
self.assertTrue(DependencyResolver.is_parameter_reference("|Ref|vpc.id"))
示例4: test_is_parameter_reference_returns_true_on_empty_reference
# 需要導入模塊: from cfn_sphere.stack_configuration.dependency_resolver import DependencyResolver [as 別名]
# 或者: from cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver import is_parameter_reference [as 別名]
def test_is_parameter_reference_returns_true_on_empty_reference(self):
self.assertTrue(DependencyResolver.is_parameter_reference('|ref|'))
示例5: test_is_parameter_reference_returns_false_for_boolean_values
# 需要導入模塊: from cfn_sphere.stack_configuration.dependency_resolver import DependencyResolver [as 別名]
# 或者: from cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver import is_parameter_reference [as 別名]
def test_is_parameter_reference_returns_false_for_boolean_values(self):
self.assertFalse(DependencyResolver.is_parameter_reference(True))
示例6: test_is_parameter_reference_returns_false_for_simple_string
# 需要導入模塊: from cfn_sphere.stack_configuration.dependency_resolver import DependencyResolver [as 別名]
# 或者: from cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver import is_parameter_reference [as 別名]
def test_is_parameter_reference_returns_false_for_simple_string(self):
self.assertFalse(DependencyResolver.is_parameter_reference("vpc.id"))
示例7: test_is_parameter_reference_returns_false_for_single_separator
# 需要導入模塊: from cfn_sphere.stack_configuration.dependency_resolver import DependencyResolver [as 別名]
# 或者: from cfn_sphere.stack_configuration.dependency_resolver.DependencyResolver import is_parameter_reference [as 別名]
def test_is_parameter_reference_returns_false_for_single_separator(self):
self.assertFalse(DependencyResolver.is_parameter_reference("Ref|vpc.id"))