1. Packages
  2. Alicloud Provider
  3. API Docs
  4. vpc
  5. getTrafficMirrorFilters
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.vpc.getTrafficMirrorFilters

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    This data source provides the Vpc Traffic Mirror Filters of the current Alibaba Cloud user.

    NOTE: Available in v1.140.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.vpc.getTrafficMirrorFilters({
        ids: ["example_id"],
    });
    export const vpcTrafficMirrorFilterId1 = ids.then(ids => ids.filters?.[0]?.id);
    const nameRegex = alicloud.vpc.getTrafficMirrorFilters({
        nameRegex: "^my-TrafficMirrorFilter",
    });
    export const vpcTrafficMirrorFilterId2 = nameRegex.then(nameRegex => nameRegex.filters?.[0]?.id);
    const filterName = alicloud.vpc.getTrafficMirrorFilters({
        trafficMirrorFilterName: "example_traffic_mirror_filter_name",
    });
    export const vpcTrafficMirrorFilterId3 = filterName.then(filterName => filterName.filters?.[0]?.id);
    const status = alicloud.vpc.getTrafficMirrorFilters({
        status: "^my-TrafficMirrorFilter",
    });
    export const vpcTrafficMirrorFilterId4 = status.then(status => status.filters?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.vpc.get_traffic_mirror_filters(ids=["example_id"])
    pulumi.export("vpcTrafficMirrorFilterId1", ids.filters[0].id)
    name_regex = alicloud.vpc.get_traffic_mirror_filters(name_regex="^my-TrafficMirrorFilter")
    pulumi.export("vpcTrafficMirrorFilterId2", name_regex.filters[0].id)
    filter_name = alicloud.vpc.get_traffic_mirror_filters(traffic_mirror_filter_name="example_traffic_mirror_filter_name")
    pulumi.export("vpcTrafficMirrorFilterId3", filter_name.filters[0].id)
    status = alicloud.vpc.get_traffic_mirror_filters(status="^my-TrafficMirrorFilter")
    pulumi.export("vpcTrafficMirrorFilterId4", status.filters[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := vpc.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
    			Ids: []string{
    				"example_id",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcTrafficMirrorFilterId1", ids.Filters[0].Id)
    		nameRegex, err := vpc.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
    			NameRegex: pulumi.StringRef("^my-TrafficMirrorFilter"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcTrafficMirrorFilterId2", nameRegex.Filters[0].Id)
    		filterName, err := vpc.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
    			TrafficMirrorFilterName: pulumi.StringRef("example_traffic_mirror_filter_name"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcTrafficMirrorFilterId3", filterName.Filters[0].Id)
    		status, err := vpc.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
    			Status: pulumi.StringRef("^my-TrafficMirrorFilter"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcTrafficMirrorFilterId4", status.Filters[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.Vpc.GetTrafficMirrorFilters.Invoke(new()
        {
            Ids = new[]
            {
                "example_id",
            },
        });
    
        var nameRegex = AliCloud.Vpc.GetTrafficMirrorFilters.Invoke(new()
        {
            NameRegex = "^my-TrafficMirrorFilter",
        });
    
        var filterName = AliCloud.Vpc.GetTrafficMirrorFilters.Invoke(new()
        {
            TrafficMirrorFilterName = "example_traffic_mirror_filter_name",
        });
    
        var status = AliCloud.Vpc.GetTrafficMirrorFilters.Invoke(new()
        {
            Status = "^my-TrafficMirrorFilter",
        });
    
        return new Dictionary<string, object?>
        {
            ["vpcTrafficMirrorFilterId1"] = ids.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[0]?.Id),
            ["vpcTrafficMirrorFilterId2"] = nameRegex.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[0]?.Id),
            ["vpcTrafficMirrorFilterId3"] = filterName.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[0]?.Id),
            ["vpcTrafficMirrorFilterId4"] = status.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.VpcFunctions;
    import com.pulumi.alicloud.vpc.inputs.GetTrafficMirrorFiltersArgs;
    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 ids = VpcFunctions.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
                .ids("example_id")
                .build());
    
            ctx.export("vpcTrafficMirrorFilterId1", ids.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
            final var nameRegex = VpcFunctions.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
                .nameRegex("^my-TrafficMirrorFilter")
                .build());
    
            ctx.export("vpcTrafficMirrorFilterId2", nameRegex.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
            final var filterName = VpcFunctions.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
                .trafficMirrorFilterName("example_traffic_mirror_filter_name")
                .build());
    
            ctx.export("vpcTrafficMirrorFilterId3", filterName.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
            final var status = VpcFunctions.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
                .status("^my-TrafficMirrorFilter")
                .build());
    
            ctx.export("vpcTrafficMirrorFilterId4", status.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:vpc:getTrafficMirrorFilters
          Arguments:
            ids:
              - example_id
      nameRegex:
        fn::invoke:
          Function: alicloud:vpc:getTrafficMirrorFilters
          Arguments:
            nameRegex: ^my-TrafficMirrorFilter
      filterName:
        fn::invoke:
          Function: alicloud:vpc:getTrafficMirrorFilters
          Arguments:
            trafficMirrorFilterName: example_traffic_mirror_filter_name
      status:
        fn::invoke:
          Function: alicloud:vpc:getTrafficMirrorFilters
          Arguments:
            status: ^my-TrafficMirrorFilter
    outputs:
      vpcTrafficMirrorFilterId1: ${ids.filters[0].id}
      vpcTrafficMirrorFilterId2: ${nameRegex.filters[0].id}
      vpcTrafficMirrorFilterId3: ${filterName.filters[0].id}
      vpcTrafficMirrorFilterId4: ${status.filters[0].id}
    

    Using getTrafficMirrorFilters

    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 getTrafficMirrorFilters(args: GetTrafficMirrorFiltersArgs, opts?: InvokeOptions): Promise<GetTrafficMirrorFiltersResult>
    function getTrafficMirrorFiltersOutput(args: GetTrafficMirrorFiltersOutputArgs, opts?: InvokeOptions): Output<GetTrafficMirrorFiltersResult>
    def get_traffic_mirror_filters(ids: Optional[Sequence[str]] = None,
                                   name_regex: Optional[str] = None,
                                   output_file: Optional[str] = None,
                                   status: Optional[str] = None,
                                   traffic_mirror_filter_name: Optional[str] = None,
                                   opts: Optional[InvokeOptions] = None) -> GetTrafficMirrorFiltersResult
    def get_traffic_mirror_filters_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                   name_regex: Optional[pulumi.Input[str]] = None,
                                   output_file: Optional[pulumi.Input[str]] = None,
                                   status: Optional[pulumi.Input[str]] = None,
                                   traffic_mirror_filter_name: Optional[pulumi.Input[str]] = None,
                                   opts: Optional[InvokeOptions] = None) -> Output[GetTrafficMirrorFiltersResult]
    func GetTrafficMirrorFilters(ctx *Context, args *GetTrafficMirrorFiltersArgs, opts ...InvokeOption) (*GetTrafficMirrorFiltersResult, error)
    func GetTrafficMirrorFiltersOutput(ctx *Context, args *GetTrafficMirrorFiltersOutputArgs, opts ...InvokeOption) GetTrafficMirrorFiltersResultOutput

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

    public static class GetTrafficMirrorFilters 
    {
        public static Task<GetTrafficMirrorFiltersResult> InvokeAsync(GetTrafficMirrorFiltersArgs args, InvokeOptions? opts = null)
        public static Output<GetTrafficMirrorFiltersResult> Invoke(GetTrafficMirrorFiltersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTrafficMirrorFiltersResult> getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:vpc/getTrafficMirrorFilters:getTrafficMirrorFilters
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of Traffic Mirror Filter IDs.
    NameRegex string
    A regex string to filter results by Traffic Mirror Filter name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    TrafficMirrorFilterName string
    The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
    Ids []string
    A list of Traffic Mirror Filter IDs.
    NameRegex string
    A regex string to filter results by Traffic Mirror Filter name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    TrafficMirrorFilterName string
    The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
    ids List<String>
    A list of Traffic Mirror Filter IDs.
    nameRegex String
    A regex string to filter results by Traffic Mirror Filter name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    trafficMirrorFilterName String
    The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
    ids string[]
    A list of Traffic Mirror Filter IDs.
    nameRegex string
    A regex string to filter results by Traffic Mirror Filter name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    status string
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    trafficMirrorFilterName string
    The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
    ids Sequence[str]
    A list of Traffic Mirror Filter IDs.
    name_regex str
    A regex string to filter results by Traffic Mirror Filter name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    status str
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    traffic_mirror_filter_name str
    The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
    ids List<String>
    A list of Traffic Mirror Filter IDs.
    nameRegex String
    A regex string to filter results by Traffic Mirror Filter name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    trafficMirrorFilterName String
    The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.

    getTrafficMirrorFilters Result

    The following output properties are available:

    Filters List<Pulumi.AliCloud.Vpc.Outputs.GetTrafficMirrorFiltersFilter>
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    NameRegex string
    OutputFile string
    Status string
    TrafficMirrorFilterName string
    Filters []GetTrafficMirrorFiltersFilter
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    NameRegex string
    OutputFile string
    Status string
    TrafficMirrorFilterName string
    filters List<GetTrafficMirrorFiltersFilter>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    nameRegex String
    outputFile String
    status String
    trafficMirrorFilterName String
    filters GetTrafficMirrorFiltersFilter[]
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    nameRegex string
    outputFile string
    status string
    trafficMirrorFilterName string
    filters Sequence[GetTrafficMirrorFiltersFilter]
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    name_regex str
    output_file str
    status str
    traffic_mirror_filter_name str
    filters List<Property Map>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    nameRegex String
    outputFile String
    status String
    trafficMirrorFilterName String

    Supporting Types

    GetTrafficMirrorFiltersFilter

    Id string
    The ID of the Traffic Mirror Filter.
    Status string
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    TrafficMirrorFilterDescription string
    The description of the filter.
    TrafficMirrorFilterId string
    The ID of the filter.
    TrafficMirrorFilterName string
    The name of the filter.
    Id string
    The ID of the Traffic Mirror Filter.
    Status string
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    TrafficMirrorFilterDescription string
    The description of the filter.
    TrafficMirrorFilterId string
    The ID of the filter.
    TrafficMirrorFilterName string
    The name of the filter.
    id String
    The ID of the Traffic Mirror Filter.
    status String
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    trafficMirrorFilterDescription String
    The description of the filter.
    trafficMirrorFilterId String
    The ID of the filter.
    trafficMirrorFilterName String
    The name of the filter.
    id string
    The ID of the Traffic Mirror Filter.
    status string
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    trafficMirrorFilterDescription string
    The description of the filter.
    trafficMirrorFilterId string
    The ID of the filter.
    trafficMirrorFilterName string
    The name of the filter.
    id str
    The ID of the Traffic Mirror Filter.
    status str
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    traffic_mirror_filter_description str
    The description of the filter.
    traffic_mirror_filter_id str
    The ID of the filter.
    traffic_mirror_filter_name str
    The name of the filter.
    id String
    The ID of the Traffic Mirror Filter.
    status String
    The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
    trafficMirrorFilterDescription String
    The description of the filter.
    trafficMirrorFilterId String
    The ID of the filter.
    trafficMirrorFilterName String
    The name of the filter.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi