com.pulumi.cloudflare.kotlin.ListItemArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-cloudflare-kotlin Show documentation
Show all versions of pulumi-cloudflare-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.cloudflare.kotlin
import com.pulumi.cloudflare.ListItemArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.ListItemHostnameArgs
import com.pulumi.cloudflare.kotlin.inputs.ListItemHostnameArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.ListItemRedirectArgs
import com.pulumi.cloudflare.kotlin.inputs.ListItemRedirectArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* Provides individual list items (IPs, Redirects, ASNs, Hostnames) to be used in Edge Rules Engine
* across all zones within the same account.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as cloudflare from "@pulumi/cloudflare";
* // IP List
* const exampleIpList = new cloudflare.List("example_ip_list", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* name: "example_list",
* description: "example IPs for a list",
* kind: "ip",
* });
* // IP List Item
* const exampleIpItem = new cloudflare.ListItem("example_ip_item", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* listId: exampleIpList.id,
* comment: "List Item Comment",
* ip: "192.0.2.0",
* });
* // Redirect List
* const exampleRedirectList = new cloudflare.List("example_redirect_list", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* name: "example_list",
* description: "example Redirects for a list",
* kind: "redirect",
* });
* // Redirect List Item
* const exampleRedirectItem = new cloudflare.ListItem("example_redirect_item", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* listId: exampleIpList.id,
* redirect: {
* sourceUrl: "https://source.tld/",
* targetUrl: "https://target.tld",
* statusCode: 302,
* subpathMatching: true,
* },
* });
* // ASN List
* const exampleAsnList = new cloudflare.List("example_asn_list", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* name: "example_asn_list",
* description: "example ASNs for a list",
* kind: "asn",
* });
* // ASN List Item
* const exampleAsnItem = new cloudflare.ListItem("example_asn_item", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* listId: exampleAsnList.id,
* comment: "List Item Comment",
* asn: 6789,
* });
* // Hostname List
* const exampleHostnameList = new cloudflare.List("example_hostname_list", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* name: "example_hostname_list",
* description: "example Hostnames for a list",
* kind: "hostname",
* });
* // Hostname List Item
* const exampleHostnameItem = new cloudflare.ListItem("example_hostname_item", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* listId: exampleHostnameList.id,
* comment: "List Item Comment",
* hostname: {
* urlHostname: "example.com",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_cloudflare as cloudflare
* # IP List
* example_ip_list = cloudflare.List("example_ip_list",
* account_id="f037e56e89293a057740de681ac9abbe",
* name="example_list",
* description="example IPs for a list",
* kind="ip")
* # IP List Item
* example_ip_item = cloudflare.ListItem("example_ip_item",
* account_id="f037e56e89293a057740de681ac9abbe",
* list_id=example_ip_list.id,
* comment="List Item Comment",
* ip="192.0.2.0")
* # Redirect List
* example_redirect_list = cloudflare.List("example_redirect_list",
* account_id="f037e56e89293a057740de681ac9abbe",
* name="example_list",
* description="example Redirects for a list",
* kind="redirect")
* # Redirect List Item
* example_redirect_item = cloudflare.ListItem("example_redirect_item",
* account_id="f037e56e89293a057740de681ac9abbe",
* list_id=example_ip_list.id,
* redirect={
* "source_url": "https://source.tld/",
* "target_url": "https://target.tld",
* "status_code": 302,
* "subpath_matching": True,
* })
* # ASN List
* example_asn_list = cloudflare.List("example_asn_list",
* account_id="f037e56e89293a057740de681ac9abbe",
* name="example_asn_list",
* description="example ASNs for a list",
* kind="asn")
* # ASN List Item
* example_asn_item = cloudflare.ListItem("example_asn_item",
* account_id="f037e56e89293a057740de681ac9abbe",
* list_id=example_asn_list.id,
* comment="List Item Comment",
* asn=6789)
* # Hostname List
* example_hostname_list = cloudflare.List("example_hostname_list",
* account_id="f037e56e89293a057740de681ac9abbe",
* name="example_hostname_list",
* description="example Hostnames for a list",
* kind="hostname")
* # Hostname List Item
* example_hostname_item = cloudflare.ListItem("example_hostname_item",
* account_id="f037e56e89293a057740de681ac9abbe",
* list_id=example_hostname_list.id,
* comment="List Item Comment",
* hostname={
* "url_hostname": "example.com",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Cloudflare = Pulumi.Cloudflare;
* return await Deployment.RunAsync(() =>
* {
* // IP List
* var exampleIpList = new Cloudflare.List("example_ip_list", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* Name = "example_list",
* Description = "example IPs for a list",
* Kind = "ip",
* });
* // IP List Item
* var exampleIpItem = new Cloudflare.ListItem("example_ip_item", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* ListId = exampleIpList.Id,
* Comment = "List Item Comment",
* Ip = "192.0.2.0",
* });
* // Redirect List
* var exampleRedirectList = new Cloudflare.List("example_redirect_list", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* Name = "example_list",
* Description = "example Redirects for a list",
* Kind = "redirect",
* });
* // Redirect List Item
* var exampleRedirectItem = new Cloudflare.ListItem("example_redirect_item", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* ListId = exampleIpList.Id,
* Redirect = new Cloudflare.Inputs.ListItemRedirectArgs
* {
* SourceUrl = "https://source.tld/",
* TargetUrl = "https://target.tld",
* StatusCode = 302,
* SubpathMatching = true,
* },
* });
* // ASN List
* var exampleAsnList = new Cloudflare.List("example_asn_list", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* Name = "example_asn_list",
* Description = "example ASNs for a list",
* Kind = "asn",
* });
* // ASN List Item
* var exampleAsnItem = new Cloudflare.ListItem("example_asn_item", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* ListId = exampleAsnList.Id,
* Comment = "List Item Comment",
* Asn = 6789,
* });
* // Hostname List
* var exampleHostnameList = new Cloudflare.List("example_hostname_list", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* Name = "example_hostname_list",
* Description = "example Hostnames for a list",
* Kind = "hostname",
* });
* // Hostname List Item
* var exampleHostnameItem = new Cloudflare.ListItem("example_hostname_item", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* ListId = exampleHostnameList.Id,
* Comment = "List Item Comment",
* Hostname = new Cloudflare.Inputs.ListItemHostnameArgs
* {
* UrlHostname = "example.com",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* // IP List
* exampleIpList, err := cloudflare.NewList(ctx, "example_ip_list", &cloudflare.ListArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* Name: pulumi.String("example_list"),
* Description: pulumi.String("example IPs for a list"),
* Kind: pulumi.String("ip"),
* })
* if err != nil {
* return err
* }
* // IP List Item
* _, err = cloudflare.NewListItem(ctx, "example_ip_item", &cloudflare.ListItemArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* ListId: exampleIpList.ID(),
* Comment: pulumi.String("List Item Comment"),
* Ip: pulumi.String("192.0.2.0"),
* })
* if err != nil {
* return err
* }
* // Redirect List
* _, err = cloudflare.NewList(ctx, "example_redirect_list", &cloudflare.ListArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* Name: pulumi.String("example_list"),
* Description: pulumi.String("example Redirects for a list"),
* Kind: pulumi.String("redirect"),
* })
* if err != nil {
* return err
* }
* // Redirect List Item
* _, err = cloudflare.NewListItem(ctx, "example_redirect_item", &cloudflare.ListItemArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* ListId: exampleIpList.ID(),
* Redirect: &cloudflare.ListItemRedirectArgs{
* SourceUrl: pulumi.String("https://source.tld/"),
* TargetUrl: pulumi.String("https://target.tld"),
* StatusCode: pulumi.Int(302),
* SubpathMatching: pulumi.Bool(true),
* },
* })
* if err != nil {
* return err
* }
* // ASN List
* exampleAsnList, err := cloudflare.NewList(ctx, "example_asn_list", &cloudflare.ListArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* Name: pulumi.String("example_asn_list"),
* Description: pulumi.String("example ASNs for a list"),
* Kind: pulumi.String("asn"),
* })
* if err != nil {
* return err
* }
* // ASN List Item
* _, err = cloudflare.NewListItem(ctx, "example_asn_item", &cloudflare.ListItemArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* ListId: exampleAsnList.ID(),
* Comment: pulumi.String("List Item Comment"),
* Asn: pulumi.Int(6789),
* })
* if err != nil {
* return err
* }
* // Hostname List
* exampleHostnameList, err := cloudflare.NewList(ctx, "example_hostname_list", &cloudflare.ListArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* Name: pulumi.String("example_hostname_list"),
* Description: pulumi.String("example Hostnames for a list"),
* Kind: pulumi.String("hostname"),
* })
* if err != nil {
* return err
* }
* // Hostname List Item
* _, err = cloudflare.NewListItem(ctx, "example_hostname_item", &cloudflare.ListItemArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* ListId: exampleHostnameList.ID(),
* Comment: pulumi.String("List Item Comment"),
* Hostname: &cloudflare.ListItemHostnameArgs{
* UrlHostname: pulumi.String("example.com"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.cloudflare.List;
* import com.pulumi.cloudflare.ListArgs;
* import com.pulumi.cloudflare.ListItem;
* import com.pulumi.cloudflare.ListItemArgs;
* import com.pulumi.cloudflare.inputs.ListItemRedirectArgs;
* import com.pulumi.cloudflare.inputs.ListItemHostnameArgs;
* 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) {
* // IP List
* var exampleIpList = new List("exampleIpList", ListArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("example_list")
* .description("example IPs for a list")
* .kind("ip")
* .build());
* // IP List Item
* var exampleIpItem = new ListItem("exampleIpItem", ListItemArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .listId(exampleIpList.id())
* .comment("List Item Comment")
* .ip("192.0.2.0")
* .build());
* // Redirect List
* var exampleRedirectList = new List("exampleRedirectList", ListArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("example_list")
* .description("example Redirects for a list")
* .kind("redirect")
* .build());
* // Redirect List Item
* var exampleRedirectItem = new ListItem("exampleRedirectItem", ListItemArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .listId(exampleIpList.id())
* .redirect(ListItemRedirectArgs.builder()
* .sourceUrl("https://source.tld/")
* .targetUrl("https://target.tld")
* .statusCode(302)
* .subpathMatching(true)
* .build())
* .build());
* // ASN List
* var exampleAsnList = new List("exampleAsnList", ListArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("example_asn_list")
* .description("example ASNs for a list")
* .kind("asn")
* .build());
* // ASN List Item
* var exampleAsnItem = new ListItem("exampleAsnItem", ListItemArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .listId(exampleAsnList.id())
* .comment("List Item Comment")
* .asn(6789)
* .build());
* // Hostname List
* var exampleHostnameList = new List("exampleHostnameList", ListArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("example_hostname_list")
* .description("example Hostnames for a list")
* .kind("hostname")
* .build());
* // Hostname List Item
* var exampleHostnameItem = new ListItem("exampleHostnameItem", ListItemArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .listId(exampleHostnameList.id())
* .comment("List Item Comment")
* .hostname(ListItemHostnameArgs.builder()
* .urlHostname("example.com")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* # IP List
* exampleIpList:
* type: cloudflare:List
* name: example_ip_list
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* name: example_list
* description: example IPs for a list
* kind: ip
* # IP List Item
* exampleIpItem:
* type: cloudflare:ListItem
* name: example_ip_item
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* listId: ${exampleIpList.id}
* comment: List Item Comment
* ip: 192.0.2.0
* # Redirect List
* exampleRedirectList:
* type: cloudflare:List
* name: example_redirect_list
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* name: example_list
* description: example Redirects for a list
* kind: redirect
* # Redirect List Item
* exampleRedirectItem:
* type: cloudflare:ListItem
* name: example_redirect_item
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* listId: ${exampleIpList.id}
* redirect:
* sourceUrl: https://source.tld/
* targetUrl: https://target.tld
* statusCode: 302
* subpathMatching: true
* # ASN List
* exampleAsnList:
* type: cloudflare:List
* name: example_asn_list
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* name: example_asn_list
* description: example ASNs for a list
* kind: asn
* # ASN List Item
* exampleAsnItem:
* type: cloudflare:ListItem
* name: example_asn_item
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* listId: ${exampleAsnList.id}
* comment: List Item Comment
* asn: 6789
* # Hostname List
* exampleHostnameList:
* type: cloudflare:List
* name: example_hostname_list
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* name: example_hostname_list
* description: example Hostnames for a list
* kind: hostname
* # Hostname List Item
* exampleHostnameItem:
* type: cloudflare:ListItem
* name: example_hostname_item
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* listId: ${exampleHostnameList.id}
* comment: List Item Comment
* hostname:
* urlHostname: example.com
* ```
*
* ## Import
* ```sh
* $ pulumi import cloudflare:index/listItem:ListItem example //
* ```
* @property accountId The account identifier to target for the resource.
* @property asn Autonomous system number to include in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
* @property comment An optional comment for the item.
* @property hostname Hostname to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
* @property ip IP address to include in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
* @property listId The list identifier to target for the resource.
* @property redirect Redirect configuration to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
public data class ListItemArgs(
public val accountId: Output? = null,
public val asn: Output? = null,
public val comment: Output? = null,
public val hostname: Output? = null,
public val ip: Output? = null,
public val listId: Output? = null,
public val redirect: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.cloudflare.ListItemArgs =
com.pulumi.cloudflare.ListItemArgs.builder()
.accountId(accountId?.applyValue({ args0 -> args0 }))
.asn(asn?.applyValue({ args0 -> args0 }))
.comment(comment?.applyValue({ args0 -> args0 }))
.hostname(hostname?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.ip(ip?.applyValue({ args0 -> args0 }))
.listId(listId?.applyValue({ args0 -> args0 }))
.redirect(redirect?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}
/**
* Builder for [ListItemArgs].
*/
@PulumiTagMarker
public class ListItemArgsBuilder internal constructor() {
private var accountId: Output? = null
private var asn: Output? = null
private var comment: Output? = null
private var hostname: Output? = null
private var ip: Output? = null
private var listId: Output? = null
private var redirect: Output? = null
/**
* @param value The account identifier to target for the resource.
*/
@JvmName("xemhrpqwteeirukx")
public suspend fun accountId(`value`: Output) {
this.accountId = value
}
/**
* @param value Autonomous system number to include in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("ntkdqsrxqylnqner")
public suspend fun asn(`value`: Output) {
this.asn = value
}
/**
* @param value An optional comment for the item.
*/
@JvmName("ygtjkhfhsfdipiuw")
public suspend fun comment(`value`: Output) {
this.comment = value
}
/**
* @param value Hostname to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("vdabiujnnvlkqiam")
public suspend fun hostname(`value`: Output) {
this.hostname = value
}
/**
* @param value IP address to include in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("exdibbkidwuynkcf")
public suspend fun ip(`value`: Output) {
this.ip = value
}
/**
* @param value The list identifier to target for the resource.
*/
@JvmName("jticdvxmlbyjcygg")
public suspend fun listId(`value`: Output) {
this.listId = value
}
/**
* @param value Redirect configuration to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("bdwibcluhidovlet")
public suspend fun redirect(`value`: Output) {
this.redirect = value
}
/**
* @param value The account identifier to target for the resource.
*/
@JvmName("vxlcedvaiqesycmo")
public suspend fun accountId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.accountId = mapped
}
/**
* @param value Autonomous system number to include in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("jbfejdfyoumbnvyu")
public suspend fun asn(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.asn = mapped
}
/**
* @param value An optional comment for the item.
*/
@JvmName("legiojwpfyscvycx")
public suspend fun comment(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.comment = mapped
}
/**
* @param value Hostname to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("afsrpbtlujyjdhqa")
public suspend fun hostname(`value`: ListItemHostnameArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.hostname = mapped
}
/**
* @param argument Hostname to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("lnctepghlumdfrfw")
public suspend fun hostname(argument: suspend ListItemHostnameArgsBuilder.() -> Unit) {
val toBeMapped = ListItemHostnameArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.hostname = mapped
}
/**
* @param value IP address to include in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("xoikjukbxisdshsb")
public suspend fun ip(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.ip = mapped
}
/**
* @param value The list identifier to target for the resource.
*/
@JvmName("efoewhhgokrqdcmo")
public suspend fun listId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.listId = mapped
}
/**
* @param value Redirect configuration to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("hmkuikbvxxcybncw")
public suspend fun redirect(`value`: ListItemRedirectArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.redirect = mapped
}
/**
* @param argument Redirect configuration to store in the list. Must provide only one of: `ip`, `asn`, `redirect`, `hostname`.
*/
@JvmName("dahwnbauyyvvqvkr")
public suspend fun redirect(argument: suspend ListItemRedirectArgsBuilder.() -> Unit) {
val toBeMapped = ListItemRedirectArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.redirect = mapped
}
internal fun build(): ListItemArgs = ListItemArgs(
accountId = accountId,
asn = asn,
comment = comment,
hostname = hostname,
ip = ip,
listId = listId,
redirect = redirect,
)
}