mds_plugin/compute.py
def list_shapes(**kwargs):
    """Returns a list of all available compute shapes

    This list is specific for the given compartment and availability_domain

    Args:
        **kwargs: Additional options

    Keyword Args:
        limit_shapes_to (list): A list of shape names
        availability_domain (str): The name of the availability_domain to use
        compartment_id (str): OCID of the compartment
        config (dict): An OCI config object or None
        config_profile (str): The name of an OCI config profile
        interactive (bool): Indicates whether to execute in interactive mode
        raise_exceptions (bool): If true exceptions are raised
        return_formatted (bool): If true a human readable string is returned
        return_python_object (bool): Used for internal plugin calls

    Returns:
        A list of shapes
    """

    limit_shapes_to = kwargs.get("limit_shapes_to")
    availability_domain = kwargs.get("availability_domain")

    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)
    return_formatted = kwargs.get("return_formatted", interactive)
    return_python_object = kwargs.get("return_python_object", False)

    try:
        # Get the active config and compartment
        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)

        import oci.util
        import oci.exceptions
        from mds_plugin import compartment

        try:
            # Get the availability_domain name
            availability_domain_obj = compartment.get_availability_domain(
                random_selection=not interactive,
                compartment_id=compartment_id,
                availability_domain=availability_domain,
                config=config, interactive=interactive,
                raise_exceptions=raise_exceptions,
                return_formatted=return_formatted,
                return_python_object=True)
            if availability_domain_obj:
                availability_domain = availability_domain_obj.name

            if not availability_domain:
                raise ValueError("No availability domain given. "
                                 "Operation cancelled.")

            # Initialize the identity client
            compute_client = core.get_oci_compute_client(config=config)

            # Get list of available shapes
            shapes = compute_client.list_shapes(
                compartment_id=compartment_id,
                availability_domain=availability_domain).data

            # If a list of shape names was given, filter according to that list
            if limit_shapes_to is not None:
                shapes = [s for s in shapes if any(
                    s.shape in l_s for l_s in limit_shapes_to)]

            return core.return_oci_object(
                oci_object=shapes,
                return_formatted=return_formatted,
                return_python_object=return_python_object,
                format_function=format_shapes)
        except oci.exceptions.ServiceError as e:
            if raise_exceptions:
                raise e
            print(f'Could not list the shapes for this compartment.\n'
                  f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
    except Exception as e:
        if raise_exceptions:
            raise e
        print(f'Could not list the shapes for this compartment.\n'
              f'ERROR: {str(e)}')
Returns a list of all available compute shapes

    This list is specific for the given compartment and availability_domain

    Args:
        **kwargs: Additional options

    Keyword Args:
        limit_shapes_to (list): A list of shape names
        availability_domain (str): The name of the availability_domain to use
        compartment_id (str): OCID of the compartment
        config (dict): An OCI config object or None
        config_profile (str): The name of an OCI config profile
        interactive (bool): Indicates whether to execute in interactive mode
        raise_exceptions (bool): If true exceptions are raised
        return_formatted (bool): If true a human readable string is returned
        return_python_object (bool): Used for internal plugin calls

    Returns:
        A list of shapes
    
Returns a list of all available compute shapes
This list is specific for the given compartment and availability_domain
Returns a list of all available compute shapes This list is specific for the given compartment and availability_domain
def list_shapes(**kwargs):
    limit_shapes_to = kwargs.get("limit_shapes_to")
    availability_domain = kwargs.get("availability_domain")
    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)
    return_formatted = kwargs.get("return_formatted", interactive)
    return_python_object = kwargs.get("return_python_object", False)
    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)
        import oci.util
        import oci.exceptions
        from mds_plugin import compartment
        try:
            availability_domain_obj = compartment.get_availability_domain(
                random_selection=not interactive,
                compartment_id=compartment_id,
                availability_domain=availability_domain,
                config=config, interactive=interactive,
                raise_exceptions=raise_exceptions,
                return_formatted=return_formatted,
                return_python_object=True)
            if availability_domain_obj:
                availability_domain = availability_domain_obj.name
            if not availability_domain:
                raise ValueError("No availability domain given. "
                                 "Operation cancelled.")
            compute_client = core.get_oci_compute_client(config=config)
            shapes = compute_client.list_shapes(
                compartment_id=compartment_id,
                availability_domain=availability_domain).data
            if limit_shapes_to is not None:
                shapes = [s for s in shapes if any(
                    s.shape in l_s for l_s in limit_shapes_to)]
            return core.return_oci_object(
                oci_object=shapes,
                return_formatted=return_formatted,
                return_python_object=return_python_object,
                format_function=format_shapes)
        except oci.exceptions.ServiceError as e:
            if raise_exceptions:
                raise e
            print(f'Could not list the shapes for this compartment.\n'
                  f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
    except Exception as e:
        if raise_exceptions:
            raise e
        print(f'Could not list the shapes for this compartment.\n'
              f'ERROR: {str(e)}')
def list_shapes ( ** kwargs ) : limit_shapes_to = kwargs . get ( "limit_shapes_to" ) availability_domain = kwargs . get ( "availability_domain" ) 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 ) return_formatted = kwargs . get ( "return_formatted" , interactive ) return_python_object = kwargs . get ( "return_python_object" , False ) 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 ) import oci . util import oci . exceptions from mds_plugin import compartment try : availability_domain_obj = compartment . get_availability_domain ( random_selection = not interactive , compartment_id = compartment_id , availability_domain = availability_domain , config = config , interactive = interactive , raise_exceptions = raise_exceptions , return_formatted = return_formatted , return_python_object = True ) if availability_domain_obj : availability_domain = availability_domain_obj . name if not availability_domain : raise ValueError ( "No availability domain given. " "Operation cancelled." ) compute_client = core . get_oci_compute_client ( config = config ) shapes = compute_client . list_shapes ( compartment_id = compartment_id , availability_domain = availability_domain ) . data if limit_shapes_to is not None : shapes = [ s for s in shapes if any ( s . shape in l_s for l_s in limit_shapes_to ) ] return core . return_oci_object ( oci_object = shapes , return_formatted = return_formatted , return_python_object = return_python_object , format_function = format_shapes ) except oci . exceptions . ServiceError as e : if raise_exceptions : raise e print ( f'Could not list the shapes for this compartment.\n' f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})' ) except Exception as e : if raise_exceptions : raise e print ( f'Could not list the shapes for this compartment.\n' f'ERROR: {str(e)}' )
Returns a list of all available compute shapes
This list is specific for the given compartment and availability_domain
Returns a list of all available compute shapes This list is specific for the given compartment and availability_domain
"""Returns a list of all available compute shapes

    This list is specific for the given compartment and availability_domain

    Args:
        **kwargs: Additional options

    Keyword Args:
        limit_shapes_to (list): A list of shape names
        availability_domain (str): The name of the availability_domain to use
        compartment_id (str): OCID of the compartment
        config (dict): An OCI config object or None
        config_profile (str): The name of an OCI config profile
        interactive (bool): Indicates whether to execute in interactive mode
        raise_exceptions (bool): If true exceptions are raised
        return_formatted (bool): If true a human readable string is returned
        return_python_object (bool): Used for internal plugin calls

    Returns:
        A list of shapes
    """ # Get the active config and compartment
 # Get the availability_domain name
 # Initialize the identity client
 # Get list of available shapes
 # If a list of shape names was given, filter according to that list

A list of shapes
A list of shapes
**kwargs
None