All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.googlenative.compute.v1.kotlin.NetworkFirewallPolicy.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.compute.v1.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.compute.v1.kotlin.outputs.FirewallPolicyAssociationResponse
import com.pulumi.googlenative.compute.v1.kotlin.outputs.FirewallPolicyRuleResponse
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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.googlenative.compute.v1.kotlin.outputs.FirewallPolicyAssociationResponse.Companion.toKotlin as firewallPolicyAssociationResponseToKotlin
import com.pulumi.googlenative.compute.v1.kotlin.outputs.FirewallPolicyRuleResponse.Companion.toKotlin as firewallPolicyRuleResponseToKotlin

/**
 * Builder for [NetworkFirewallPolicy].
 */
@PulumiTagMarker
public class NetworkFirewallPolicyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NetworkFirewallPolicyArgs = NetworkFirewallPolicyArgs()

    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 NetworkFirewallPolicyArgsBuilder.() -> Unit) {
        val builder = NetworkFirewallPolicyArgsBuilder()
        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(): NetworkFirewallPolicy {
        val builtJavaResource =
            com.pulumi.googlenative.compute.v1.NetworkFirewallPolicy(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return NetworkFirewallPolicy(builtJavaResource)
    }
}

/**
 * Creates a new policy in the specified project using the data included in the request.
 */
public class NetworkFirewallPolicy internal constructor(
    override val javaResource: com.pulumi.googlenative.compute.v1.NetworkFirewallPolicy,
) : KotlinCustomResource(javaResource, NetworkFirewallPolicyMapper) {
    /**
     * A list of associations that belong to this firewall policy.
     */
    public val associations: Output>
        get() = javaResource.associations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    firewallPolicyAssociationResponseToKotlin(args0)
                })
            })
        })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * An optional description of this resource. Provide this property when you create the resource.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * Deprecated, please use short name instead. User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. This field is not applicable to network firewall policies. This name must be set on creation and cannot be changed. 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]([-a-z0-9]*[a-z0-9])?` 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.
     */
    @Deprecated(
        message = """
  Deprecated, please use short name instead. User-provided name of the Organization firewall policy.
      The name should be unique in the organization in which the firewall policy is created. This
      field is not applicable to network firewall policies. This name must be set on creation and
      cannot be changed. 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]([-a-z0-9]*[a-z0-9])?` 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 displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the firewall policy.
     */
    public val fingerprint: Output
        get() = javaResource.fingerprint().applyValue({ args0 -> args0 })

    /**
     * [Output only] Type of the resource. Always compute#firewallPolicyfor firewall policies
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * Name of the resource. For Organization Firewall Policies it's a [Output Only] numeric ID allocated by Google Cloud which uniquely identifies the Organization Firewall Policy.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The parent of the firewall policy. This field is not applicable to network firewall policies.
     */
    public val parent: Output
        get() = javaResource.parent().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * URL of the region where the regional firewall policy resides. This field is not applicable to global firewall policies. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

    /**
     * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
     */
    public val requestId: Output?
        get() = javaResource.requestId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
     */
    public val ruleTupleCount: Output
        get() = javaResource.ruleTupleCount().applyValue({ args0 -> args0 })

    /**
     * A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a firewall policy, a default rule with action "allow" will be added.
     */
    public val rules: Output>
        get() = javaResource.rules().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    firewallPolicyRuleResponseToKotlin(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 selfLinkWithId: Output
        get() = javaResource.selfLinkWithId().applyValue({ args0 -> args0 })

    /**
     * User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. This field is not applicable to network firewall policies. This name must be set on creation and cannot be changed. 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]([-a-z0-9]*[a-z0-9])?` 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 shortName: Output
        get() = javaResource.shortName().applyValue({ args0 -> args0 })
}

public object NetworkFirewallPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.compute.v1.NetworkFirewallPolicy::class == javaResource::class

    override fun map(javaResource: Resource): NetworkFirewallPolicy =
        NetworkFirewallPolicy(
            javaResource as
                com.pulumi.googlenative.compute.v1.NetworkFirewallPolicy,
        )
}

/**
 * @see [NetworkFirewallPolicy].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [NetworkFirewallPolicy].
 */
public suspend fun networkFirewallPolicy(
    name: String,
    block: suspend NetworkFirewallPolicyResourceBuilder.() -> Unit,
): NetworkFirewallPolicy {
    val builder = NetworkFirewallPolicyResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [NetworkFirewallPolicy].
 * @param name The _unique_ name of the resulting resource.
 */
public fun networkFirewallPolicy(name: String): NetworkFirewallPolicy {
    val builder = NetworkFirewallPolicyResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy