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

com.pulumi.awsnative.internetmonitor.kotlin.Monitor.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.

There is a newer version: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.internetmonitor.kotlin

import com.pulumi.awsnative.internetmonitor.kotlin.enums.MonitorConfigState
import com.pulumi.awsnative.internetmonitor.kotlin.enums.MonitorProcessingStatusCode
import com.pulumi.awsnative.internetmonitor.kotlin.outputs.MonitorHealthEventsConfig
import com.pulumi.awsnative.internetmonitor.kotlin.outputs.MonitorInternetMeasurementsLogDelivery
import com.pulumi.awsnative.kotlin.outputs.Tag
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.awsnative.internetmonitor.kotlin.enums.MonitorConfigState.Companion.toKotlin as monitorConfigStateToKotlin
import com.pulumi.awsnative.internetmonitor.kotlin.enums.MonitorProcessingStatusCode.Companion.toKotlin as monitorProcessingStatusCodeToKotlin
import com.pulumi.awsnative.internetmonitor.kotlin.outputs.MonitorHealthEventsConfig.Companion.toKotlin as monitorHealthEventsConfigToKotlin
import com.pulumi.awsnative.internetmonitor.kotlin.outputs.MonitorInternetMeasurementsLogDelivery.Companion.toKotlin as monitorInternetMeasurementsLogDeliveryToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

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

    public var args: MonitorArgs = MonitorArgs()

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

/**
 * Represents a monitor, which defines the monitoring boundaries for measurements that Internet Monitor publishes information about for an application
 */
