com.pulumi.gcp.compute.kotlin.RegionSecurityPolicy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-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.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.RegionSecurityPolicyDdosProtectionConfig
import com.pulumi.gcp.compute.kotlin.outputs.RegionSecurityPolicyUserDefinedField
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.compute.kotlin.outputs.RegionSecurityPolicyDdosProtectionConfig.Companion.toKotlin as regionSecurityPolicyDdosProtectionConfigToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionSecurityPolicyUserDefinedField.Companion.toKotlin as regionSecurityPolicyUserDefinedFieldToKotlin
/**
* Builder for [RegionSecurityPolicy].
*/
@PulumiTagMarker
public class RegionSecurityPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: RegionSecurityPolicyArgs = RegionSecurityPolicyArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend RegionSecurityPolicyArgsBuilder.() -> Unit) {
val builder = RegionSecurityPolicyArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): RegionSecurityPolicy {
val builtJavaResource = com.pulumi.gcp.compute.RegionSecurityPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RegionSecurityPolicy(builtJavaResource)
}
}
/**
* ## Example Usage
* ### Region Security Policy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const region_sec_policy_basic = new gcp.compute.RegionSecurityPolicy("region-sec-policy-basic", {
* name: "my-sec-policy-basic",
* description: "basic region security policy",
* type: "CLOUD_ARMOR",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* region_sec_policy_basic = gcp.compute.RegionSecurityPolicy("region-sec-policy-basic",
* name="my-sec-policy-basic",
* description="basic region security policy",
* type="CLOUD_ARMOR")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var region_sec_policy_basic = new Gcp.Compute.RegionSecurityPolicy("region-sec-policy-basic", new()
* {
* Name = "my-sec-policy-basic",
* Description = "basic region security policy",
* Type = "CLOUD_ARMOR",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewRegionSecurityPolicy(ctx, "region-sec-policy-basic", &compute.RegionSecurityPolicyArgs{
* Name: pulumi.String("my-sec-policy-basic"),
* Description: pulumi.String("basic region security policy"),
* Type: pulumi.String("CLOUD_ARMOR"),
* })
* 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.gcp.compute.RegionSecurityPolicy;
* import com.pulumi.gcp.compute.RegionSecurityPolicyArgs;
* 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) {
* var region_sec_policy_basic = new RegionSecurityPolicy("region-sec-policy-basic", RegionSecurityPolicyArgs.builder()
* .name("my-sec-policy-basic")
* .description("basic region security policy")
* .type("CLOUD_ARMOR")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* region-sec-policy-basic:
* type: gcp:compute:RegionSecurityPolicy
* properties:
* name: my-sec-policy-basic
* description: basic region security policy
* type: CLOUD_ARMOR
* ```
*
* ### Region Security Policy With Ddos Protection Config
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const region_sec_policy_ddos_protection = new gcp.compute.RegionSecurityPolicy("region-sec-policy-ddos-protection", {
* name: "my-sec-policy-ddos-protection",
* description: "with ddos protection config",
* type: "CLOUD_ARMOR_NETWORK",
* ddosProtectionConfig: {
* ddosProtection: "ADVANCED_PREVIEW",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* region_sec_policy_ddos_protection = gcp.compute.RegionSecurityPolicy("region-sec-policy-ddos-protection",
* name="my-sec-policy-ddos-protection",
* description="with ddos protection config",
* type="CLOUD_ARMOR_NETWORK",
* ddos_protection_config=gcp.compute.RegionSecurityPolicyDdosProtectionConfigArgs(
* ddos_protection="ADVANCED_PREVIEW",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var region_sec_policy_ddos_protection = new Gcp.Compute.RegionSecurityPolicy("region-sec-policy-ddos-protection", new()
* {
* Name = "my-sec-policy-ddos-protection",
* Description = "with ddos protection config",
* Type = "CLOUD_ARMOR_NETWORK",
* DdosProtectionConfig = new Gcp.Compute.Inputs.RegionSecurityPolicyDdosProtectionConfigArgs
* {
* DdosProtection = "ADVANCED_PREVIEW",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewRegionSecurityPolicy(ctx, "region-sec-policy-ddos-protection", &compute.RegionSecurityPolicyArgs{
* Name: pulumi.String("my-sec-policy-ddos-protection"),
* Description: pulumi.String("with ddos protection config"),
* Type: pulumi.String("CLOUD_ARMOR_NETWORK"),
* DdosProtectionConfig: &compute.RegionSecurityPolicyDdosProtectionConfigArgs{
* DdosProtection: pulumi.String("ADVANCED_PREVIEW"),
* },
* })
* 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.gcp.compute.RegionSecurityPolicy;
* import com.pulumi.gcp.compute.RegionSecurityPolicyArgs;
* import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyDdosProtectionConfigArgs;
* 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) {
* var region_sec_policy_ddos_protection = new RegionSecurityPolicy("region-sec-policy-ddos-protection", RegionSecurityPolicyArgs.builder()
* .name("my-sec-policy-ddos-protection")
* .description("with ddos protection config")
* .type("CLOUD_ARMOR_NETWORK")
* .ddosProtectionConfig(RegionSecurityPolicyDdosProtectionConfigArgs.builder()
* .ddosProtection("ADVANCED_PREVIEW")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* region-sec-policy-ddos-protection:
* type: gcp:compute:RegionSecurityPolicy
* properties:
* name: my-sec-policy-ddos-protection
* description: with ddos protection config
* type: CLOUD_ARMOR_NETWORK
* ddosProtectionConfig:
* ddosProtection: ADVANCED_PREVIEW
* ```
*
* ### Region Security Policy With User Defined Fields
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const region_sec_policy_user_defined_fields = new gcp.compute.RegionSecurityPolicy("region-sec-policy-user-defined-fields", {
* name: "my-sec-policy-user-defined-fields",
* description: "with user defined fields",
* type: "CLOUD_ARMOR_NETWORK",
* userDefinedFields: [
* {
* name: "SIG1_AT_0",
* base: "UDP",
* offset: 8,
* size: 2,
* mask: "0x8F00",
* },
* {
* name: "SIG2_AT_8",
* base: "UDP",
* offset: 16,
* size: 4,
* mask: "0xFFFFFFFF",
* },
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* region_sec_policy_user_defined_fields = gcp.compute.RegionSecurityPolicy("region-sec-policy-user-defined-fields",
* name="my-sec-policy-user-defined-fields",
* description="with user defined fields",
* type="CLOUD_ARMOR_NETWORK",
* user_defined_fields=[
* gcp.compute.RegionSecurityPolicyUserDefinedFieldArgs(
* name="SIG1_AT_0",
* base="UDP",
* offset=8,
* size=2,
* mask="0x8F00",
* ),
* gcp.compute.RegionSecurityPolicyUserDefinedFieldArgs(
* name="SIG2_AT_8",
* base="UDP",
* offset=16,
* size=4,
* mask="0xFFFFFFFF",
* ),
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var region_sec_policy_user_defined_fields = new Gcp.Compute.RegionSecurityPolicy("region-sec-policy-user-defined-fields", new()
* {
* Name = "my-sec-policy-user-defined-fields",
* Description = "with user defined fields",
* Type = "CLOUD_ARMOR_NETWORK",
* UserDefinedFields = new[]
* {
* new Gcp.Compute.Inputs.RegionSecurityPolicyUserDefinedFieldArgs
* {
* Name = "SIG1_AT_0",
* Base = "UDP",
* Offset = 8,
* Size = 2,
* Mask = "0x8F00",
* },
* new Gcp.Compute.Inputs.RegionSecurityPolicyUserDefinedFieldArgs
* {
* Name = "SIG2_AT_8",
* Base = "UDP",
* Offset = 16,
* Size = 4,
* Mask = "0xFFFFFFFF",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewRegionSecurityPolicy(ctx, "region-sec-policy-user-defined-fields", &compute.RegionSecurityPolicyArgs{
* Name: pulumi.String("my-sec-policy-user-defined-fields"),
* Description: pulumi.String("with user defined fields"),
* Type: pulumi.String("CLOUD_ARMOR_NETWORK"),
* UserDefinedFields: compute.RegionSecurityPolicyUserDefinedFieldArray{
* &compute.RegionSecurityPolicyUserDefinedFieldArgs{
* Name: pulumi.String("SIG1_AT_0"),
* Base: pulumi.String("UDP"),
* Offset: pulumi.Int(8),
* Size: pulumi.Int(2),
* Mask: pulumi.String("0x8F00"),
* },
* &compute.RegionSecurityPolicyUserDefinedFieldArgs{
* Name: pulumi.String("SIG2_AT_8"),
* Base: pulumi.String("UDP"),
* Offset: pulumi.Int(16),
* Size: pulumi.Int(4),
* Mask: pulumi.String("0xFFFFFFFF"),
* },
* },
* })
* 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.gcp.compute.RegionSecurityPolicy;
* import com.pulumi.gcp.compute.RegionSecurityPolicyArgs;
* import com.pulumi.gcp.compute.inputs.RegionSecurityPolicyUserDefinedFieldArgs;
* 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) {
* var region_sec_policy_user_defined_fields = new RegionSecurityPolicy("region-sec-policy-user-defined-fields", RegionSecurityPolicyArgs.builder()
* .name("my-sec-policy-user-defined-fields")
* .description("with user defined fields")
* .type("CLOUD_ARMOR_NETWORK")
* .userDefinedFields(
* RegionSecurityPolicyUserDefinedFieldArgs.builder()
* .name("SIG1_AT_0")
* .base("UDP")
* .offset(8)
* .size(2)
* .mask("0x8F00")
* .build(),
* RegionSecurityPolicyUserDefinedFieldArgs.builder()
* .name("SIG2_AT_8")
* .base("UDP")
* .offset(16)
* .size(4)
* .mask("0xFFFFFFFF")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* region-sec-policy-user-defined-fields:
* type: gcp:compute:RegionSecurityPolicy
* properties:
* name: my-sec-policy-user-defined-fields
* description: with user defined fields
* type: CLOUD_ARMOR_NETWORK
* userDefinedFields:
* - name: SIG1_AT_0
* base: UDP
* offset: 8
* size: 2
* mask: 0x8F00
* - name: SIG2_AT_8
* base: UDP
* offset: 16
* size: 4
* mask: 0xFFFFFFFF
* ```
*
* ## Import
* RegionSecurityPolicy can be imported using any of these accepted formats:
* * `projects/{{project}}/regions/{{region}}/securityPolicies/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, RegionSecurityPolicy can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default projects/{{project}}/regions/{{region}}/securityPolicies/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default {{project}}/{{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default {{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default {{name}}
* ```
*/
public class RegionSecurityPolicy internal constructor(
override val javaResource: com.pulumi.gcp.compute.RegionSecurityPolicy,
) : KotlinCustomResource(javaResource, RegionSecurityPolicyMapper) {
/**
* Configuration for Google Cloud Armor DDOS Proctection Config.
* Structure is documented below.
*/
public val ddosProtectionConfig: Output?
get() = javaResource.ddosProtectionConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
regionSecurityPolicyDdosProtectionConfigToKotlin(args0)
})
}).orElse(null)
})
/**
* An optional description of this resource. Provide this property when you create the resource.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Fingerprint of this resource. This field is used internally during
* updates of this resource.
*/
public val fingerprint: Output
get() = javaResource.fingerprint().applyValue({ args0 -> args0 })
/**
* Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035.
* Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
* - - -
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The unique identifier for the resource. This identifier is defined by the server.
*/
public val policyId: Output
get() = javaResource.policyId().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* The Region in which the created Region Security Policy should reside.
* If it is not provided, the provider region is used.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
/**
* Server-defined URL for the resource.
*/
public val selfLink: Output
get() = javaResource.selfLink().applyValue({ args0 -> args0 })
/**
* Server-defined URL for this resource with the resource id.
*/
public val selfLinkWithPolicyId: Output
get() = javaResource.selfLinkWithPolicyId().applyValue({ args0 -> args0 })
/**
* The type indicates the intended use of the security policy.
* - CLOUD_ARMOR: Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers.
* - CLOUD_ARMOR_EDGE: Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache.
* - CLOUD_ARMOR_NETWORK: Cloud Armor network policies can be configured to filter packets targeting network load balancing resources such as backend services, target pools, target instances, and instances with external IPs. They filter requests before the request is served from the application.
* This field can be set only at resource creation time.
* Possible values are: `CLOUD_ARMOR`, `CLOUD_ARMOR_EDGE`, `CLOUD_ARMOR_NETWORK`.
*/
public val type: Output?
get() = javaResource.type().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Definitions of user-defined fields for CLOUD_ARMOR_NETWORK policies.
* A user-defined field consists of up to 4 bytes extracted from a fixed offset in the packet, relative to the IPv4, IPv6, TCP, or UDP header, with an optional mask to select certain bits.
* Rules may then specify matching values for these fields.
* Structure is documented below.
*/
public val userDefinedFields: Output>?
get() = javaResource.userDefinedFields().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
regionSecurityPolicyUserDefinedFieldToKotlin(args0)
})
})
}).orElse(null)
})
}
public object RegionSecurityPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.RegionSecurityPolicy::class == javaResource::class
override fun map(javaResource: Resource): RegionSecurityPolicy = RegionSecurityPolicy(
javaResource
as com.pulumi.gcp.compute.RegionSecurityPolicy,
)
}
/**
* @see [RegionSecurityPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RegionSecurityPolicy].
*/
public suspend fun regionSecurityPolicy(
name: String,
block: suspend RegionSecurityPolicyResourceBuilder.() -> Unit,
): RegionSecurityPolicy {
val builder = RegionSecurityPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RegionSecurityPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun regionSecurityPolicy(name: String): RegionSecurityPolicy {
val builder = RegionSecurityPolicyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy