mds_plugin/object_store.py
def create_bucket(bucket_name=None, compartment_id=None, config=None,
                  interactive=True, return_object=False):
    """Creates a new object store buckets

    Args:
        bucket_name (str): The name of the new bucket.
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        interactive (bool): Whether exceptions should be raised
        return_object (bool): Whether the bucket object should be returned 

    Returns:
        None or the created bucket object
    """

    # 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)

        import oci.object_storage
        import mysqlsh

        if not interactive and bucket_name is None:
            raise ValueError("A bucket_name needs to be provided")
        elif bucket_name is None:
            print("Creating a new object store bucket ...\n")

            # Get a name
            bucket_name = mysqlsh.globals.shell.prompt(
                "Please enter the name for the new bucket: ",
                {'defaultValue': ''}).strip()
            if bucket_name == "":
                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)

        create_bucket_details = oci.object_storage.models.CreateBucketDetails(
            name=bucket_name,
            compartment_id=compartment_id
        )

        bucket = os_client.create_bucket(
            namespace_name=namespace_name,
            create_bucket_details=create_bucket_details).data

        if return_object:
            return bucket
        else:
            print(f"Object Store Bucket {bucket_name} has being created.\n")
    except oci.exceptions.ServiceError as e:
        if not interactive:
            raise
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except (ValueError, oci.exceptions.ClientError) as e:
        if not interactive:
            raise
        print(f'ERROR: {e}')
        return
Creates a new object store buckets

    Args:
        bucket_name (str): The name of the new bucket.
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        interactive (bool): Whether exceptions should be raised
        return_object (bool): Whether the bucket object should be returned 

    Returns:
        None or the created bucket object
    
Creates a new object store buckets
Creates a new object store buckets
def create_bucket(bucket_name=None, compartment_id=None, config=None,
                  interactive=True, return_object=False):
    try:
        config = configuration.get_current_config(config=config)
        compartment_id = configuration.get_current_compartment_id(
            compartment_id=compartment_id, config=config)
        import oci.object_storage
        import mysqlsh
        if not interactive and bucket_name is None:
            raise ValueError("A bucket_name needs to be provided")
        elif bucket_name is None:
            print("Creating a new object store bucket ...\n")
            bucket_name = mysqlsh.globals.shell.prompt(
                "Please enter the name for the new bucket: ",
                {'defaultValue': ''}).strip()
            if bucket_name == "":
                print("Operation cancelled.")
                return
        os_client = core.get_oci_object_storage_client(config=config)
        namespace_name = get_object_store_namespace(config)
        create_bucket_details = oci.object_storage.models.CreateBucketDetails(
            name=bucket_name,
            compartment_id=compartment_id
        )
        bucket = os_client.create_bucket(
            namespace_name=namespace_name,
            create_bucket_details=create_bucket_details).data
        if return_object:
            return bucket
        else:
            print(f"Object Store Bucket {bucket_name} has being created.\n")
    except oci.exceptions.ServiceError as e:
        if not interactive:
            raise
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except (ValueError, oci.exceptions.ClientError) as e:
        if not interactive:
            raise
        print(f'ERROR: {e}')
        return
def create_bucket ( bucket_name = None , compartment_id = None , config = None , interactive = True , return_object = False ) : try : config = configuration . get_current_config ( config = config ) compartment_id = configuration . get_current_compartment_id ( compartment_id = compartment_id , config = config ) import oci . object_storage import mysqlsh if not interactive and bucket_name is None : raise ValueError ( "A bucket_name needs to be provided" ) elif bucket_name is None : print ( "Creating a new object store bucket ...\n" ) bucket_name = mysqlsh . globals . shell . prompt ( "Please enter the name for the new bucket: " , { 'defaultValue' : '' } ) . strip ( ) if bucket_name == "" : print ( "Operation cancelled." ) return os_client = core . get_oci_object_storage_client ( config = config ) namespace_name = get_object_store_namespace ( config ) create_bucket_details = oci . object_storage . models . CreateBucketDetails ( name = bucket_name , compartment_id = compartment_id ) bucket = os_client . create_bucket ( namespace_name = namespace_name , create_bucket_details = create_bucket_details ) . data if return_object : return bucket else : print ( f"Object Store Bucket {bucket_name} has being created.\n" ) except oci . exceptions . ServiceError as e : if not interactive : raise print ( f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})' ) return except ( ValueError , oci . exceptions . ClientError ) as e : if not interactive : raise print ( f'ERROR: {e}' ) return
Creates a new object store buckets
Creates a new object store buckets
"""Creates a new object store buckets

    Args:
        bucket_name (str): The name of the new bucket.
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        interactive (bool): Whether exceptions should be raised
        return_object (bool): Whether the bucket object should be returned 

    Returns:
        None or the created bucket object
    """ # Get the active config and compartment
 # Get a name
 # Initialize the  Object Store client
 # Get Object Store namespace

None or the created bucket object
None or the created bucket object
bucket_name
The name of the new bucket.
The name of the new bucket .
compartment_id
OCID of the parent compartment.
OCID of the parent compartment .
config
An OCI config object or None.
An OCI config object or None .
interactive
Whether exceptions should be raised
Whether exceptions should be raised
return_object
Whether the bucket object should be returned
Whether the bucket object should be returned