mds_plugin/object_store.py
def list_bucket_objects(**kwargs):
    """Lists bucket object

    This function will list all bucket objects of the bucket with the
    given bucket_name.

    Args:
        **kwargs: Additional options

    Keyword Args:
        bucket_name (str): The name of the bucket
        name (str): Then name of the bucket object, can include * 
            to match multiple objects
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        interactive (bool): If set to false exceptions are raised
        return_formatted (bool): If set to true, a list object is returned.

    Returns:
        A list of dicts representing the bucket objects or a string or none
    """

    bucket_name = kwargs.get('bucket_name')
    name = kwargs.get('name')
    compartment_id = kwargs.get('compartment_id')
    config = kwargs.get('config')
    interactive = kwargs.get('interactive', True)
    return_formatted = kwargs.get('return_formatted', True)

    # Get the active config and compartment
    try:
        config = configuration.get_current_config(config=config)
        compartment_id = configuration.get_current_compartment_id(
            compartment_id=compartment_id, config=config)
        bucket_name = configuration.get_current_bucket_name(
            bucket_name=bucket_name, config=config)

        import oci.object_storage
        import oci.util
        import re

        bucket = get_bucket(
            bucket_name=bucket_name, compartment_id=compartment_id, config=config,
            interactive=interactive)
        if bucket is None:
            print("Operation cancelled.")
            return

        # Initialize the  Object Store client
        os_client = core.get_oci_object_storage_client(config=config)

        # Get Object Store namespace
        namespace_name = get_object_store_namespace(config)

        # List the bucket objects
        # bucket_objects = os_client.list_objects(
        #     namespace_name=namespace_name,
        #     bucket_name=bucket.name,
        #     fields="name,size,timeModified").data.objects

        bucket_objects = oci.pagination.list_call_get_all_results(
            os_client.list_objects,
            namespace_name=namespace_name,
            bucket_name=bucket.name,
            fields="name,size,timeModified",
            limit=1000).data.objects
        # Filter list if PARs
        if name and name != '*':
            name = name.lower()
            # Filter list if PARs
            if '*' in name:
                name_pattern = '^' + name.replace('*', '.+')
                bucket_objects = [obj for obj in bucket_objects
                                  if re.search(name_pattern, obj.name.lower())]
            else:
                bucket_objects = [obj for obj in bucket_objects
                                  if name == obj.name.lower()]

        if len(bucket_objects) < 1:
            if name:
                print(f"The bucket {bucket.name} contains no objects matching "
                      f"the object name {name}.")
            else:
                print(f"The bucket {bucket.name} contains no objects.")
            return

        if return_formatted:
            return format_bucket_objects_listing(bucket_objects=bucket_objects)
        else:
            # return compartments in JSON text output
            return oci.util.to_dict(bucket_objects)
    except oci.exceptions.ServiceError as e:
        if not interactive:
            raise
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except Exception as e:
        if not interactive:
            raise
        print(f'ERROR: {e}')
        return
Lists bucket object

    This function will list all bucket objects of the bucket with the
    given bucket_name.

    Args:
        **kwargs: Additional options

    Keyword Args:
        bucket_name (str): The name of the bucket
        name (str): Then name of the bucket object, can include * 
            to match multiple objects
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        interactive (bool): If set to false exceptions are raised
        return_formatted (bool): If set to true, a list object is returned.

    Returns:
        A list of dicts representing the bucket objects or a string or none
    
