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

alicloud.cloudfirewall.getAddressBooks

Explore with Pulumi AI

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

    This data source provides the Cloud Firewall Address Books of the current Alibaba Cloud user.

    NOTE: Available since v1.178.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const _default = new alicloud.cloudfirewall.AddressBook("default", {
        groupName: name,
        groupType: "ip",
        description: "tf-description",
        autoAddTagEcs: 0,
        addressLists: [
            "10.21.0.0/16",
            "10.168.0.0/16",
        ],
    });
    const ids = alicloud.cloudfirewall.getAddressBooksOutput({
        ids: [_default.id],
    });
    export const cloudFirewallAddressBookId1 = ids.apply(ids => ids.books?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.cloudfirewall.AddressBook("default",
        group_name=name,
        group_type="ip",
        description="tf-description",
        auto_add_tag_ecs=0,
        address_lists=[
            "10.21.0.0/16",
            "10.168.0.0/16",
        ])
    ids = alicloud.cloudfirewall.get_address_books_output(ids=[default.id])
    pulumi.export("cloudFirewallAddressBookId1", ids.books[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudfirewall"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := cloudfirewall.NewAddressBook(ctx, "default", &cloudfirewall.AddressBookArgs{
    			GroupName:     pulumi.String(name),
    			GroupType:     pulumi.String("ip"),
    			Description:   pulumi.String("tf-description"),
    			AutoAddTagEcs: pulumi.Int(0),
    			AddressLists: pulumi.StringArray{
    				pulumi.String("10.21.0.0/16"),
    				pulumi.String("10.168.0.0/16"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		ids := cloudfirewall.GetAddressBooksOutput(ctx, cloudfirewall.GetAddressBooksOutputArgs{
    			Ids: pulumi.StringArray{
    				_default.ID(),
    			},
    		}, nil)
    		ctx.Export("cloudFirewallAddressBookId1", ids.ApplyT(func(ids cloudfirewall.GetAddressBooksResult) (*string, error) {
    			return &ids.Books[0].Id, nil
    		}).(pulumi.StringPtrOutput))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = new AliCloud.CloudFirewall.AddressBook("default", new()
        {
            GroupName = name,
            GroupType = "ip",
            Description = "tf-description",
            AutoAddTagEcs = 0,
            AddressLists = new[]
            {
                "10.21.0.0/16",
                "10.168.0.0/16",
            },
        });
    
        var ids = AliCloud.CloudFirewall.GetAddressBooks.Invoke(new()
        {
            Ids = new[]
            {
                @default.Id,
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["cloudFirewallAddressBookId1"] = ids.Apply(getAddressBooksResult => getAddressBooksResult.Books[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.cloudfirewall.AddressBook;
    import com.pulumi.alicloud.cloudfirewall.AddressBookArgs;
    import com.pulumi.alicloud.cloudfirewall.CloudfirewallFunctions;
    import com.pulumi.alicloud.cloudfirewall.inputs.GetAddressBooksArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            var default_ = new AddressBook("default", AddressBookArgs.builder()
                .groupName(name)
                .groupType("ip")
                .description("tf-description")
                .autoAddTagEcs(0)
                .addressLists(            
                    "10.21.0.0/16",
                    "10.168.0.0/16")
                .build());
    
            final var ids = CloudfirewallFunctions.getAddressBooks(GetAddressBooksArgs.builder()
                .ids(default_.id())
                .build());
    
            ctx.export("cloudFirewallAddressBookId1", ids.applyValue(getAddressBooksResult -> getAddressBooksResult).applyValue(ids -> ids.applyValue(getAddressBooksResult -> getAddressBooksResult.books()[0].id())));
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      default:
        type: alicloud:cloudfirewall:AddressBook
        properties:
          groupName: ${name}
          groupType: ip
          description: tf-description
          autoAddTagEcs: 0
          addressLists:
            - 10.21.0.0/16
            - 10.168.0.0/16
    variables:
      ids:
        fn::invoke:
          Function: alicloud:cloudfirewall:getAddressBooks
          Arguments:
            ids:
              - ${default.id}
    outputs:
      cloudFirewallAddressBookId1: ${ids.books[0].id}
    

    Using getAddressBooks

    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 getAddressBooks(args: GetAddressBooksArgs, opts?: InvokeOptions): Promise<GetAddressBooksResult>
    function getAddressBooksOutput(args: GetAddressBooksOutputArgs, opts?: InvokeOptions): Output<GetAddressBooksResult>
    def get_address_books(group_type: Optional[str] = None,
                          ids: Optional[Sequence[str]] = None,
                          name_regex: Optional[str] = None,
                          output_file: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetAddressBooksResult
    def get_address_books_output(group_type: 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,
                          opts: Optional[InvokeOptions] = None) -> Output[GetAddressBooksResult]
    func GetAddressBooks(ctx *Context, args *GetAddressBooksArgs, opts ...InvokeOption) (*GetAddressBooksResult, error)
    func GetAddressBooksOutput(ctx *Context, args *GetAddressBooksOutputArgs, opts ...InvokeOption) GetAddressBooksResultOutput

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

    public static class GetAddressBooks 
    {
        public static Task<GetAddressBooksResult> InvokeAsync(GetAddressBooksArgs args, InvokeOptions? opts = null)
        public static Output<GetAddressBooksResult> Invoke(GetAddressBooksInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAddressBooksResult> getAddressBooks(GetAddressBooksArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:cloudfirewall/getAddressBooks:getAddressBooks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    GroupType string
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    Ids List<string>
    A list of Address Book IDs.
    NameRegex string
    A regex string to filter results Address Book name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    GroupType string
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    Ids []string
    A list of Address Book IDs.
    NameRegex string
    A regex string to filter results Address Book name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    groupType String
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    ids List<String>
    A list of Address Book IDs.
    nameRegex String
    A regex string to filter results Address Book name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    groupType string
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    ids string[]
    A list of Address Book IDs.
    nameRegex string
    A regex string to filter results Address Book name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    group_type str
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    ids Sequence[str]
    A list of Address Book IDs.
    name_regex str
    A regex string to filter results Address Book name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    groupType String
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    ids List<String>
    A list of Address Book IDs.
    nameRegex String
    A regex string to filter results Address Book name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getAddressBooks Result

    The following output properties are available:

    Books List<Pulumi.AliCloud.CloudFirewall.Outputs.GetAddressBooksBook>
    A list of Cloud Firewall Address Books. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    A list of Address Book names.
    GroupType string
    The type of the Address Book.
    NameRegex string
    OutputFile string
    Books []GetAddressBooksBook
    A list of Cloud Firewall Address Books. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    A list of Address Book names.
    GroupType string
    The type of the Address Book.
    NameRegex string
    OutputFile string
    books List<GetAddressBooksBook>
    A list of Cloud Firewall Address Books. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Address Book names.
    groupType String
    The type of the Address Book.
    nameRegex String
    outputFile String
    books GetAddressBooksBook[]
    A list of Cloud Firewall Address Books. Each element contains the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    A list of Address Book names.
    groupType string
    The type of the Address Book.
    nameRegex string
    outputFile string
    books Sequence[GetAddressBooksBook]
    A list of Cloud Firewall Address Books. Each element contains the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    A list of Address Book names.
    group_type str
    The type of the Address Book.
    name_regex str
    output_file str
    books List<Property Map>
    A list of Cloud Firewall Address Books. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Address Book names.
    groupType String
    The type of the Address Book.
    nameRegex String
    outputFile String

    Supporting Types

    GetAddressBooksBook

    AddressLists List<string>
    The addresses in the Address Book.
    AutoAddTagEcs int
    Whether you want to automatically add new matching tags of the ECS IP address to the Address Book.
    Description string
    The description of the Address Book.
    EcsTags List<Pulumi.AliCloud.CloudFirewall.Inputs.GetAddressBooksBookEcsTag>
    The logical relation among the ECS tags that to be matchedh.
    GroupName string
    The name of the Address Book.
    GroupType string
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    GroupUuid string
    The ID of the Address Book.
    Id string
    The ID of the Address Book.
    TagRelation string
    One or more tags for the relationship between.
    AddressLists []string
    The addresses in the Address Book.
    AutoAddTagEcs int
    Whether you want to automatically add new matching tags of the ECS IP address to the Address Book.
    Description string
    The description of the Address Book.
    EcsTags []GetAddressBooksBookEcsTag
    The logical relation among the ECS tags that to be matchedh.
    GroupName string
    The name of the Address Book.
    GroupType string
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    GroupUuid string
    The ID of the Address Book.
    Id string
    The ID of the Address Book.
    TagRelation string
    One or more tags for the relationship between.
    addressLists List<String>
    The addresses in the Address Book.
    autoAddTagEcs Integer
    Whether you want to automatically add new matching tags of the ECS IP address to the Address Book.
    description String
    The description of the Address Book.
    ecsTags List<GetAddressBooksBookEcsTag>
    The logical relation among the ECS tags that to be matchedh.
    groupName String
    The name of the Address Book.
    groupType String
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    groupUuid String
    The ID of the Address Book.
    id String
    The ID of the Address Book.
    tagRelation String
    One or more tags for the relationship between.
    addressLists string[]
    The addresses in the Address Book.
    autoAddTagEcs number
    Whether you want to automatically add new matching tags of the ECS IP address to the Address Book.
    description string
    The description of the Address Book.
    ecsTags GetAddressBooksBookEcsTag[]
    The logical relation among the ECS tags that to be matchedh.
    groupName string
    The name of the Address Book.
    groupType string
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    groupUuid string
    The ID of the Address Book.
    id string
    The ID of the Address Book.
    tagRelation string
    One or more tags for the relationship between.
    address_lists Sequence[str]
    The addresses in the Address Book.
    auto_add_tag_ecs int
    Whether you want to automatically add new matching tags of the ECS IP address to the Address Book.
    description str
    The description of the Address Book.
    ecs_tags Sequence[GetAddressBooksBookEcsTag]
    The logical relation among the ECS tags that to be matchedh.
    group_name str
    The name of the Address Book.
    group_type str
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    group_uuid str
    The ID of the Address Book.
    id str
    The ID of the Address Book.
    tag_relation str
    One or more tags for the relationship between.
    addressLists List<String>
    The addresses in the Address Book.
    autoAddTagEcs Number
    Whether you want to automatically add new matching tags of the ECS IP address to the Address Book.
    description String
    The description of the Address Book.
    ecsTags List<Property Map>
    The logical relation among the ECS tags that to be matchedh.
    groupName String
    The name of the Address Book.
    groupType String
    The type of the Address Book. Valid values: ip, ipv6, domain, port, tag. NOTE: From version 1.213.1, group_type can be set to ipv6, domain, port.
    groupUuid String
    The ID of the Address Book.
    id String
    The ID of the Address Book.
    tagRelation String
    One or more tags for the relationship between.

    GetAddressBooksBookEcsTag

    TagKey string
    The key of ECS tag that to be matched.
    TagValue string
    The value of ECS tag that to be matched.
    TagKey string
    The key of ECS tag that to be matched.
    TagValue string
    The value of ECS tag that to be matched.
    tagKey String
    The key of ECS tag that to be matched.
    tagValue String
    The value of ECS tag that to be matched.
    tagKey string
    The key of ECS tag that to be matched.
    tagValue string
    The value of ECS tag that to be matched.
    tag_key str
    The key of ECS tag that to be matched.
    tag_value str
    The value of ECS tag that to be matched.
    tagKey String
    The key of ECS tag that to be matched.
    tagValue String
    The value of ECS tag that to be matched.

    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