List objects in a given S3 bucket.

    Returns a list of objects.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_s3_bucket.list_objects mybucket

def list_objects(Bucket, Delimiter=None, EncodingType=None, Prefix=None,
                 FetchOwner=False, StartAfter=None, region=None, key=None,
                 keyid=None, profile=None):
    '''
    List objects in a given S3 bucket.

    Returns a list of objects.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_s3_bucket.list_objects mybucket

    '''

    try:
        Contents = []
        args = {'Bucket': Bucket, 'FetchOwner': FetchOwner}
        args.update({'Delimiter': Delimiter}) if Delimiter else None
        args.update({'EncodingType': EncodingType}) if Delimiter else None
        args.update({'Prefix': Prefix}) if Prefix else None
        args.update({'StartAfter': StartAfter}) if StartAfter else None
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        IsTruncated = True
        while IsTruncated:
            ret = conn.list_objects_v2(**args)
            IsTruncated = ret.get('IsTruncated', False)
            if IsTruncated in ('True', 'true', True):
                args['ContinuationToken'] = ret['NextContinuationToken']
            Contents += ret.get('Contents', [])
        return {'Contents': Contents}
    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}