def is_shared_load_balancer(app_name, env_name): namespace = namespaces.ENVIRONMENT load_balancer_is_shared = option_names.LOAD_BALANCER_IS_SHARED load_balancer_type = option_names.LOAD_BALANCER_TYPE app_name = app_name env_name = env_name env_config = elasticbeanstalk.describe_configuration_settings( app_name, env_name) lb_type = elasticbeanstalk.get_specific_configuration( env_config, namespace, load_balancer_type) if lb_type == elb_names.APPLICATION_VERSION: value = elasticbeanstalk.get_specific_configuration( env_config, namespace, load_balancer_is_shared) return value.lower() == 'true' else: return False
def log_streaming_enabled(app_name, env_name): """ Checks if log streaming is enabled for the given environment :param app_name: application name :param env_name: environment name :return: boolean if the given environment has log stremaing enabled """ config_settings = elasticbeanstalk.describe_configuration_settings(app_name, env_name) stream_enabled = elasticbeanstalk.get_specific_configuration(config_settings, namespaces.CLOUDWATCH_LOGS, option_names.STREAM_LOGS) if stream_enabled is not None and stream_enabled == 'true': return True return False
def instance_log_streaming_enabled(app_name, env_name, config_settings=None): """ Checks if log streaming is enabled for the given environment :param app_name: application name :param env_name: environment name :param config_settings: the raw response of a call to describe_configuration_settings :return: boolean if the given environment has log streaming enabled """ config_settings = config_settings or elasticbeanstalk.describe_configuration_settings( app_name, env_name) stream_enabled = elasticbeanstalk.get_specific_configuration( config_settings, namespaces.CLOUDWATCH_LOGS, option_names.STREAM_LOGS) return stream_enabled == 'true'
def environment_health_streaming_enabled(app_name, env_name, config_settings=None): """ Checks if health transition streaming is enabled for the given environment :param app_name: application name :param env_name: environment name :param config_settings: the raw response of a call to describe_configuration_settings :return: boolean if the given environment has health transition streaming enabled """ config_settings = config_settings or elasticbeanstalk.describe_configuration_settings(app_name, env_name) stream_enabled = elasticbeanstalk.get_specific_configuration( config_settings, namespaces.CLOUDWATCH_ENVIRONMENT_HEALTH_LOGS, option_names.CLOUDWATCH_ENVIRONMENT_HEALTH_LOGS_ENABLED ) return stream_enabled == 'true'
def instance_log_streaming_enabled(app_name, env_name, config_settings=None): """ Checks if log streaming is enabled for the given environment :param app_name: application name :param env_name: environment name :param config_settings: the raw response of a call to describe_configuration_settings :return: boolean if the given environment has log streaming enabled """ config_settings = config_settings or elasticbeanstalk.describe_configuration_settings(app_name, env_name) stream_enabled = elasticbeanstalk.get_specific_configuration( config_settings, namespaces.CLOUDWATCH_LOGS, option_names.STREAM_LOGS ) return stream_enabled == 'true'