本文整理汇总了Python中scli.constants.RdsDefault.del_policy_to_bool方法的典型用法代码示例。如果您正苦于以下问题:Python RdsDefault.del_policy_to_bool方法的具体用法?Python RdsDefault.del_policy_to_bool怎么用?Python RdsDefault.del_policy_to_bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scli.constants.RdsDefault
的用法示例。
在下文中一共展示了RdsDefault.del_policy_to_bool方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import del_policy_to_bool [as 别名]
def execute(self, parameter_pool):
command = parameter_pool.get_value(ParameterName.Command)
if parameter_pool.has(ParameterName.ApplicationName)\
and parameter_pool.has(ParameterName.EnvironmentName):
app_name = parameter_pool.get_value(ParameterName.ApplicationName)
env_name = parameter_pool.get_value(ParameterName.EnvironmentName)
policy = rds_utils.is_rds_delete_to_snapshot(parameter_pool, app_name, env_name)
local_rds_switch = parameter_pool.get_value(ParameterName.RdsEnabled)
if policy is not None and not RdsDefault.del_policy_to_bool(policy):
if command == CommandType.UPDATE:
if local_rds_switch:
pass
else:
prompt.result(AskConfirmationOpMessage.CommandWarning[command])
else:
prompt.result(AskConfirmationOpMessage.CommandWarning[command])
if (parameter_pool.has(ParameterName.Force) \
and parameter_pool.get_value(ParameterName.Force) == ServiceDefault.ENABLED) \
or TerminalBase.ask_confirmation(AskConfirmationOpMessage.CommandConfirmation[command]):
ret_result = OperationResult(self, None, None, None)
return ret_result
else:
log.info('User cancelled command.')
raise EBSCliException()
示例2: is_rds_delete_to_snapshot
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import del_policy_to_bool [as 别名]
def is_rds_delete_to_snapshot(parameter_pool, app_name, env_name):
policy_option = OptionSepcification(RdsDefault.Namespace,
RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy])
policy_setting = api_wrapper.retrieve_configuration_settings(parameter_pool, app_name,
env_name = env_name,
options = [policy_option])
if len(policy_setting) != 1:
return None # Option name not found. No RDS instance
return RdsDefault.del_policy_to_bool(policy_setting[0].value)
示例3: is_rds_delete_to_snapshot
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import del_policy_to_bool [as 别名]
def is_rds_delete_to_snapshot(parameter_pool, app_name, env_name):
policy_options = {RdsDefault.Namespace: {RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy]}}
try:
policy_setting = api_wrapper.retrieve_configuration_settings(parameter_pool, app_name,
env_name = env_name,
options = policy_options)
except InvalidParameterValueException:
return None # Environment not exist. No RDS instance
if len(policy_setting) < 1:
return None # Option name not found. No RDS instance
return RdsDefault.del_policy_to_bool(policy_setting[RdsDefault.Namespace]\
[RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy]])
示例4: ask_delete_to_snapshot
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import del_policy_to_bool [as 别名]
def ask_delete_to_snapshot(cls, parameter_pool):
if parameter_pool.has(PName.RdsDeletionPolicy):
original_value = parameter_pool.get_value(PName.RdsDeletionPolicy)
display_value = RdsDefault.del_policy_to_bool(original_value)
display_value = misc.bool_to_yesno(display_value)
else:
display_value = None
value = cls.ask_parameter(parameter_pool, PName.RdsDeletionPolicy, display_value)
if value is None:
return
elif not isinstance(value, bool):
value = RdsDefault.bool_to_del_policy(misc.string_to_boolean(value))
parameter_pool.put(Parameter(PName.RdsDeletionPolicy,
value,
PSource.Terminal),
True)
示例5: _probe_rds_change
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import del_policy_to_bool [as 别名]
def _probe_rds_change(self, parameter_pool, command):
if parameter_pool.has(ParameterName.ApplicationName)\
and parameter_pool.has(ParameterName.EnvironmentName):
app_name = parameter_pool.get_value(ParameterName.ApplicationName)
env_name = parameter_pool.get_value(ParameterName.EnvironmentName)
policy = rds_utils.is_rds_delete_to_snapshot(parameter_pool, app_name, env_name)
local_rds_switch = parameter_pool.get_value(ParameterName.RdsEnabled)
if policy is not None and not RdsDefault.del_policy_to_bool(policy):
if command == CommandType.UPDATE:
if local_rds_switch:
pass
else:
prompt.result(AskConfirmationOpMessage.CommandWarning[command])
else:
prompt.result(AskConfirmationOpMessage.CommandWarning[command])