com.pulumi.cloudflare.kotlin.AccessPolicy.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.
The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.cloudflare.kotlin
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyApprovalGroup
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyConnectionRules
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyExclude
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyInclude
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyRequire
import com.pulumi.core.Output
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyApprovalGroup.Companion.toKotlin as accessPolicyApprovalGroupToKotlin
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyConnectionRules.Companion.toKotlin as accessPolicyConnectionRulesToKotlin
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyExclude.Companion.toKotlin as accessPolicyExcludeToKotlin
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyInclude.Companion.toKotlin as accessPolicyIncludeToKotlin
import com.pulumi.cloudflare.kotlin.outputs.AccessPolicyRequire.Companion.toKotlin as accessPolicyRequireToKotlin
/**
* Builder for [AccessPolicy].
*/
@PulumiTagMarker
public class AccessPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: AccessPolicyArgs = AccessPolicyArgs()
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 AccessPolicyArgsBuilder.() -> Unit) {
val builder = AccessPolicyArgsBuilder()
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(): AccessPolicy {
val builtJavaResource = com.pulumi.cloudflare.AccessPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return AccessPolicy(builtJavaResource)
}
}
/**
* Provides a Cloudflare Access Policy resource. Access Policies are
* used in conjunction with Access Applications to restrict access to
* a particular resource.
* > It's required that an `account_id` or `zone_id` is provided and in most cases using either is fine.
* However, if you're using a scoped access token, you must provide the argument that matches the token's
* scope. For example, an access token that is scoped to the "example.com" zone needs to use the `zone_id` argument.
* If 'application_id' is omitted, the policy created can be reused by multiple access applications.
* Any cloudflare.AccessApplication resource can reference reusable policies through its `policies` argument.
* To destroy a reusable policy and remove it from all applications' policies lists on the same apply, preemptively set the
* lifecycle option `create_before_destroy` to true on the 'cloudflare_access_policy' resource.
* ## Import
* ```sh
* $ pulumi import cloudflare:index/accessPolicy:AccessPolicy example account///
* ```
*/
public class AccessPolicy internal constructor(
override val javaResource: com.pulumi.cloudflare.AccessPolicy,
) : KotlinCustomResource(javaResource, AccessPolicyMapper) {
/**
* The account identifier to target for the resource. Conflicts with `zone_id`.
*/
public val accountId: Output?
get() = javaResource.accountId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The ID of the application the policy is associated with. Required when using `precedence`. **Modifying this attribute will force creation of a new resource.**
*/
public val applicationId: Output?
get() = javaResource.applicationId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
public val approvalGroups: Output>?
get() = javaResource.approvalGroups().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
accessPolicyApprovalGroupToKotlin(args0)
})
})
}).orElse(null)
})
public val approvalRequired: Output?
get() = javaResource.approvalRequired().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The rules that define how users may connect to the targets secured by your application.
*/
public val connectionRules: Output?
get() = javaResource.connectionRules().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> accessPolicyConnectionRulesToKotlin(args0) })
}).orElse(null)
})
/**
* Defines the action Access will take if the policy matches the user. Available values: `allow`, `deny`, `non_identity`, `bypass`.
*/
public val decision: Output
get() = javaResource.decision().applyValue({ args0 -> args0 })
/**
* A series of access conditions, see Access Groups.
*/
public val excludes: Output>?
get() = javaResource.excludes().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> accessPolicyExcludeToKotlin(args0) })
})
}).orElse(null)
})
/**
* A series of access conditions, see Access Groups.
*/
public val includes: Output>
get() = javaResource.includes().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
accessPolicyIncludeToKotlin(args0)
})
})
})
/**
* Require this application to be served in an isolated browser for users matching this policy.
*/
public val isolationRequired: Output?
get() = javaResource.isolationRequired().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Friendly name of the Access Policy.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The unique precedence for policies on a single application. Required when using `application_id`.
*/
public val precedence: Output?
get() = javaResource.precedence().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The prompt to display to the user for a justification for accessing the resource. Required when using `purpose_justification_required`.
*/
public val purposeJustificationPrompt: Output?
get() = javaResource.purposeJustificationPrompt().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Whether to prompt the user for a justification for accessing the resource.
*/
public val purposeJustificationRequired: Output?
get() = javaResource.purposeJustificationRequired().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A series of access conditions, see Access Groups.
*/
public val requires: Output>?
get() = javaResource.requires().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> accessPolicyRequireToKotlin(args0) })
})
}).orElse(null)
})
/**
* How often a user will be forced to re-authorise. Must be in the format `48h` or `2h45m`.
*/
public val sessionDuration: Output?
get() = javaResource.sessionDuration().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The zone identifier to target for the resource. Conflicts with `account_id`.
*/
public val zoneId: Output?
get() = javaResource.zoneId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object AccessPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.cloudflare.AccessPolicy::class == javaResource::class
override fun map(javaResource: Resource): AccessPolicy = AccessPolicy(
javaResource as
com.pulumi.cloudflare.AccessPolicy,
)
}
/**
* @see [AccessPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [AccessPolicy].
*/
public suspend fun accessPolicy(
name: String,
block: suspend AccessPolicyResourceBuilder.() -> Unit,
): AccessPolicy {
val builder = AccessPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [AccessPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun accessPolicy(name: String): AccessPolicy {
val builder = AccessPolicyResourceBuilder()
builder.name(name)
return builder.build()
}