def interactive_update_lifcycle_policy(app_name): # Get current application settings api_model = elasticbeanstalk.describe_application(app_name) # Convert into yaml format from raw API lifecycle_config = LifecycleConfiguration(api_model) usr_model = lifecycle_config.convert_api_to_usr_model() # Save yaml file into temp file file_location = fileoperations.save_app_file(usr_model) fileoperations.open_file_for_editing(file_location) # Update and delete file try: usr_model = fileoperations.get_application_from_file(app_name) config_changes = lifecycle_config.collect_changes(usr_model) fileoperations.delete_app_file(app_name) except InvalidSyntaxError: io.log_error(strings['lifecycle.invalidsyntax']) fileoperations.delete_app_file(app_name) return if not config_changes: # no changes made, exit io.log_warning(strings['lifecycle.updatenochanges']) return elasticbeanstalk.update_application_resource_lifecycle(app_name, config_changes) io.echo(strings['lifecycle.success'])
def interactive_update_lifcycle_policy(app_name): api_model = elasticbeanstalk.describe_application(app_name) lifecycle_config = LifecycleConfiguration(api_model) usr_model = lifecycle_config.convert_api_to_usr_model() file_location = fileoperations.save_app_file(usr_model) fileoperations.open_file_for_editing(file_location) try: usr_model = fileoperations.get_application_from_file(app_name) config_changes = lifecycle_config.collect_changes(usr_model) fileoperations.delete_app_file(app_name) except InvalidSyntaxError: io.log_error(strings['lifecycle.invalidsyntax']) fileoperations.delete_app_file(app_name) return if not config_changes: io.log_warning(strings['lifecycle.updatenochanges']) return elasticbeanstalk.update_application_resource_lifecycle( app_name, config_changes) io.echo(strings['lifecycle.success'])
def interactive_update_lifcycle_policy(app_name): # Get current application settings api_model = elasticbeanstalk.describe_application(app_name) # Convert into yaml format from raw API lifecycle_config = LifecycleConfiguration(api_model) usr_model = lifecycle_config.convert_api_to_usr_model() # Save yaml file into temp file file_location = fileoperations.save_app_file(usr_model) fileoperations.open_file_for_editing(file_location) # Update and delete file try: usr_model = fileoperations.get_application_from_file(app_name) config_changes = lifecycle_config.collect_changes(usr_model) fileoperations.delete_app_file(app_name) except InvalidSyntaxError: io.log_error(strings['lifecycle.invalidsyntax']) fileoperations.delete_app_file(app_name) return if not config_changes: # no changes made, exit io.log_warning(strings['lifecycle.updatenochanges']) return elasticbeanstalk.update_application_resource_lifecycle( app_name, config_changes) io.echo(strings['lifecycle.success'])
def print_lifecycle_policy(app_name): application = elasticbeanstalk.describe_application(app_name) region = aws.get_region_name() io.echo('Application details for:', app_name) io.echo('{0}Region:'.format(SPACER), region) io.echo('{0}Description:'.format(SPACER), getattr(application, 'Description', NO_ITEM_TOKEN)) io.echo('{0}Date Created:'.format(SPACER), application['DateCreated'].strftime("%Y/%m/%d %H:%M %Z")) io.echo('{0}Date Updated:'.format(SPACER), application['DateUpdated'].strftime("%Y/%m/%d %H:%M %Z")) io.echo('{0}Application Versions:'.format(SPACER), getattr(application, 'Versions', NO_ITEM_TOKEN)) io.echo('{0}Resource Lifecycle Config(s):'.format(SPACER)) resource_configs = application['ResourceLifecycleConfig'] recursive_print_api_dict(resource_configs)
def ask_for_customer_confirmation_to_delete_all_application_resources( app_name): application = elasticbeanstalk.describe_application(app_name) application['Versions'] = application.get('Versions', []) environments = elasticbeanstalk.get_environment_names(app_name) confirm_message = prompts['delete.confirm'].format( app_name=app_name, env_num=len(environments), config_num=len(application['ConfigurationTemplates']), version_num=len(application['Versions'])) io.echo(confirm_message) io.validate_action(prompts['delete.validate'], app_name)
def print_lifecycle_policy(app_name): application = elasticbeanstalk.describe_application(app_name) region = aws.get_region_name() io.echo('Application details for:', app_name) io.echo('{0}Region:'.format(SPACER), region) io.echo('{0}Description:'.format(SPACER), getattr(application, 'Description', NO_ITEM_TOKEN)) io.echo('{0}Date Created:'.format(SPACER), application['DateCreated'].strftime("%Y/%m/%d %H:%M %Z")) io.echo('{0}Date Updated:'.format(SPACER), application['DateUpdated'].strftime("%Y/%m/%d %H:%M %Z")) io.echo('{0}Application Versions:'.format(SPACER), getattr(application, 'Versions', NO_ITEM_TOKEN)) io.echo('{0}Resource Lifecycle Config(s):'.format(SPACER)) resource_configs = application['ResourceLifecycleConfig'] recursive_print_api_dict(resource_configs)
def get_configurations(app_name): app = elasticbeanstalk.describe_application(app_name) return app['ConfigurationTemplates']
def get_configurations(app_name): app = elasticbeanstalk.describe_application(app_name) return app['ConfigurationTemplates']