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

com.pulumi.cloudflare.kotlin.NotificationPolicy.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.cloudflare.kotlin

import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyEmailIntegration
import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyFilters
import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyPagerdutyIntegration
import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyWebhooksIntegration
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyEmailIntegration.Companion.toKotlin as notificationPolicyEmailIntegrationToKotlin
import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyFilters.Companion.toKotlin as notificationPolicyFiltersToKotlin
import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyPagerdutyIntegration.Companion.toKotlin as notificationPolicyPagerdutyIntegrationToKotlin
import com.pulumi.cloudflare.kotlin.outputs.NotificationPolicyWebhooksIntegration.Companion.toKotlin as notificationPolicyWebhooksIntegrationToKotlin

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

    public var args: NotificationPolicyArgs = NotificationPolicyArgs()

    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 NotificationPolicyArgsBuilder.() -> Unit) {
        val builder = NotificationPolicyArgsBuilder()
        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(): NotificationPolicy {
        val builtJavaResource = com.pulumi.cloudflare.NotificationPolicy(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return NotificationPolicy(builtJavaResource)
    }
}

/**
 * Provides a resource, that manages a notification policy for
 * Cloudflare's products. The delivery mechanisms supported are email,
 * webhooks, and PagerDuty.
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/notificationPolicy:NotificationPolicy example /
 * ```
 */
public class NotificationPolicy internal constructor(
    override val javaResource: com.pulumi.cloudflare.NotificationPolicy,
) : KotlinCustomResource(javaResource, NotificationPolicyMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * The event type that will trigger the dispatch of a notification. See the developer documentation for descriptions of [available alert types](https://developers.cloudflare.com/fundamentals/notifications/notification-available/). Available values: `advanced_http_alert_error`, `access_custom_certificate_expiration_type`, `advanced_ddos_attack_l4_alert`, `advanced_ddos_attack_l7_alert`, `bgp_hijack_notification`, `billing_usage_alert`, `block_notification_block_removed`, `block_notification_new_block`, `block_notification_review_rejected`, `brand_protection_alert`, `brand_protection_digest`, `clickhouse_alert_fw_anomaly`, `clickhouse_alert_fw_ent_anomaly`, `custom_ssl_certificate_event_type`, `dedicated_ssl_certificate_event_type`, `dos_attack_l4`, `dos_attack_l7`, `expiring_service_token_alert`, `failing_logpush_job_disabled_alert`, `fbm_auto_advertisement`, `fbm_dosd_attack`, `fbm_volumetric_attack`, `health_check_status_notification`, `hostname_aop_custom_certificate_expiration_type`, `http_alert_edge_error`, `http_alert_origin_error`, `image_notification`, `incident_alert`, `load_balancing_health_alert`, `load_balancing_pool_enablement_alert`, `logo_match_alert`, `magic_tunnel_health_check_event`, `maintenance_event_notification`, `mtls_certificate_store_certificate_expiration_type`, `pages_event_alert`, `radar_notification`, `real_origin_monitoring`, `scriptmonitor_alert_new_code_change_detections`, `scriptmonitor_alert_new_hosts`, `scriptmonitor_alert_new_malicious_hosts`, `scriptmonitor_alert_new_malicious_scripts`, `scriptmonitor_alert_new_malicious_url`, `scriptmonitor_alert_new_max_length_resource_url`, `scriptmonitor_alert_new_resources`, `secondary_dns_all_primaries_failing`, `secondary_dns_primaries_failing`, `secondary_dns_zone_successfully_updated`, `secondary_dns_zone_validation_warning`, `sentinel_alert`, `stream_live_notifications`, `traffic_anomalies_alert`, `tunnel_health_event`, `tunnel_update_event`, `universal_ssl_event_type`, `web_analytics_metrics_update`, `weekly_account_overview`, `workers_alert`, `zone_aop_custom_certificate_expiration_type`.
     */
    public val alertType: Output
        get() = javaResource.alertType().applyValue({ args0 -> args0 })

    /**
     * When the notification policy was created.
     */
    public val created: Output
        get() = javaResource.created().applyValue({ args0 -> args0 })

    /**
     * Description of the notification policy.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The email ID to which the notification should be dispatched.
     */
    public val emailIntegrations: Output>?
        get() = javaResource.emailIntegrations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        notificationPolicyEmailIntegrationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The status of the notification policy.
     */
    public val enabled: Output
        get() = javaResource.enabled().applyValue({ args0 -> args0 })

    /**
     * An optional nested block of filters that applies to the selected `alert_type`. A key-value map that specifies the type of filter and the values to match against (refer to the alert type block for available fields).
     */
    public val filters: Output?
        get() = javaResource.filters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    notificationPolicyFiltersToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * When the notification policy was last modified.
     */
    public val modified: Output
        get() = javaResource.modified().applyValue({ args0 -> args0 })

    /**
     * The name of the notification policy.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The unique ID of a configured pagerduty endpoint to which the notification should be dispatched.
     */
    public val pagerdutyIntegrations: Output>?
        get() = javaResource.pagerdutyIntegrations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        notificationPolicyPagerdutyIntegrationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The unique ID of a configured webhooks endpoint to which the notification should be dispatched.
     */
    public val webhooksIntegrations: Output>?
        get() = javaResource.webhooksIntegrations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        notificationPolicyWebhooksIntegrationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })
}

public object NotificationPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.NotificationPolicy::class == javaResource::class

    override fun map(javaResource: Resource): NotificationPolicy = NotificationPolicy(
        javaResource as
            com.pulumi.cloudflare.NotificationPolicy,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy