mds_plugin/compute.py
def list_vnics(**kwargs):
    """Lists all available vnics for the given compartment and
    availability_domain

    Args:
        **kwargs: Optional parameters

    Keyword Args:
        instance_id (str): OCID of the compute instance
        availability_domain (str): The name of the availability_domain to use.
        ignore_current (bool): Whether the current instance should be ignored
        compartment_id (str): OCID of the parent 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:
        The list of shapes in either JSON or human readable format
    """

    instance_id = kwargs.get("instance_id")
    availability_domain = kwargs.get("availability_domain")
    ignore_current = kwargs.get("ignore_current", 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)
    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)
        current_instance_id = configuration.get_current_instance_id(
            config=config)
        if not ignore_current and not instance_id:
            instance_id = current_instance_id

        if not instance_id and interactive:
            instance_id = get_instance_id(
                compartment_id=compartment_id,
                config=config, interactive=interactive)
        if not instance_id:
            raise ValueError("No instance_id given."
                             "Cancelling operation")

        import oci.exceptions

        try:
            # Initialize the oci client
            compute = core.get_oci_compute_client(config=config)
            network = core.get_oci_virtual_network_client(config=config)

            vnic_attachments = compute.list_vnic_attachments(
                compartment_id=compartment_id,
                availability_domain=availability_domain,
                instance_id=instance_id).data

            vnics = []
            for vnic_att in vnic_attachments:
                vnics.append(network.get_vnic(vnic_att.vnic_id).data)

            return core.return_oci_object(
                oci_object=vnics,
                return_formatted=return_formatted,
                return_python_object=return_python_object,
                format_function=format_vnic_listing)

        except oci.exceptions.ServiceError as e:
            if raise_exceptions:
                raise
            print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
    except Exception as e:
        if raise_exceptions:
            raise
        print(f'ERROR: {e}')
Lists all available vnics for the given compartment and
    availability_domain

    Args:
        **kwargs: Optional parameters

    Keyword Args:
        instance_id (str): OCID of the compute instance
        availability_domain (str): The name of the availability_domain to use.
        ignore_current (bool): Whether the current instance should be ignored
        compartment_id (str): OCID of the parent 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:
        The list of shapes in either JSON or human readable format
    
Lists all available vnics for the given compartment and
availability_domain
Lists all available vnics for the given compartment and availability_domain
def list_vnics(**kwargs):
    instance_id = kwargs.get("instance_id")
    availability_domain = kwargs.get("availability_domain")
    ignore_current = kwargs.get("ignore_current", 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)
    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)
        current_instance_id = configuration.get_current_instance_id(
            config=config)
        if not ignore_current and not instance_id:
            instance_id = current_instance_id
        if not instance_id and interactive:
            instance_id = get_instance_id(
                compartment_id=compartment_id,
                config=config, interactive=interactive)
        if not instance_id:
            raise ValueError("No instance_id given."
                             "Cancelling operation")
        import oci.exceptions
        try:
            compute = core.get_oci_compute_client(config=config)
            network = core.get_oci_virtual_network_client(config=config)
            vnic_attachments = compute.list_vnic_attachments(
                compartment_id=compartment_id,
                availability_domain=availability_domain,
                instance_id=instance_id).data
            vnics = []
            for vnic_att in vnic_attachments:
                vnics.append(network.get_vnic(vnic_att.vnic_id).data)
            return core.return_oci_object(
                oci_object=vnics,
                return_formatted=return_formatted,
                return_python_object=return_python_object,
                format_function=format_vnic_listing)
        except oci.exceptions.ServiceError as e:
            if raise_exceptions:
                raise
            print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
    except Exception as e:
        if raise_exceptions:
            raise
        print(f'ERROR: {e}')
def list_vnics ( ** kwargs ) : instance_id = kwargs . get ( "instance_id" ) availability_domain = kwargs . get ( "availability_domain" ) ignore_current = kwargs . get ( "ignore_current" , 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 ) 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 ) current_instance_id = configuration . get_current_instance_id ( config = config ) if not ignore_current and not instance_id : instance_id = current_instance_id if not instance_id and interactive : instance_id = get_instance_id ( compartment_id = compartment_id , config = config , interactive = interactive ) if not instance_id : raise ValueError ( "No instance_id given." "Cancelling operation" ) import oci . exceptions try : compute = core . get_oci_compute_client ( config = config ) network = core . get_oci_virtual_network_client ( config = config ) vnic_attachments = compute . list_vnic_attachments ( compartment_id = compartment_id , availability_domain = availability_domain , instance_id = instance_id ) . data vnics = [ ] for vnic_att in vnic_attachments : vnics . append ( network . get_vnic ( vnic_att . vnic_id ) . data ) return core . return_oci_object ( oci_object = vnics , return_formatted = return_formatted , return_python_object = return_python_object , format_function = format_vnic_listing ) except oci . exceptions . ServiceError as e : if raise_exceptions : raise print ( f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})' ) except Exception as e : if raise_exceptions : raise print ( f'ERROR: {e}' )
Lists all available vnics for the given compartment and
availability_domain
Lists all available vnics for the given compartment and availability_domain
"""Lists all available vnics for the given compartment and
    availability_domain

    Args:
        **kwargs: Optional parameters

    Keyword Args:
        instance_id (str): OCID of the compute instance
        availability_domain (str): The name of the availability_domain to use.
        ignore_current (bool): Whether the current instance should be ignored
        compartment_id (str): OCID of the parent 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:
        The list of shapes in either JSON or human readable format
    """ # Initialize the oci client

The list of shapes in either JSON or human readable format
The list of shapes in either JSON or human readable format
**kwargs
None