Lists bucket object
This function will list all bucket objects of the bucket with the
given bucket_name.
Lists bucket object This function will list all bucket objects of the bucket with the given bucket_name .
def list_bucket_objects(**kwargs):
    bucket_name = kwargs.get('bucket_name')
    name = kwargs.get('name')
    compartment_id = kwargs.get('compartment_id')
    config = kwargs.get('config')
    interactive = kwargs.get('interactive', True)
    return_formatted = kwargs.get('return_formatted', True)
    try:
        config = configuration.get_current_config(config=config)
        compartment_id = configuration.get_current_compartment_id(
            compartment_id=compartment_id, config=config)
        bucket_name = configuration.get_current_bucket_name(
            bucket_name=bucket_name, config=config)
        import oci.object_storage
        import oci.util
        import re
        bucket = get_bucket(
            bucket_name=bucket_name, compartment_id=compartment_id, config=config,
            interactive=interactive)
        if bucket is None:
            print("Operation cancelled.")
            return
        os_client = core.get_oci_object_storage_client(config=config)
        namespace_name = get_object_store_namespace(config)
        bucket_objects = oci.pagination.list_call_get_all_results(
            os_client.list_objects,
            namespace_name=namespace_name,
            bucket_name=bucket.name,
            fields="name,size,timeModified",
            limit=1000).data.objects
        if name and name != '*':
            name = name.lower()
            if '*' in name:
                name_pattern = '^' + name.replace('*', '.+')
                bucket_objects = [obj for obj in bucket_objects
                                  if re.search(name_pattern, obj.name.lower())]
            else:
                bucket_objects = [obj for obj in bucket_objects
                                  if name == obj.name.lower()]
        if len(bucket_objects) < 1:
            if name:
                print(f"The bucket {bucket.name} contains no objects matching "
                      f"the object name {name}.")
            else:
                print(f"The bucket {bucket.name} contains no objects.")
            return
        if return_formatted:
            return format_bucket_objects_listing(bucket_objects=bucket_objects)
        else:
            return oci.util.to_dict(bucket_objects)
    except oci.exceptions.ServiceError as e:
        if not interactive:
            raise
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except Exception as e:
        if not interactive:
            raise
        print(f'ERROR: {e}')
        return
def list_bucket_objects ( ** kwargs ) : bucket_name = kwargs . get ( 'bucket_name' ) name = kwargs . get ( 'name' ) compartment_id = kwargs . get ( 'compartment_id' ) config = kwargs . get ( 'config' ) interactive = kwargs . get ( 'interactive' , True ) return_formatted = kwargs . get ( 'return_formatted' , True ) try : config = configuration . get_current_config ( config = config ) compartment_id = configuration . get_current_compartment_id ( compartment_id = compartment_id , config = config ) bucket_name = configuration . get_current_bucket_name ( bucket_name = bucket_name , config = config ) import oci . object_storage import oci . util import re bucket = get_bucket ( bucket_name = bucket_name , compartment_id = compartment_id , config = config , interactive = interactive ) if bucket is None : print ( "Operation cancelled." ) return os_client = core . get_oci_object_storage_client ( config = config ) namespace_name = get_object_store_namespace ( config ) bucket_objects = oci . pagination . list_call_get_all_results ( os_client . list_objects , namespace_name = namespace_name , bucket_name = bucket . name , fields = "name,size,timeModified" , limit = 1000 ) . data . objects if name and name != '*' : name = name . lower ( ) if '*' in name : name_pattern = '^' + name . replace ( '*' , '.+' ) bucket_objects = [ obj for obj in bucket_objects if re . search ( name_pattern , obj . name . lower ( ) ) ] else : bucket_objects = [ obj for obj in bucket_objects if name == obj . name . lower ( ) ] if len ( bucket_objects ) < 1 : if name : print ( f"The bucket {bucket.name} contains no objects matching " f"the object name {name}." ) else : print ( f"The bucket {bucket.name} contains no objects." ) return if return_formatted : return format_bucket_objects_listing ( bucket_objects = bucket_objects ) else : return oci . util . to_dict ( bucket_objects ) except oci . exceptions . ServiceError as e : if not interactive : raise print ( f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})' ) return except Exception as e : if not interactive : raise print ( f'ERROR: {e}' ) return
Lists bucket object
This function will list all bucket objects of the bucket with the
given bucket_name.
Lists bucket object This function will list all bucket objects of the bucket with the given bucket_name .
"""Lists bucket object

    This function will list all bucket objects of the bucket with the
    given bucket_name.

    Args:
        **kwargs: Additional options

    Keyword Args:
        bucket_name (str): The name of the bucket
        name (str): Then name of the bucket object, can include * 
            to match multiple objects
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        interactive (bool): If set to false exceptions are raised
        return_formatted (bool): If set to true, a list object is returned.

    Returns:
        A list of dicts representing the bucket objects or a string or none
    """ # Get the active config and compartment
 # Initialize the  Object Store client
 # Get Object Store namespace
 # List the bucket objects
 # bucket_objects = os_client.list_objects(
 #     namespace_name=namespace_name,
 #     bucket_name=bucket.name,
 #     fields="name,size,timeModified").data.objects
 # Filter list if PARs
 # Filter list if PARs
 # return compartments in JSON text output

A list of dicts representing the bucket objects or a string or none
A list of dicts representing the bucket objects or a string or none
**kwargs
None