public class Monitor internal constructor(
    override val javaResource: com.pulumi.awsnative.internetmonitor.Monitor,
) : KotlinCustomResource(javaResource, MonitorMapper) {
    /**
     * The time when the monitor was created.
     */
    public val createdAt: Output
        get() = javaResource.createdAt().applyValue({ args0 -> args0 })

    /**
     * A complex type with the configuration information that determines the threshold and other conditions for when Internet Monitor creates a health event for an overall performance or availability issue, across an application's geographies.
     * Defines the percentages, for overall performance scores and availability scores for an application, that are the thresholds for when Amazon CloudWatch Internet Monitor creates a health event. You can override the defaults to set a custom threshold for overall performance or availability scores, or both.
     * You can also set thresholds for local health scores,, where Internet Monitor creates a health event when scores cross a threshold for one or more city-networks, in addition to creating an event when an overall score crosses a threshold.
     * If you don't set a health event threshold, the default value is 95%.
     * For local thresholds, you also set a minimum percentage of overall traffic that is impacted by an issue before Internet Monitor creates an event. In addition, you can disable local thresholds, for performance scores, availability scores, or both.
     * For more information, see [Change health event thresholds](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-IM-overview.html#IMUpdateThresholdFromOverview) in the Internet Monitor section of the *CloudWatch User Guide* .
     */
    public val healthEventsConfig: Output?
        get() = javaResource.healthEventsConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> monitorHealthEventsConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A boolean option that you can set to `TRUE` to include monitors for linked accounts in a list of monitors, when you've set up cross-account sharing in Internet Monitor. You configure cross-account sharing by using Amazon CloudWatch Observability Access Manager. For more information, see [Internet Monitor cross-account observability](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cwim-cross-account.html) in the Amazon CloudWatch User Guide.
     */
    public val includeLinkedAccounts: Output?
        get() = javaResource.includeLinkedAccounts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Publish internet measurements for a monitor for all city-networks (up to the 500,000 service limit) to another location, such as an Amazon S3 bucket. Measurements are also published to Amazon CloudWatch Logs for the first 500 (by traffic volume) city-networks (client locations and ASNs, typically internet service providers or ISPs).
     */
    public val internetMeasurementsLogDelivery: Output?
        get() = javaResource.internetMeasurementsLogDelivery().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> monitorInternetMeasurementsLogDeliveryToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The account ID for an account that you've set up cross-account sharing for in Internet Monitor. You configure cross-account sharing by using Amazon CloudWatch Observability Access Manager. For more information, see [Internet Monitor cross-account observability](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cwim-cross-account.html) in the Amazon CloudWatch User Guide.
     */
    public val linkedAccountId: Output?
        get() = javaResource.linkedAccountId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The maximum number of city-networks to monitor for your resources. A city-network is the location (city) where clients access your application resources from and the network, such as an internet service provider, that clients access the resources through.
     * For more information, see [Choosing a city-network maximum value](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/IMCityNetworksMaximum.html) in *Using Amazon CloudWatch Internet Monitor* .
     */
    public val maxCityNetworksToMonitor: Output?
        get() = javaResource.maxCityNetworksToMonitor().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The last time that the monitor was modified.
     */
    public val modifiedAt: Output
        get() = javaResource.modifiedAt().applyValue({ args0 -> args0 })

    /**
     * The Amazon Resource Name (ARN) of the monitor.
     */
    public val monitorArn: Output
        get() = javaResource.monitorArn().applyValue({ args0 -> args0 })

    /**
     * The name of the monitor. A monitor name can contain only alphanumeric characters, dashes (-), periods (.), and underscores (_).
     */
    public val monitorName: Output
        get() = javaResource.monitorName().applyValue({ args0 -> args0 })

    /**
     * The health of data processing for the monitor. For more information, see `ProcessingStatus` under [MonitorListMember](https://docs.aws.amazon.com/internet-monitor/latest/api/API_MonitorListMember.html) in the *Amazon CloudWatch Internet Monitor API Reference* .
     */
    public val processingStatus: Output
        get() = javaResource.processingStatus().applyValue({ args0 ->
            args0.let({ args0 ->
                monitorProcessingStatusCodeToKotlin(args0)
            })
        })

    /**
     * Additional information about the health of the data processing for the monitor.
     */
    public val processingStatusInfo: Output
        get() = javaResource.processingStatusInfo().applyValue({ args0 -> args0 })

    /**
     * The resources that have been added for the monitor, listed by their Amazon Resource Names (ARNs). Use this option to add or remove resources when making an update.
     * > Be aware that if you include content in the `Resources` field when you update a monitor, the `ResourcesToAdd` and `ResourcesToRemove` fields must be empty.
     */
    public val resources: Output>?
        get() = javaResource.resources().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The resources to include in a monitor, which you provide as a set of Amazon Resource Names (ARNs). Resources can be Amazon Virtual Private Cloud VPCs, Network Load Balancers (NLBs), Amazon CloudFront distributions, or Amazon WorkSpaces directories.
     * You can add a combination of VPCs and CloudFront distributions, or you can add WorkSpaces directories, or you can add NLBs. You can't add NLBs or WorkSpaces directories together with any other resources.
     * If you add only VPC resources, at least one VPC must have an Internet Gateway attached to it, to make sure that it has internet connectivity.
     * > You can specify this field for a monitor update only if the `Resources` field is empty.
     */
    public val resourcesToAdd: Output>?
        get() = javaResource.resourcesToAdd().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The resources to remove from a monitor, which you provide as a set of Amazon Resource Names (ARNs)
     * > You can specify this field for a monitor update only if the `Resources` field is empty.
     */
    public val resourcesToRemove: Output>?
        get() = javaResource.resourcesToRemove().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The status of a monitor. The accepted values that you can specify for `Status` are `ACTIVE` and `INACTIVE` .
     */
    public val status: Output?
        get() = javaResource.status().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    monitorConfigStateToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The tags for a monitor, listed as a set of *key:value* pairs.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The percentage of the internet-facing traffic for your application that you want to monitor. You can also, optionally, set a limit for the number of city-networks (client locations and ASNs, typically internet service providers) that Internet Monitor will monitor traffic for. The city-networks maximum limit caps the number of city-networks that Internet Monitor monitors for your application, regardless of the percentage of traffic that you choose to monitor.
     */
    public val trafficPercentageToMonitor: Output?
        get() = javaResource.trafficPercentageToMonitor().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object MonitorMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.internetmonitor.Monitor::class == javaResource::class

    override fun map(javaResource: Resource): Monitor = Monitor(
        javaResource as
            com.pulumi.awsnative.internetmonitor.Monitor,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy