Esempio n. 1
0
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
Esempio n. 2
0
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, False)
    eb_client = api_wrapper.create_eb_client(parameter_pool)

    app_name = parameter_pool.get_value(ParameterName.ApplicationName, False)    
    api_wrapper.create_application(parameter_pool, app_name, eb_client = eb_client)
    
    spec = TemplateSpecification()
    spec.template_snippets.append(TemplateSnippet(RdsDefault.SnippetName,
                                                 snippet_url, 
                                                 order = RdsDefault.SnippetAddOrder))
    spec.template_source.solution_stack_name = solution_stack 
        
    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