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

alicloud.nlb.getSecurityPolicies

Explore with Pulumi AI

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

    This data source provides the Nlb Security Policies of the current Alibaba Cloud user.

    NOTE: Available in v1.187.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.nlb.getSecurityPolicies({});
    export const nlbSecurityPolicyId1 = ids.then(ids => ids.policies?.[0]?.id);
    const nameRegex = alicloud.nlb.getSecurityPolicies({
        nameRegex: "^my-SecurityPolicy",
    });
    export const nlbSecurityPolicyId2 = nameRegex.then(nameRegex => nameRegex.policies?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.nlb.get_security_policies()
    pulumi.export("nlbSecurityPolicyId1", ids.policies[0].id)
    name_regex = alicloud.nlb.get_security_policies(name_regex="^my-SecurityPolicy")
    pulumi.export("nlbSecurityPolicyId2", name_regex.policies[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/nlb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := nlb.GetSecurityPolicies(ctx, &nlb.GetSecurityPoliciesArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("nlbSecurityPolicyId1", ids.Policies[0].Id)
    		nameRegex, err := nlb.GetSecurityPolicies(ctx, &nlb.GetSecurityPoliciesArgs{
    			NameRegex: pulumi.StringRef("^my-SecurityPolicy"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("nlbSecurityPolicyId2", 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.Nlb.GetSecurityPolicies.Invoke();
    
        var nameRegex = AliCloud.Nlb.GetSecurityPolicies.Invoke(new()
        {
            NameRegex = "^my-SecurityPolicy",
        });
    
        return new Dictionary<string, object?>
        {
            ["nlbSecurityPolicyId1"] = ids.Apply(getSecurityPoliciesResult => getSecurityPoliciesResult.Policies[0]?.Id),
            ["nlbSecurityPolicyId2"] = nameRegex.Apply(getSecurityPoliciesResult => getSecurityPoliciesResult.Policies[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.nlb.NlbFunctions;
    import com.pulumi.alicloud.nlb.inputs.GetSecurityPoliciesArgs;
    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 = NlbFunctions.getSecurityPolicies();
    
            ctx.export("nlbSecurityPolicyId1", ids.applyValue(getSecurityPoliciesResult -> getSecurityPoliciesResult.policies()[0].id()));
            final var nameRegex = NlbFunctions.getSecurityPolicies(GetSecurityPoliciesArgs.builder()
                .nameRegex("^my-SecurityPolicy")
                .build());
    
            ctx.export("nlbSecurityPolicyId2", nameRegex.applyValue(getSecurityPoliciesResult -> getSecurityPoliciesResult.policies()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:nlb:getSecurityPolicies
          Arguments: {}
      nameRegex:
        fn::invoke:
          Function: alicloud:nlb:getSecurityPolicies
          Arguments:
            nameRegex: ^my-SecurityPolicy
    outputs:
      nlbSecurityPolicyId1: ${ids.policies[0].id}
      nlbSecurityPolicyId2: ${nameRegex.policies[0].id}
    

    Using getSecurityPolicies

    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 getSecurityPolicies(args: GetSecurityPoliciesArgs, opts?: InvokeOptions): Promise<GetSecurityPoliciesResult>
    function getSecurityPoliciesOutput(args: GetSecurityPoliciesOutputArgs, opts?: InvokeOptions): Output<GetSecurityPoliciesResult>
    def get_security_policies(ids: Optional[Sequence[str]] = None,
                              name_regex: Optional[str] = None,
                              output_file: Optional[str] = None,
                              resource_group_id: Optional[str] = None,
                              security_policy_names: Optional[Sequence[str]] = None,
                              status: Optional[str] = None,
                              tags: Optional[Mapping[str, str]] = None,
                              opts: Optional[InvokeOptions] = None) -> GetSecurityPoliciesResult
    def get_security_policies_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                              name_regex: Optional[pulumi.Input[str]] = None,
                              output_file: Optional[pulumi.Input[str]] = None,
                              resource_group_id: Optional[pulumi.Input[str]] = None,
                              security_policy_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                              status: Optional[pulumi.Input[str]] = None,
                              tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetSecurityPoliciesResult]
    func GetSecurityPolicies(ctx *Context, args *GetSecurityPoliciesArgs, opts ...InvokeOption) (*GetSecurityPoliciesResult, error)
    func GetSecurityPoliciesOutput(ctx *Context, args *GetSecurityPoliciesOutputArgs, opts ...InvokeOption) GetSecurityPoliciesResultOutput

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

    public static class GetSecurityPolicies 
    {
        public static Task<GetSecurityPoliciesResult> InvokeAsync(GetSecurityPoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetSecurityPoliciesResult> Invoke(GetSecurityPoliciesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSecurityPoliciesResult> getSecurityPolicies(GetSecurityPoliciesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:nlb/getSecurityPolicies:getSecurityPolicies
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of Security Policy IDs.
    NameRegex string
    A regex string to filter results by Security Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ResourceGroupId string
    The ID of the resource group.
    SecurityPolicyNames List<string>
    The names of the TLS security policies.
    Status string
    The status of the resource. Valid values: Available, Configuring.
    Tags Dictionary<string, string>
    Ids []string
    A list of Security Policy IDs.
    NameRegex string
    A regex string to filter results by Security Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ResourceGroupId string
    The ID of the resource group.
    SecurityPolicyNames []string
    The names of the TLS security policies.
    Status string
    The status of the resource. Valid values: Available, Configuring.
    Tags map[string]string
    ids List<String>
    A list of Security Policy IDs.
    nameRegex String
    A regex string to filter results by Security Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    resourceGroupId String
    The ID of the resource group.
    securityPolicyNames List<String>
    The names of the TLS security policies.
    status String
    The status of the resource. Valid values: Available, Configuring.
    tags Map<String,String>
    ids string[]
    A list of Security Policy IDs.
    nameRegex string
    A regex string to filter results by Security Policy name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    resourceGroupId string
    The ID of the resource group.
    securityPolicyNames string[]
    The names of the TLS security policies.
    status string
    The status of the resource. Valid values: Available, Configuring.
    tags {[key: string]: string}
    ids Sequence[str]
    A list of Security Policy IDs.
    name_regex str
    A regex string to filter results by Security Policy name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    resource_group_id str
    The ID of the resource group.
    security_policy_names Sequence[str]
    The names of the TLS security policies.
    status str
    The status of the resource. Valid values: Available, Configuring.
    tags Mapping[str, str]
    ids List<String>
    A list of Security Policy IDs.
    nameRegex String
    A regex string to filter results by Security Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    resourceGroupId String
    The ID of the resource group.
    securityPolicyNames List<String>
    The names of the TLS security policies.
    status String
    The status of the resource. Valid values: Available, Configuring.
    tags Map<String>

    getSecurityPolicies 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.Nlb.Outputs.GetSecurityPoliciesPolicy>
    NameRegex string
    OutputFile string
    ResourceGroupId string
    SecurityPolicyNames List<string>
    Status string
    Tags Dictionary<string, string>
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    Policies []GetSecurityPoliciesPolicy
    NameRegex string
    OutputFile string
    ResourceGroupId string
    SecurityPolicyNames []string
    Status string
    Tags map[string]string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<GetSecurityPoliciesPolicy>
    nameRegex String
    outputFile String
    resourceGroupId String
    securityPolicyNames List<String>
    status String
    tags Map<String,String>
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    policies GetSecurityPoliciesPolicy[]
    nameRegex string
    outputFile string
    resourceGroupId string
    securityPolicyNames string[]
    status string
    tags {[key: string]: string}
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    policies Sequence[GetSecurityPoliciesPolicy]
    name_regex str
    output_file str
    resource_group_id str
    security_policy_names Sequence[str]
    status str
    tags Mapping[str, str]
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<Property Map>
    nameRegex String
    outputFile String
    resourceGroupId String
    securityPolicyNames List<String>
    status String
    tags Map<String>

    Supporting Types

    GetSecurityPoliciesPolicy

    Ciphers List<string>
    The supported cipher suites, which are determined by the TLS protocol version.
    Id string
    The id of the TLS security policy.
    ResourceGroupId string
    The ID of the resource group.
    SecurityPolicyName string
    The name of the TLS security policy.
    Status string
    The status of the resource.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    TlsVersions List<string>
    The TLS protocol versions that are supported.
    Ciphers []string
    The supported cipher suites, which are determined by the TLS protocol version.
    Id string
    The id of the TLS security policy.
    ResourceGroupId string
    The ID of the resource group.
    SecurityPolicyName string
    The name of the TLS security policy.
    Status string
    The status of the resource.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    TlsVersions []string
    The TLS protocol versions that are supported.
    ciphers List<String>
    The supported cipher suites, which are determined by the TLS protocol version.
    id String
    The id of the TLS security policy.
    resourceGroupId String
    The ID of the resource group.
    securityPolicyName String
    The name of the TLS security policy.
    status String
    The status of the resource.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    tlsVersions List<String>
    The TLS protocol versions that are supported.
    ciphers string[]
    The supported cipher suites, which are determined by the TLS protocol version.
    id string
    The id of the TLS security policy.
    resourceGroupId string
    The ID of the resource group.
    securityPolicyName string
    The name of the TLS security policy.
    status string
    The status of the resource.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    tlsVersions string[]
    The TLS protocol versions that are supported.
    ciphers Sequence[str]
    The supported cipher suites, which are determined by the TLS protocol version.
    id str
    The id of the TLS security policy.
    resource_group_id str
    The ID of the resource group.
    security_policy_name str
    The name of the TLS security policy.
    status str
    The status of the resource.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    tls_versions Sequence[str]
    The TLS protocol versions that are supported.
    ciphers List<String>
    The supported cipher suites, which are determined by the TLS protocol version.
    id String
    The id of the TLS security policy.
    resourceGroupId String
    The ID of the resource group.
    securityPolicyName String
    The name of the TLS security policy.
    status String
    The status of the resource.
    tags Map<String>
    A mapping of tags to assign to the resource.
    tlsVersions List<String>
    The TLS protocol versions that are supported.

    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