本文整理汇总了Python中scli.constants.RdsDefault.get_snippet_url方法的典型用法代码示例。如果您正苦于以下问题:Python RdsDefault.get_snippet_url方法的具体用法?Python RdsDefault.get_snippet_url怎么用?Python RdsDefault.get_snippet_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scli.constants.RdsDefault
的用法示例。
在下文中一共展示了RdsDefault.get_snippet_url方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_endpoint
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import get_snippet_url [as 别名]
def generate_endpoint(parameter_pool, region, source, force = False):
parameter_pool.put(Parameter(ParameterName.RdsEndpoint,
RdsEndpoint[region],
source))
parameter_pool.put(Parameter(ParameterName.RdsSnippetUrl,
RdsDefault.get_snippet_url(region),
source))
示例2: execute
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import get_snippet_url [as 别名]
def execute(self, parameter_pool):
location = EbLocalDir.Path + os.path.sep + EbConfigFile.Name
try:
config_file.load_eb_config_file(location, parameter_pool, False)
if config_file.check_access_permission(location) is False:
message = ConfigFileErrorMessage.PermissionError.format(EbConfigFile.Name)
log.info(message)
prompt.error(message)
#Post processing
if not parameter_pool.has(ParameterName.RdsSnippetUrl)\
and parameter_pool.has(ParameterName.Region):
region = parameter_pool.get_value(ParameterName.Region)
parameter_pool.put(Parameter(ParameterName.RdsSnippetUrl,
RdsDefault.get_snippet_url(region),
ParameterSource.ConfigFile))
except EBConfigFileNotExistError:
log.error('Configuration file "{0}" not exist.'.format(EbConfigFile.Name))
prompt.error(ConfigFileMessage.CannotFind.format\
(EbConfigFile.Name, CommandType.INIT.lower()))
raise EBSCliException()
except BaseException as ex:
log.error('Encountered error when load configuration file "{0}", becuase "{1}".'.\
format(EbConfigFile.Name, ex))
prompt.error(ConfigFileMessage.CorrectionSuggestion.
format(location,CommandType.INIT.lower()))
raise
ret_result = OperationResult(self, None, None, None)
return ret_result
示例3: _add_rds_extension
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import get_snippet_url [as 别名]
def _add_rds_extension(parameter_pool, option_settings, option_to_remove):
region = parameter_pool.get_value(ParameterName.Region)
#Generate snippet
env_name = parameter_pool.get_value(ParameterName.EnvironmentName)
if has_rds_instance(parameter_pool, env_name):
spec = None
else:
spec = TemplateSpecification()
snippet = TemplateSnippet()
snippet.snippet_name = RdsDefault.SnippetName
snippet.source_url = RdsDefault.get_snippet_url(region)
snippet.order = RdsDefault.SnippetAddOrder
spec.template_snippets = [snippet]
#Add/update option settings
#TODO: change option_settings to o(1) structure while retain order for output
for pname in RdsDefault.OptionMinSet:
if parameter_pool.has(pname) and parameter_pool.get_value(pname) is not None:
_update_option_setting(option_settings,
RdsDefault.Namespace,
RdsDefault.OptionNames[pname],
parameter_pool.get_value(pname))
_trim_rds_options(option_settings, option_to_remove)
return spec
示例4: _remove_rds_extension
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import get_snippet_url [as 别名]
def _remove_rds_extension(parameter_pool, template_spec, option_settings, option_to_remove):
region = parameter_pool.get_value(ParameterName.Region, False)
#Generate snippet
snippet = TemplateSnippet()
snippet.snippet_name = RdsDefault.SnippetName
snippet.source_url = RdsDefault.get_snippet_url(region)
snippet.order = RdsDefault.SnippetRemoveOrder
template_spec.template_snippets.append(snippet)
#Remove option settings
_remove_all_rds_options(option_settings, option_to_remove)
示例5: ask_region
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import get_snippet_url [as 别名]
def ask_region(cls, parameter_pool):
original_value = parameter_pool.get_value(ParameterName.Region) \
if parameter_pool.has(ParameterName.Region) else None
original_source = parameter_pool.get_source(ParameterName.Region) \
if parameter_pool.has(ParameterName.Region) else None
if original_value is not None and \
ParameterSource.is_ahead(original_source, ParameterSource.Terminal):
print(TerminalPromptSettingParameterMessage[ParameterName.Region].\
format(ServiceRegionName[original_value]))
region_value = original_value
else:
append_message = u'' if original_value is None \
else TerminalMessage.CurrentValue.format(ServiceRegionName[original_value])
print TerminalPromptAskingMessage[ParameterName.Region].format(append_message)
region_name_list = list()
for region in AvailableServiceRegion:
region_name_list.append(ServiceRegionName[region])
region_index = cls.single_choice(region_name_list,
TerminalMessage.AvailableRegion,
None,
original_value is not None)
region_value = AvailableServiceRegion[region_index] \
if region_index is not None else original_value
region = Parameter(ParameterName.Region,
misc.to_unicode(region_value),
ParameterSource.Terminal)
parameter_pool.put(region, True)
# Set service endpoint if not specified as CLI arguments
cls._set_parameter_value(parameter_pool,
ParameterName.ServiceEndpoint,
misc.to_unicode(ServiceEndpoint[region_value]),
ParameterSource.Terminal)
# Set RDS endpont and snippet if not specified as CLI arguments
cls._set_parameter_value(parameter_pool,
ParameterName.RdsEndpoint,
RdsEndpoint[region_value],
ParameterSource.Terminal)
cls._set_parameter_value(parameter_pool,
ParameterName.RdsSnippetUrl,
RdsDefault.get_snippet_url(region_value),
ParameterSource.Terminal)
示例6: _remove_rds_extension
# 需要导入模块: from scli.constants import RdsDefault [as 别名]
# 或者: from scli.constants.RdsDefault import get_snippet_url [as 别名]
def _remove_rds_extension(parameter_pool, template_spec, option_settings, option_to_remove):
region = parameter_pool.get_value(ParameterName.Region)
#Generate snippet
snippet = TemplateSnippet()
snippet.snippet_name = RdsDefault.SnippetName
snippet.source_url = RdsDefault.get_snippet_url(region)
snippet.order = RdsDefault.SnippetRemoveOrder
template_spec.template_snippets.append(snippet)
#Remove option settings
for pname in RdsDefault.OptionNames:
_remove_option_setting(option_settings,
option_to_remove,
RdsDefault.Namespace,
RdsDefault.OptionNames[pname])