mds_plugin/network.py
def list_networks(**kwargs):
    """Lists all networks of the given compartment

    Args:
        **kwargs: Additional options

    Keyword Args:
        public_subnet (bool): Whether only public or private subnets should be 
            considered
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        return_formatted (bool): If set to true, a list object is returned.
        check_privileges (bool): Checks if the user has privileges for the 
            subnet

    Returns:
        a network object
    """
    public_subnet = kwargs.get("public_subnet")
    compartment_id = kwargs.get("compartment_id")
    config = kwargs.get("config")
    return_formatted = kwargs.get("return_formatted", True)
    check_privileges = kwargs.get("check_privileges", False)

    # 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.exceptions

        # Create VirtualNetworkClient
        virtual_network = core.get_oci_virtual_network_client(
            config=config)

        # List the virtual networks
        vcns = virtual_network.list_vcns(
            compartment_id=compartment_id).data

        # Filter out all sub-nets that are not conforming to the
        # public_subnet options
        if public_subnet is not None:
            # Loop over VCNs to see if access is granted
            good_vcns = []
            for vcn in vcns:
                try:
                    if network_has_subnet(
                            network=vcn, compartment_id=compartment_id,
                            config=config,
                            public_subnet=public_subnet,
                            check_privileges=check_privileges):
                        good_vcns.append(vcn)
                except oci.exceptions.ServiceError as e:
                    pass
            vcns = good_vcns

        if return_formatted:
            return format_network_listing(vcns)
        else:
            return oci.util.to_dict(vcns)

    except ValueError as e:
        print(f"ERROR: {str(e)}")
        return
Lists all networks of the given compartment

    Args:
        **kwargs: Additional options

    Keyword Args:
        public_subnet (bool): Whether only public or private subnets should be 
            considered
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        return_formatted (bool): If set to true, a list object is returned.
        check_privileges (bool): Checks if the user has privileges for the 
            subnet

    Returns:
        a network object
    
Lists all networks of the given compartment
Lists all networks of the given compartment
def list_networks(**kwargs):
    public_subnet = kwargs.get("public_subnet")
    compartment_id = kwargs.get("compartment_id")
    config = kwargs.get("config")
    return_formatted = kwargs.get("return_formatted", True)
    check_privileges = kwargs.get("check_privileges", False)
    try:
        config = configuration.get_current_config(config=config)
        compartment_id = configuration.get_current_compartment_id(
            compartment_id=compartment_id, config=config)
        import oci.exceptions
        virtual_network = core.get_oci_virtual_network_client(
            config=config)
        vcns = virtual_network.list_vcns(
            compartment_id=compartment_id).data
        if public_subnet is not None:
            good_vcns = []
            for vcn in vcns:
                try:
                    if network_has_subnet(
                            network=vcn, compartment_id=compartment_id,
                            config=config,
                            public_subnet=public_subnet,
                            check_privileges=check_privileges):
                        good_vcns.append(vcn)
                except oci.exceptions.ServiceError as e:
                    pass
            vcns = good_vcns
        if return_formatted:
            return format_network_listing(vcns)
        else:
            return oci.util.to_dict(vcns)
    except ValueError as e:
        print(f"ERROR: {str(e)}")
        return
def list_networks ( ** kwargs ) : public_subnet = kwargs . get ( "public_subnet" ) compartment_id = kwargs . get ( "compartment_id" ) config = kwargs . get ( "config" ) return_formatted = kwargs . get ( "return_formatted" , True ) check_privileges = kwargs . get ( "check_privileges" , False ) try : config = configuration . get_current_config ( config = config ) compartment_id = configuration . get_current_compartment_id ( compartment_id = compartment_id , config = config ) import oci . exceptions virtual_network = core . get_oci_virtual_network_client ( config = config ) vcns = virtual_network . list_vcns ( compartment_id = compartment_id ) . data if public_subnet is not None : good_vcns = [ ] for vcn in vcns : try : if network_has_subnet ( network = vcn , compartment_id = compartment_id , config = config , public_subnet = public_subnet , check_privileges = check_privileges ) : good_vcns . append ( vcn ) except oci . exceptions . ServiceError as e : pass vcns = good_vcns if return_formatted : return format_network_listing ( vcns ) else : return oci . util . to_dict ( vcns ) except ValueError as e : print ( f"ERROR: {str(e)}" ) return
Lists all networks of the given compartment
Lists all networks of the given compartment
"""Lists all networks of the given compartment

    Args:
        **kwargs: Additional options

    Keyword Args:
        public_subnet (bool): Whether only public or private subnets should be 
            considered
        compartment_id (str): OCID of the parent compartment.
        config (object): An OCI config object or None.
        return_formatted (bool): If set to true, a list object is returned.
        check_privileges (bool): Checks if the user has privileges for the 
            subnet

    Returns:
        a network object
    """ # Get the active config and compartment
 # Create VirtualNetworkClient
 # List the virtual networks
 # Filter out all sub-nets that are not conforming to the
 # public_subnet options
 # Loop over VCNs to see if access is granted

a network object
a network object
**kwargs
None