mds_plugin/mysql_database_service.py [1927:2008]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    db_system_name = kwargs.get("db_system_name")
    db_system_id = kwargs.get("db_system_id")
    ignore_current = kwargs.get("ignore_current", False)

    cluster_size = kwargs.get("cluster_size")
    shape_name = kwargs.get("shape_name")

    await_completion = kwargs.get("await_completion", False)

    compartment_id = kwargs.get("compartment_id")
    config = kwargs.get("config")
    config_profile = kwargs.get("config_profile")

    interactive = kwargs.get("interactive", core.get_interactive_default())
    raise_exceptions = kwargs.get("raise_exceptions", not interactive)

    # Get the active config and compartment
    try:
        config = configuration.get_current_config(
            config=config, config_profile=config_profile,
            interactive=interactive)
        compartment_id = configuration.get_current_compartment_id(
            compartment_id=compartment_id, config=config)
        current_db_system_id = configuration.get_current_db_system_id(
            config=config)
        if (not ignore_current and db_system_name is None
                and db_system_id is None and current_db_system_id):
            db_system_id = current_db_system_id

        import oci.identity
        import oci.mysql
        import mysqlsh
        import json

        try:
            # Get the db_system based on input params
            db_system = get_db_system(
                db_system_name=db_system_name, db_system_id=db_system_id,
                compartment_id=compartment_id, config=config,
                interactive=interactive, raise_exceptions=True,
                return_python_object=True)
            if db_system is None:
                if db_system_name or db_system_id:
                    raise ValueError("DB System not found.")
                else:
                    raise Exception("Cancelling operation.")

            if not cluster_size and interactive:
                # Prompt the user for the new values
                cluster_size = mysqlsh.globals.shell.prompt(
                    f"Please enter the number of nodes for the HeatWave cluster "
                    f"(1 - 64): ",
                    {'defaultValue': '1'}).strip()
            if cluster_size is None:
                raise ValueError("The cluster_size was not specified.")
            if cluster_size == "":
                cluster_size = '1'

            try:
                cluster_size = int(cluster_size)
            except:
                raise ValueError(f"'{cluster_size}' is not a valid number.")

            if cluster_size < 1 or cluster_size > 64:
                raise ValueError(f"The cluster size must be between 1 and 64. A size of {cluster_size} was given.")

            if not shape_name and interactive:
                shape = get_db_system_shape(
                    is_supported_for="HEATWAVECLUSTER",
                    compartment_id=db_system.compartment_id,
                    config=config, config_profile=config_profile,
                    interactive=True,
                    raise_exceptions=True,
                    return_python_object=True)

                if shape:
                    shape_name = shape.name
            if not shape_name:
                raise ValueError("No shape name given.")

            # Initialize the DbSystem client
            db_sys = core.get_oci_db_system_client(config=config)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



mds_plugin/mysql_database_service.py [2063:2144]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    db_system_name = kwargs.get("db_system_name")
    db_system_id = kwargs.get("db_system_id")
    ignore_current = kwargs.get("ignore_current", False)

    cluster_size = kwargs.get("cluster_size")
    shape_name = kwargs.get("shape_name")

    await_completion = kwargs.get("await_completion", False)

    compartment_id = kwargs.get("compartment_id")
    config = kwargs.get("config")
    config_profile = kwargs.get("config_profile")

    interactive = kwargs.get("interactive", core.get_interactive_default())
    raise_exceptions = kwargs.get("raise_exceptions", not interactive)

    # Get the active config and compartment
    try:
        config = configuration.get_current_config(
            config=config, config_profile=config_profile,
            interactive=interactive)
        compartment_id = configuration.get_current_compartment_id(
            compartment_id=compartment_id, config=config)
        current_db_system_id = configuration.get_current_db_system_id(
            config=config)
        if (not ignore_current and db_system_name is None
                and db_system_id is None and current_db_system_id):
            db_system_id = current_db_system_id

        import oci.identity
        import oci.mysql
        import mysqlsh
        import json

        try:
            # Get the db_system based on input params
            db_system = get_db_system(
                db_system_name=db_system_name, db_system_id=db_system_id,
                compartment_id=compartment_id, config=config,
                interactive=interactive, raise_exceptions=True,
                return_python_object=True)
            if db_system is None:
                if db_system_name or db_system_id:
                    raise ValueError("DB System not found.")
                else:
                    raise Exception("Cancelling operation.")

            if not cluster_size and interactive:
                # Prompt the user for the new values
                cluster_size = mysqlsh.globals.shell.prompt(
                    f"Please enter the number of nodes for the HeatWave cluster "
                    f"(1 - 64): ",
                    {'defaultValue': '1'}).strip()
            if cluster_size is None:
                raise ValueError("The cluster_size was not specified.")
            if cluster_size == "":
                cluster_size = '1'

            try:
                cluster_size = int(cluster_size)
            except:
                raise ValueError(f"'{cluster_size}' is not a valid number.")

            if cluster_size < 1 or cluster_size > 64:
                raise ValueError(f"The cluster size must be between 1 and 64. A size of {cluster_size} was given.")

            if not shape_name and interactive:
                shape = get_db_system_shape(
                    is_supported_for="HEATWAVECLUSTER",
                    compartment_id=db_system.compartment_id,
                    config=config, config_profile=config_profile,
                    interactive=True,
                    raise_exceptions=True,
                    return_python_object=True)

                if shape:
                    shape_name = shape.name
            if not shape_name:
                raise ValueError("No shape name given.")

            # Initialize the DbSystem client
            db_sys = core.get_oci_db_system_client(config=config)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



