1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cen
  5. getTrafficMarkingPolicies
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.cen.getTrafficMarkingPolicies

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    This data source provides the Cen Traffic Marking Policies of the current Alibaba Cloud user.

    NOTE: Available in v1.173.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.cen.getTrafficMarkingPolicies({
        transitRouterId: "example_value",
        ids: [
            "example_value-1",
            "example_value-2",
        ],
    });
    export const cenTrafficMarkingPolicyId1 = ids.then(ids => ids.policies?.[0]?.id);
    const nameRegex = alicloud.cen.getTrafficMarkingPolicies({
        transitRouterId: "example_value",
        nameRegex: "^my-TrafficMarkingPolicy",
    });
    export const cenTrafficMarkingPolicyId2 = nameRegex.then(nameRegex => nameRegex.policies?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.cen.get_traffic_marking_policies(transit_router_id="example_value",
        ids=[
            "example_value-1",
            "example_value-2",
        ])
    pulumi.export("cenTrafficMarkingPolicyId1", ids.policies[0].id)
    name_regex = alicloud.cen.get_traffic_marking_policies(transit_router_id="example_value",
        name_regex="^my-TrafficMarkingPolicy")
    pulumi.export("cenTrafficMarkingPolicyId2", name_regex.policies[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := cen.GetTrafficMarkingPolicies(ctx, &cen.GetTrafficMarkingPoliciesArgs{
    			TransitRouterId: "example_value",
    			Ids: []string{
    				"example_value-1",
    				"example_value-2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("cenTrafficMarkingPolicyId1", ids.Policies[0].Id)
    		nameRegex, err := cen.GetTrafficMarkingPolicies(ctx, &cen.GetTrafficMarkingPoliciesArgs{
    			TransitRouterId: "example_value",
    			NameRegex:       pulumi.StringRef("^my-TrafficMarkingPolicy"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("cenTrafficMarkingPolicyId2", nameRegex.Policies[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.Cen.GetTrafficMarkingPolicies.Invoke(new()
        {
            TransitRouterId = "example_value",
            Ids = new[]
            {
                "example_value-1",
                "example_value-2",
            },
        });
    
        var nameRegex = AliCloud.Cen.GetTrafficMarkingPolicies.Invoke(new()
        {
            TransitRouterId = "example_value",
            NameRegex = "^my-TrafficMarkingPolicy",
        });
    
        return new Dictionary<string, object?>
        {
            ["cenTrafficMarkingPolicyId1"] = ids.Apply(getTrafficMarkingPoliciesResult => getTrafficMarkingPoliciesResult.Policies[0]?.Id),
            ["cenTrafficMarkingPolicyId2"] = nameRegex.Apply(getTrafficMarkingPoliciesResult => getTrafficMarkingPoliciesResult.Policies[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.cen.CenFunctions;
    import com.pulumi.alicloud.cen.inputs.GetTrafficMarkingPoliciesArgs;
    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 = CenFunctions.getTrafficMarkingPolicies(GetTrafficMarkingPoliciesArgs.builder()
                .transitRouterId("example_value")
                .ids(            
                    "example_value-1",
                    "example_value-2")
                .build());
    
            ctx.export("cenTrafficMarkingPolicyId1", ids.applyValue(getTrafficMarkingPoliciesResult -> getTrafficMarkingPoliciesResult.policies()[0].id()));
            final var nameRegex = CenFunctions.getTrafficMarkingPolicies(GetTrafficMarkingPoliciesArgs.builder()
                .transitRouterId("example_value")
                .nameRegex("^my-TrafficMarkingPolicy")
                .build());
    
            ctx.export("cenTrafficMarkingPolicyId2", nameRegex.applyValue(getTrafficMarkingPoliciesResult -> getTrafficMarkingPoliciesResult.policies()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:cen:getTrafficMarkingPolicies
          Arguments:
            transitRouterId: example_value
            ids:
              - example_value-1
              - example_value-2
      nameRegex:
        fn::invoke:
          Function: alicloud:cen:getTrafficMarkingPolicies
          Arguments:
            transitRouterId: example_value
            nameRegex: ^my-TrafficMarkingPolicy
    outputs:
      cenTrafficMarkingPolicyId1: ${ids.policies[0].id}
      cenTrafficMarkingPolicyId2: ${nameRegex.policies[0].id}
    

    Using getTrafficMarkingPolicies

    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 getTrafficMarkingPolicies(args: GetTrafficMarkingPoliciesArgs, opts?: InvokeOptions): Promise<GetTrafficMarkingPoliciesResult>
    function getTrafficMarkingPoliciesOutput(args: GetTrafficMarkingPoliciesOutputArgs, opts?: InvokeOptions): Output<GetTrafficMarkingPoliciesResult>
    def get_traffic_marking_policies(description: Optional[str] = None,
                                     ids: Optional[Sequence[str]] = None,
                                     name_regex: Optional[str] = None,
                                     output_file: Optional[str] = None,
                                     status: Optional[str] = None,
                                     transit_router_id: Optional[str] = None,
                                     opts: Optional[InvokeOptions] = None) -> GetTrafficMarkingPoliciesResult
    def get_traffic_marking_policies_output(description: Optional[pulumi.Input[str]] = None,
                                     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,
                                     transit_router_id: Optional[pulumi.Input[str]] = None,
                                     opts: Optional[InvokeOptions] = None) -> Output[GetTrafficMarkingPoliciesResult]
    func GetTrafficMarkingPolicies(ctx *Context, args *GetTrafficMarkingPoliciesArgs, opts ...InvokeOption) (*GetTrafficMarkingPoliciesResult, error)
    func GetTrafficMarkingPoliciesOutput(ctx *Context, args *GetTrafficMarkingPoliciesOutputArgs, opts ...InvokeOption) GetTrafficMarkingPoliciesResultOutput

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

    public static class GetTrafficMarkingPolicies 
    {
        public static Task<GetTrafficMarkingPoliciesResult> InvokeAsync(GetTrafficMarkingPoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetTrafficMarkingPoliciesResult> Invoke(GetTrafficMarkingPoliciesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTrafficMarkingPoliciesResult> getTrafficMarkingPolicies(GetTrafficMarkingPoliciesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:cen/getTrafficMarkingPolicies:getTrafficMarkingPolicies
      arguments:
        # arguments dictionary

    The following arguments are supported:

    TransitRouterId string
    The ID of the transit router.
    Description string
    Ids List<string>
    A list of Traffic Marking Policy IDs.
    NameRegex string
    A regex string to filter results by Traffic Marking Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of the resource. Valid values: Active, Creating, Deleting, Updating.
    TransitRouterId string
    The ID of the transit router.
    Description string
    Ids []string
    A list of Traffic Marking Policy IDs.
    NameRegex string
    A regex string to filter results by Traffic Marking Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of the resource. Valid values: Active, Creating, Deleting, Updating.
    transitRouterId String
    The ID of the transit router.
    description String
    ids List<String>
    A list of Traffic Marking Policy IDs.
    nameRegex String
    A regex string to filter results by Traffic Marking Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of the resource. Valid values: Active, Creating, Deleting, Updating.
    transitRouterId string
    The ID of the transit router.
    description string
    ids string[]
    A list of Traffic Marking Policy IDs.
    nameRegex string
    A regex string to filter results by Traffic Marking Policy name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    status string
    The status of the resource. Valid values: Active, Creating, Deleting, Updating.
    transit_router_id str
    The ID of the transit router.
    description str
    ids Sequence[str]
    A list of Traffic Marking Policy IDs.
    name_regex str
    A regex string to filter results by Traffic Marking Policy name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    status str
    The status of the resource. Valid values: Active, Creating, Deleting, Updating.
    transitRouterId String
    The ID of the transit router.
    description String
    ids List<String>
    A list of Traffic Marking Policy IDs.
    nameRegex String
    A regex string to filter results by Traffic Marking Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of the resource. Valid values: Active, Creating, Deleting, Updating.

    getTrafficMarkingPolicies Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    Policies List<Pulumi.AliCloud.Cen.Outputs.GetTrafficMarkingPoliciesPolicy>
    TransitRouterId string
    Description string
    NameRegex string
    OutputFile string
    Status string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    Policies []GetTrafficMarkingPoliciesPolicy
    TransitRouterId string
    Description string
    NameRegex string
    OutputFile string
    Status string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<GetTrafficMarkingPoliciesPolicy>
    transitRouterId String
    description String
    nameRegex String
    outputFile String
    status String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    policies GetTrafficMarkingPoliciesPolicy[]
    transitRouterId string
    description string
    nameRegex string
    outputFile string
    status string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    policies Sequence[GetTrafficMarkingPoliciesPolicy]
    transit_router_id str
    description str
    name_regex str
    output_file str
    status str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<Property Map>
    transitRouterId String
    description String
    nameRegex String
    outputFile String
    status String

    Supporting Types

    GetTrafficMarkingPoliciesPolicy

    Description string
    The description of the Traffic Marking Policy.
    Id string
    The ID of the resource. The value is formatted <transit_router_id>:<traffic_marking_policy_id>.
    MarkingDscp int
    The DSCP(Differentiated Services Code Point) of the Traffic Marking Policy.
    Priority int
    The Priority of the Traffic Marking Policy.
    Status string
    The status of the resource.
    TrafficMarkingPolicyId string
    The ID of the Traffic Marking Policy.
    TrafficMarkingPolicyName string
    The name of the Traffic Marking Policy.
    TransitRouterId string
    The ID of the transit router.
    Description string
    The description of the Traffic Marking Policy.
    Id string
    The ID of the resource. The value is formatted <transit_router_id>:<traffic_marking_policy_id>.
    MarkingDscp int
    The DSCP(Differentiated Services Code Point) of the Traffic Marking Policy.
    Priority int
    The Priority of the Traffic Marking Policy.
    Status string
    The status of the resource.
    TrafficMarkingPolicyId string
    The ID of the Traffic Marking Policy.
    TrafficMarkingPolicyName string
    The name of the Traffic Marking Policy.
    TransitRouterId string
    The ID of the transit router.
    description String
    The description of the Traffic Marking Policy.
    id String
    The ID of the resource. The value is formatted <transit_router_id>:<traffic_marking_policy_id>.
    markingDscp Integer
    The DSCP(Differentiated Services Code Point) of the Traffic Marking Policy.
    priority Integer
    The Priority of the Traffic Marking Policy.
    status String
    The status of the resource.
    trafficMarkingPolicyId String
    The ID of the Traffic Marking Policy.
    trafficMarkingPolicyName String
    The name of the Traffic Marking Policy.
    transitRouterId String
    The ID of the transit router.
    description string
    The description of the Traffic Marking Policy.
    id string
    The ID of the resource. The value is formatted <transit_router_id>:<traffic_marking_policy_id>.
    markingDscp number
    The DSCP(Differentiated Services Code Point) of the Traffic Marking Policy.
    priority number
    The Priority of the Traffic Marking Policy.
    status string
    The status of the resource.
    trafficMarkingPolicyId string
    The ID of the Traffic Marking Policy.
    trafficMarkingPolicyName string
    The name of the Traffic Marking Policy.
    transitRouterId string
    The ID of the transit router.
    description str
    The description of the Traffic Marking Policy.
    id str
    The ID of the resource. The value is formatted <transit_router_id>:<traffic_marking_policy_id>.
    marking_dscp int
    The DSCP(Differentiated Services Code Point) of the Traffic Marking Policy.
    priority int
    The Priority of the Traffic Marking Policy.
    status str
    The status of the resource.
    traffic_marking_policy_id str
    The ID of the Traffic Marking Policy.
    traffic_marking_policy_name str
    The name of the Traffic Marking Policy.
    transit_router_id str
    The ID of the transit router.
    description String
    The description of the Traffic Marking Policy.
    id String
    The ID of the resource. The value is formatted <transit_router_id>:<traffic_marking_policy_id>.
    markingDscp Number
    The DSCP(Differentiated Services Code Point) of the Traffic Marking Policy.
    priority Number
    The Priority of the Traffic Marking Policy.
    status String
    The status of the resource.
    trafficMarkingPolicyId String
    The ID of the Traffic Marking Policy.
    trafficMarkingPolicyName String
    The name of the Traffic Marking Policy.
    transitRouterId String
    The ID of the transit router.

    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.66.0 published on Friday, Nov 15, 2024 by Pulumi