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
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)
def is_rds_snippet_compatible(parameter_pool, solution_stack, snippet_url=None): if snippet_url is None: snippet_url = parameter_pool.get_value(ParameterName.RdsSnippetUrl) eb_client = api_wrapper.create_eb_client(parameter_pool) app_name = parameter_pool.get_value(ParameterName.ApplicationName) api_wrapper.create_application(parameter_pool, app_name, eb_client=eb_client) spec = TemplateSpecification(TemplateSource(solution_stack), [ TemplateSnippet(RdsDefault.SnippetName, snippet_url, order=RdsDefault.SnippetAddOrder) ]) try: log.info('Send request for ValidateConfigurationSettings call.') response = eb_client.validate_configuration_settings( application_name=app_name, template_specification=spec) log.info('Received response for ValidateConfigurationSettings call.') api_wrapper.log_response('ValidateConfigurationSettings', response.result) except MissingParameterException: return False else: log.info('Received response for ValidateConfigurationSettings call.') api_wrapper.log_response('ValidateConfigurationSettings', response.result) return True
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])
def _add_rds_extension(parameter_pool, template_spec, option_settings, option_to_remove): region = parameter_pool.get_value(ParameterName.Region, False) #Generate snippet env_name = parameter_pool.get_value(ParameterName.EnvironmentName, False) if not has_rds_instance(parameter_pool, env_name): snippet = TemplateSnippet() snippet.snippet_name = RdsDefault.SnippetName snippet.source_url = RdsDefault.get_snippet_url(region) snippet.order = RdsDefault.SnippetAddOrder template_spec.template_snippets.append(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.get_value(pname) is not None: _update_option_setting(option_settings, RdsDefault.Namespace, RdsDefault.OptionNames[pname], parameter_pool.get_value(pname, False)) _trim_rds_options(option_settings, option_to_remove)