示例#1
0
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
示例#2
0
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
示例#3
0
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'
示例#4
0
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'
示例#5
0
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'
示例#6
0
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'