
com.pulumi.gcp.accesscontextmanager.kotlin.ServicePerimeterIngressPolicy.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.accesscontextmanager.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.accesscontextmanager.kotlin.outputs.ServicePerimeterIngressPolicyIngressFrom
import com.pulumi.gcp.accesscontextmanager.kotlin.outputs.ServicePerimeterIngressPolicyIngressTo
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 com.pulumi.gcp.accesscontextmanager.kotlin.outputs.ServicePerimeterIngressPolicyIngressFrom.Companion.toKotlin as servicePerimeterIngressPolicyIngressFromToKotlin
import com.pulumi.gcp.accesscontextmanager.kotlin.outputs.ServicePerimeterIngressPolicyIngressTo.Companion.toKotlin as servicePerimeterIngressPolicyIngressToToKotlin
/**
* Builder for [ServicePerimeterIngressPolicy].
*/
@PulumiTagMarker
public class ServicePerimeterIngressPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: ServicePerimeterIngressPolicyArgs = ServicePerimeterIngressPolicyArgs()
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 ServicePerimeterIngressPolicyArgsBuilder.() -> Unit) {
val builder = ServicePerimeterIngressPolicyArgsBuilder()
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(): ServicePerimeterIngressPolicy {
val builtJavaResource =
com.pulumi.gcp.accesscontextmanager.ServicePerimeterIngressPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ServicePerimeterIngressPolicy(builtJavaResource)
}
}
/**
* Manage a single IngressPolicy in the status (enforced) configuration for a service perimeter.
* IngressPolicies match requests based on ingressFrom and ingressTo stanzas. For an ingress policy to match,
* both the ingressFrom and ingressTo stanzas must be matched. If an IngressPolicy matches a request,
* the request is allowed through the perimeter boundary from outside the perimeter.
* For example, access from the internet can be allowed either based on an AccessLevel or,
* for traffic hosted on Google Cloud, the project of the source network.
* For access from private networks, using the project of the hosting network is required.
* Individual ingress policies can be limited by restricting which services and/
* or actions they match using the ingressTo field.
* > **Note:** By default, updates to this resource will remove the IngressPolicy from the
* from the perimeter and add it back in a non-atomic manner. To ensure that the new IngressPolicy
* is added before the old one is removed, add a `lifecycle` block with `create_before_destroy = true` to this resource.
* > **Note:** If this resource is used alongside a `gcp.accesscontextmanager.ServicePerimeter` resource,
* the service perimeter resource must have a `lifecycle` block with `ignore_changes = [status[0].ingress_policies]` so
* they don't fight over which ingress rules should be in the policy.
* To get more information about ServicePerimeterIngressPolicy, see:
* * [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.servicePerimeters#ingresspolicy)
* * How-to Guides
* * [Guide to Ingress and Egress Rules](https://cloud.google.com/vpc-service-controls/docs/ingress-egress-rules)
* ## Example Usage
*/
public class ServicePerimeterIngressPolicy internal constructor(
override val javaResource: com.pulumi.gcp.accesscontextmanager.ServicePerimeterIngressPolicy,
) : KotlinCustomResource(javaResource, ServicePerimeterIngressPolicyMapper) {
/**
* Defines the conditions on the source of a request causing this `IngressPolicy`
* to apply.
* Structure is documented below.
*/
public val ingressFrom: Output?
get() = javaResource.ingressFrom().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
servicePerimeterIngressPolicyIngressFromToKotlin(args0)
})
}).orElse(null)
})
/**
* Defines the conditions on the `ApiOperation` and request destination that cause
* this `IngressPolicy` to apply.
* Structure is documented below.
*/
public val ingressTo: Output?
get() = javaResource.ingressTo().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
servicePerimeterIngressPolicyIngressToToKotlin(args0)
})
}).orElse(null)
})
/**
* The name of the Service Perimeter to add this resource to.
* - - -
*/
public val perimeter: Output
get() = javaResource.perimeter().applyValue({ args0 -> args0 })
}
public object ServicePerimeterIngressPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.accesscontextmanager.ServicePerimeterIngressPolicy::class == javaResource::class
override fun map(javaResource: Resource): ServicePerimeterIngressPolicy =
ServicePerimeterIngressPolicy(
javaResource as
com.pulumi.gcp.accesscontextmanager.ServicePerimeterIngressPolicy,
)
}
/**
* @see [ServicePerimeterIngressPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ServicePerimeterIngressPolicy].
*/
public suspend fun servicePerimeterIngressPolicy(
name: String,
block: suspend ServicePerimeterIngressPolicyResourceBuilder.() -> Unit,
): ServicePerimeterIngressPolicy {
val builder = ServicePerimeterIngressPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ServicePerimeterIngressPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun servicePerimeterIngressPolicy(name: String): ServicePerimeterIngressPolicy {
val builder = ServicePerimeterIngressPolicyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy