1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Core
  5. getNetworkSecurityGroups
Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi

oci.Core.getNetworkSecurityGroups

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi

    This data source provides the list of Network Security Groups in Oracle Cloud Infrastructure Core service.

    Lists either the network security groups in the specified compartment, or those associated with the specified VLAN. You must specify either a vlanId or a compartmentId, but not both. If you specify a vlanId, all other parameters are ignored.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testNetworkSecurityGroups = oci.Core.getNetworkSecurityGroups({
        compartmentId: compartmentId,
        displayName: networkSecurityGroupDisplayName,
        state: networkSecurityGroupState,
        vcnId: testVcn.id,
        vlanId: testVlan.id,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_network_security_groups = oci.Core.get_network_security_groups(compartment_id=compartment_id,
        display_name=network_security_group_display_name,
        state=network_security_group_state,
        vcn_id=test_vcn["id"],
        vlan_id=test_vlan["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/go/oci/Core"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Core.GetNetworkSecurityGroups(ctx, &core.GetNetworkSecurityGroupsArgs{
    			CompartmentId: pulumi.StringRef(compartmentId),
    			DisplayName:   pulumi.StringRef(networkSecurityGroupDisplayName),
    			State:         pulumi.StringRef(networkSecurityGroupState),
    			VcnId:         pulumi.StringRef(testVcn.Id),
    			VlanId:        pulumi.StringRef(testVlan.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testNetworkSecurityGroups = Oci.Core.GetNetworkSecurityGroups.Invoke(new()
        {
            CompartmentId = compartmentId,
            DisplayName = networkSecurityGroupDisplayName,
            State = networkSecurityGroupState,
            VcnId = testVcn.Id,
            VlanId = testVlan.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Core.CoreFunctions;
    import com.pulumi.oci.Core.inputs.GetNetworkSecurityGroupsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var testNetworkSecurityGroups = CoreFunctions.getNetworkSecurityGroups(GetNetworkSecurityGroupsArgs.builder()
                .compartmentId(compartmentId)
                .displayName(networkSecurityGroupDisplayName)
                .state(networkSecurityGroupState)
                .vcnId(testVcn.id())
                .vlanId(testVlan.id())
                .build());
    
        }
    }
    
    variables:
      testNetworkSecurityGroups:
        fn::invoke:
          Function: oci:Core:getNetworkSecurityGroups
          Arguments:
            compartmentId: ${compartmentId}
            displayName: ${networkSecurityGroupDisplayName}
            state: ${networkSecurityGroupState}
            vcnId: ${testVcn.id}
            vlanId: ${testVlan.id}
    

    Using getNetworkSecurityGroups

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getNetworkSecurityGroups(args: GetNetworkSecurityGroupsArgs, opts?: InvokeOptions): Promise<GetNetworkSecurityGroupsResult>
    function getNetworkSecurityGroupsOutput(args: GetNetworkSecurityGroupsOutputArgs, opts?: InvokeOptions): Output<GetNetworkSecurityGroupsResult>
    def get_network_security_groups(compartment_id: Optional[str] = None,
                                    display_name: Optional[str] = None,
                                    filters: Optional[Sequence[_core.GetNetworkSecurityGroupsFilter]] = None,
                                    state: Optional[str] = None,
                                    vcn_id: Optional[str] = None,
                                    vlan_id: Optional[str] = None,
                                    opts: Optional[InvokeOptions] = None) -> GetNetworkSecurityGroupsResult
    def get_network_security_groups_output(compartment_id: Optional[pulumi.Input[str]] = None,
                                    display_name: Optional[pulumi.Input[str]] = None,
                                    filters: Optional[pulumi.Input[Sequence[pulumi.Input[_core.GetNetworkSecurityGroupsFilterArgs]]]] = None,
                                    state: Optional[pulumi.Input[str]] = None,
                                    vcn_id: Optional[pulumi.Input[str]] = None,
                                    vlan_id: Optional[pulumi.Input[str]] = None,
                                    opts: Optional[InvokeOptions] = None) -> Output[GetNetworkSecurityGroupsResult]
    func GetNetworkSecurityGroups(ctx *Context, args *GetNetworkSecurityGroupsArgs, opts ...InvokeOption) (*GetNetworkSecurityGroupsResult, error)
    func GetNetworkSecurityGroupsOutput(ctx *Context, args *GetNetworkSecurityGroupsOutputArgs, opts ...InvokeOption) GetNetworkSecurityGroupsResultOutput

    > Note: This function is named GetNetworkSecurityGroups in the Go SDK.

    public static class GetNetworkSecurityGroups 
    {
        public static Task<GetNetworkSecurityGroupsResult> InvokeAsync(GetNetworkSecurityGroupsArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkSecurityGroupsResult> Invoke(GetNetworkSecurityGroupsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworkSecurityGroupsResult> getNetworkSecurityGroups(GetNetworkSecurityGroupsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: oci:Core/getNetworkSecurityGroups:getNetworkSecurityGroups
      arguments:
        # arguments dictionary

    The following arguments are supported:

    CompartmentId string
    The OCID of the compartment.
    DisplayName string
    A filter to return only resources that match the given display name exactly.
    Filters List<GetNetworkSecurityGroupsFilter>
    State string
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    VcnId string
    The OCID of the VCN.
    VlanId string
    The OCID of the VLAN.
    CompartmentId string
    The OCID of the compartment.
    DisplayName string
    A filter to return only resources that match the given display name exactly.
    Filters []GetNetworkSecurityGroupsFilter
    State string
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    VcnId string
    The OCID of the VCN.
    VlanId string
    The OCID of the VLAN.
    compartmentId String
    The OCID of the compartment.
    displayName String
    A filter to return only resources that match the given display name exactly.
    filters List<GetNetworkSecurityGroupsFilter>
    state String
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    vcnId String
    The OCID of the VCN.
    vlanId String
    The OCID of the VLAN.
    compartmentId string
    The OCID of the compartment.
    displayName string
    A filter to return only resources that match the given display name exactly.
    filters GetNetworkSecurityGroupsFilter[]
    state string
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    vcnId string
    The OCID of the VCN.
    vlanId string
    The OCID of the VLAN.
    compartment_id str
    The OCID of the compartment.
    display_name str
    A filter to return only resources that match the given display name exactly.
    filters Sequence[core.GetNetworkSecurityGroupsFilter]
    state str
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    vcn_id str
    The OCID of the VCN.
    vlan_id str
    The OCID of the VLAN.
    compartmentId String
    The OCID of the compartment.
    displayName String
    A filter to return only resources that match the given display name exactly.
    filters List<Property Map>
    state String
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    vcnId String
    The OCID of the VCN.
    vlanId String
    The OCID of the VLAN.

    getNetworkSecurityGroups Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    NetworkSecurityGroups List<GetNetworkSecurityGroupsNetworkSecurityGroup>
    The list of network_security_groups.
    CompartmentId string
    The OCID of the compartment the network security group is in.
    DisplayName string
    A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    Filters List<GetNetworkSecurityGroupsFilter>
    State string
    The network security group's current state.
    VcnId string
    The OCID of the network security group's VCN.
    VlanId string
    Id string
    The provider-assigned unique ID for this managed resource.
    NetworkSecurityGroups []GetNetworkSecurityGroupsNetworkSecurityGroup
    The list of network_security_groups.
    CompartmentId string
    The OCID of the compartment the network security group is in.
    DisplayName string
    A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    Filters []GetNetworkSecurityGroupsFilter
    State string
    The network security group's current state.
    VcnId string
    The OCID of the network security group's VCN.
    VlanId string
    id String
    The provider-assigned unique ID for this managed resource.
    networkSecurityGroups List<GetNetworkSecurityGroupsNetworkSecurityGroup>
    The list of network_security_groups.
    compartmentId String
    The OCID of the compartment the network security group is in.
    displayName String
    A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    filters List<GetNetworkSecurityGroupsFilter>
    state String
    The network security group's current state.
    vcnId String
    The OCID of the network security group's VCN.
    vlanId String
    id string
    The provider-assigned unique ID for this managed resource.
    networkSecurityGroups GetNetworkSecurityGroupsNetworkSecurityGroup[]
    The list of network_security_groups.
    compartmentId string
    The OCID of the compartment the network security group is in.
    displayName string
    A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    filters GetNetworkSecurityGroupsFilter[]
    state string
    The network security group's current state.
    vcnId string
    The OCID of the network security group's VCN.
    vlanId string
    id str
    The provider-assigned unique ID for this managed resource.
    network_security_groups Sequence[core.GetNetworkSecurityGroupsNetworkSecurityGroup]
    The list of network_security_groups.
    compartment_id str
    The OCID of the compartment the network security group is in.
    display_name str
    A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    filters Sequence[core.GetNetworkSecurityGroupsFilter]
    state str
    The network security group's current state.
    vcn_id str
    The OCID of the network security group's VCN.
    vlan_id str
    id String
    The provider-assigned unique ID for this managed resource.
    networkSecurityGroups List<Property Map>
    The list of network_security_groups.
    compartmentId String
    The OCID of the compartment the network security group is in.
    displayName String
    A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    filters List<Property Map>
    state String
    The network security group's current state.
    vcnId String
    The OCID of the network security group's VCN.
    vlanId String

    Supporting Types

    GetNetworkSecurityGroupsFilter

    Name string
    Values List<string>
    Regex bool
    Name string
    Values []string
    Regex bool
    name String
    values List<String>
    regex Boolean
    name string
    values string[]
    regex boolean
    name str
    values Sequence[str]
    regex bool
    name String
    values List<String>
    regex Boolean

    GetNetworkSecurityGroupsNetworkSecurityGroup

    CompartmentId string
    The OCID of the compartment.
    DefinedTags Dictionary<string, object>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    DisplayName string
    A filter to return only resources that match the given display name exactly.
    FreeformTags Dictionary<string, object>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    The OCID of the network security group.
    State string
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    TimeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    VcnId string
    The OCID of the VCN.
    CompartmentId string
    The OCID of the compartment.
    DefinedTags map[string]interface{}
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    DisplayName string
    A filter to return only resources that match the given display name exactly.
    FreeformTags map[string]interface{}
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    The OCID of the network security group.
    State string
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    TimeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    VcnId string
    The OCID of the VCN.
    compartmentId String
    The OCID of the compartment.
    definedTags Map<String,Object>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName String
    A filter to return only resources that match the given display name exactly.
    freeformTags Map<String,Object>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    The OCID of the network security group.
    state String
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    timeCreated String
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcnId String
    The OCID of the VCN.
    compartmentId string
    The OCID of the compartment.
    definedTags {[key: string]: any}
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName string
    A filter to return only resources that match the given display name exactly.
    freeformTags {[key: string]: any}
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id string
    The OCID of the network security group.
    state string
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    timeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcnId string
    The OCID of the VCN.
    compartment_id str
    The OCID of the compartment.
    defined_tags Mapping[str, Any]
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    display_name str
    A filter to return only resources that match the given display name exactly.
    freeform_tags Mapping[str, Any]
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id str
    The OCID of the network security group.
    state str
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    time_created str
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcn_id str
    The OCID of the VCN.
    compartmentId String
    The OCID of the compartment.
    definedTags Map<Any>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName String
    A filter to return only resources that match the given display name exactly.
    freeformTags Map<Any>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    The OCID of the network security group.
    state String
    A filter to return only resources that match the specified lifecycle state. The value is case insensitive.
    timeCreated String
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcnId String
    The OCID of the VCN.

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi