loris_log.boto3Client API documentation

# loris_log.boto3Client

The boto3 client to establish connection to the AWS cloud.

class Boto3Client:

Boto 3 client to communicate to the AWS Cloudwatch.

Boto3Client(region_name, aws_key, aws_secret)

Boto 3 client default constructor.

Args:

    region_name (string): The AWS service region name.
    aws_key (string): The AWS service role access key.
    aws_secret (string): The AWS service role secret key.

Raises InvalidAttributeException:

    If the region_name, aws_key, aws_secret is not of type
    string.

Raises InvalidRegionNameException:

    If the region_name is a none or empty.

Raises InvalidRoleAccessKeyException:

    If the aws_key is a none or empty.

Raises InvalidRoleSecretException:

    If the aws_secret is a none or empty.

client
def get_log_groups(self):

Get all the log groups available in the AWS cloudwatch.

Returns:

    list: A list of log group names.

def get_log_stream(self, log_group_name):

Get all the log stream inside a log group.

Args:

    log_group_name (string): The name of the log group.

Returns:

    list:  All the log streams' name available in a log group.

def create_log_group_stream(self, log_group_name, log_stream_name):

Create the log stream if the current log group is present. Otherwise, create a new log group then create the desire the log stream

Args:

    log_group_name (string): the log group name.
    log_stream_name (string): the log stream name.

Returns:

    bool: whether the operation is a success (True) or otherwise (False).

Raises InvalidAttributeException:

    If the log_group_name or log_stream_name is not of type string.

Raises EmptyParameterException:

    If the log_group_name or log_stream_name is empty.

def set_log_message(self, log_group_name, log_stream_name, log_message, region_country):

Allow the application to push the relevant log message to the cloudwatch.

Args:

    log_group_name (string): The name of the log group.
    log_stream_name (string): The name of the log stream.
    log_message (list): A list of application/ service/ api message.
    region_country (string): The pytz country region.

Returns:

    response: A list of aws responses.

Raises InvalidAttributeException:

    If the log_group_name, log_stream_name, region or log_message
    is not of type string.

Raises EmptyParameterException:

    If the log_group_name, log_stream_name, region or log_message
    is empty.