alicloud logo
Alibaba Cloud v3.29.0, Jan 20 23

alicloud.alb.getSecurityPolicies

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

NOTE: Available in v1.130.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Alb.GetSecurityPolicies.Invoke();

    var nameRegex = AliCloud.Alb.GetSecurityPolicies.Invoke(new()
    {
        NameRegex = "^my-SecurityPolicy",
    });

    return new Dictionary<string, object?>
    {
        ["albSecurityPolicyId1"] = ids.Apply(getSecurityPoliciesResult => getSecurityPoliciesResult.Policies[0]?.Id),
        ["albSecurityPolicyId2"] = nameRegex.Apply(getSecurityPoliciesResult => getSecurityPoliciesResult.Policies[0]?.Id),
    };
});
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := alb.GetSecurityPolicies(ctx, nil, nil)
		if err != nil {
			return err
		}
		ctx.Export("albSecurityPolicyId1", ids.Policies[0].Id)
		nameRegex, err := alb.GetSecurityPolicies(ctx, &alb.GetSecurityPoliciesArgs{
			NameRegex: pulumi.StringRef("^my-SecurityPolicy"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("albSecurityPolicyId2", nameRegex.Policies[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.alb.AlbFunctions;
import com.pulumi.alicloud.alb.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 = AlbFunctions.getSecurityPolicies();

        ctx.export("albSecurityPolicyId1", ids.applyValue(getSecurityPoliciesResult -> getSecurityPoliciesResult.policies()[0].id()));
        final var nameRegex = AlbFunctions.getSecurityPolicies(GetSecurityPoliciesArgs.builder()
            .nameRegex("^my-SecurityPolicy")
            .build());

        ctx.export("albSecurityPolicyId2", nameRegex.applyValue(getSecurityPoliciesResult -> getSecurityPoliciesResult.policies()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.alb.get_security_policies()
pulumi.export("albSecurityPolicyId1", ids.policies[0].id)
name_regex = alicloud.alb.get_security_policies(name_regex="^my-SecurityPolicy")
pulumi.export("albSecurityPolicyId2", name_regex.policies[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.alb.getSecurityPolicies({});
export const albSecurityPolicyId1 = ids.then(ids => ids.policies?.[0]?.id);
const nameRegex = alicloud.alb.getSecurityPolicies({
    nameRegex: "^my-SecurityPolicy",
});
export const albSecurityPolicyId2 = nameRegex.then(nameRegex => nameRegex.policies?.[0]?.id);
variables:
  ids:
    fn::invoke:
      Function: alicloud:alb:getSecurityPolicies
      Arguments: {}
  nameRegex:
    fn::invoke:
      Function: alicloud:alb:getSecurityPolicies
      Arguments:
        nameRegex: ^my-SecurityPolicy
outputs:
  albSecurityPolicyId1: ${ids.policies[0].id}
  albSecurityPolicyId2: ${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_ids: Optional[Sequence[str]] = None,
                          security_policy_name: Optional[str] = None,
                          status: Optional[str] = None,
                          tags: Optional[Mapping[str, Any]] = 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_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                          security_policy_name: Optional[pulumi.Input[str]] = None,
                          status: Optional[pulumi.Input[str]] = None,
                          tags: Optional[pulumi.Input[Mapping[str, Any]]] = 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:alb/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
ResourceGroupId string

The ID of the resource group.

SecurityPolicyIds List<string>

The security policy ids.

SecurityPolicyName string

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

Status string

The status of the resource.

Tags Dictionary<string, object>
Ids []string

A list of Security Policy IDs.

NameRegex string

A regex string to filter results by Security Policy name.

OutputFile string
ResourceGroupId string

The ID of the resource group.

SecurityPolicyIds []string

The security policy ids.

SecurityPolicyName string

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

Status string

The status of the resource.

Tags map[string]interface{}
ids List<String>

A list of Security Policy IDs.

nameRegex String

A regex string to filter results by Security Policy name.

outputFile String
resourceGroupId String

The ID of the resource group.

securityPolicyIds List<String>

The security policy ids.

securityPolicyName String

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status String

The status of the resource.

tags Map<String,Object>
ids string[]

A list of Security Policy IDs.

nameRegex string

A regex string to filter results by Security Policy name.

outputFile string
resourceGroupId string

The ID of the resource group.

securityPolicyIds string[]

The security policy ids.

securityPolicyName string

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status string

The status of the resource.

tags {[key: string]: any}
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
resource_group_id str

The ID of the resource group.

security_policy_ids Sequence[str]

The security policy ids.

security_policy_name str

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status str

The status of the resource.

tags Mapping[str, Any]
ids List<String>

A list of Security Policy IDs.

nameRegex String

A regex string to filter results by Security Policy name.

outputFile String
resourceGroupId String

The ID of the resource group.

securityPolicyIds List<String>

The security policy ids.

securityPolicyName String

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status String

The status of the resource.

tags Map<Any>

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.Alb.Outputs.GetSecurityPoliciesPolicy>
NameRegex string
OutputFile string
ResourceGroupId string
SecurityPolicyIds List<string>
SecurityPolicyName string
Status string
Tags Dictionary<string, object>
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Names []string
Policies []GetSecurityPoliciesPolicy
NameRegex string
OutputFile string
ResourceGroupId string
SecurityPolicyIds []string
SecurityPolicyName string
Status string
Tags map[string]interface{}
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
securityPolicyIds List<String>
securityPolicyName String
status String
tags Map<String,Object>
id string

The provider-assigned unique ID for this managed resource.

ids string[]
names string[]
policies GetSecurityPoliciesPolicy[]
nameRegex string
outputFile string
resourceGroupId string
securityPolicyIds string[]
securityPolicyName string
status string
tags {[key: string]: any}
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_ids Sequence[str]
security_policy_name str
status str
tags Mapping[str, Any]
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
securityPolicyIds List<String>
securityPolicyName String
status String
tags Map<Any>

Supporting Types

GetSecurityPoliciesPolicy

Ciphers List<string>

The supported cipher suites, which are determined by the TLS protocol version.

Id string

The ID of the Security Policy.

ResourceGroupId string

The ID of the resource group.

SecurityPolicyId string

The first ID of the resource.

SecurityPolicyName string

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

Status string

The status of the resource.

TlsVersions List<string>

The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.

Ciphers []string

The supported cipher suites, which are determined by the TLS protocol version.

Id string

The ID of the Security Policy.

ResourceGroupId string

The ID of the resource group.

SecurityPolicyId string

The first ID of the resource.

SecurityPolicyName string

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

Status string

The status of the resource.

TlsVersions []string

The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.

ciphers List<String>

The supported cipher suites, which are determined by the TLS protocol version.

id String

The ID of the Security Policy.

resourceGroupId String

The ID of the resource group.

securityPolicyId String

The first ID of the resource.

securityPolicyName String

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status String

The status of the resource.

tlsVersions List<String>

The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.

ciphers string[]

The supported cipher suites, which are determined by the TLS protocol version.

id string

The ID of the Security Policy.

resourceGroupId string

The ID of the resource group.

securityPolicyId string

The first ID of the resource.

securityPolicyName string

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status string

The status of the resource.

tlsVersions string[]

The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.

ciphers Sequence[str]

The supported cipher suites, which are determined by the TLS protocol version.

id str

The ID of the Security Policy.

resource_group_id str

The ID of the resource group.

security_policy_id str

The first ID of the resource.

security_policy_name str

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status str

The status of the resource.

tls_versions Sequence[str]

The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.

ciphers List<String>

The supported cipher suites, which are determined by the TLS protocol version.

id String

The ID of the Security Policy.

resourceGroupId String

The ID of the resource group.

securityPolicyId String

The first ID of the resource.

securityPolicyName String

The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).

status String

The status of the resource.

tlsVersions List<String>

The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.