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

com.pulumi.kubernetes.events.v1.kotlin.Event.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: 4.18.2.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.kubernetes.events.v1.kotlin

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.kubernetes.core.v1.kotlin.outputs.EventSource
import com.pulumi.kubernetes.core.v1.kotlin.outputs.ObjectReference
import com.pulumi.kubernetes.events.v1.kotlin.outputs.EventSeries
import com.pulumi.kubernetes.meta.v1.kotlin.outputs.ObjectMeta
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.kubernetes.core.v1.kotlin.outputs.EventSource.Companion.toKotlin as eventSourceToKotlin
import com.pulumi.kubernetes.core.v1.kotlin.outputs.ObjectReference.Companion.toKotlin as objectReferenceToKotlin
import com.pulumi.kubernetes.events.v1.kotlin.outputs.EventSeries.Companion.toKotlin as eventSeriesToKotlin
import com.pulumi.kubernetes.meta.v1.kotlin.outputs.ObjectMeta.Companion.toKotlin as objectMetaToKotlin

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

    public var args: EventArgs = EventArgs()

    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 EventArgsBuilder.() -> Unit) {
        val builder = EventArgsBuilder()
        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(): Event {
        val builtJavaResource = com.pulumi.kubernetes.events.v1.Event(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Event(builtJavaResource)
    }
}

/**
 * Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time.  Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason.  Events should be treated as informative, best-effort, supplemental data.
 */
public class Event internal constructor(
    override val javaResource: com.pulumi.kubernetes.events.v1.Event,
) : KotlinCustomResource(javaResource, EventMapper) {
    /**
     * action is what action was taken/failed regarding to the regarding object. It is machine-readable. This field cannot be empty for new Events and it can have at most 128 characters.
     */
    public val action: Output
        get() = javaResource.action().applyValue({ args0 -> args0 })

    /**
     * APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
     */
    public val apiVersion: Output
        get() = javaResource.apiVersion().applyValue({ args0 -> args0 })

    /**
     * deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type.
     */
    public val deprecatedCount: Output
        get() = javaResource.deprecatedCount().applyValue({ args0 -> args0 })

    /**
     * deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.
     */
    public val deprecatedFirstTimestamp: Output
        get() = javaResource.deprecatedFirstTimestamp().applyValue({ args0 -> args0 })

    /**
     * deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.
     */
    public val deprecatedLastTimestamp: Output
        get() = javaResource.deprecatedLastTimestamp().applyValue({ args0 -> args0 })

    /**
     * deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type.
     */
    public val deprecatedSource: Output
        get() = javaResource.deprecatedSource().applyValue({ args0 ->
            args0.let({ args0 ->
                eventSourceToKotlin(args0)
            })
        })

    /**
     * eventTime is the time when this Event was first observed. It is required.
     */
    public val eventTime: Output
        get() = javaResource.eventTime().applyValue({ args0 -> args0 })

    /**
     * Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
     */
    public val metadata: Output
        get() = javaResource.metadata().applyValue({ args0 ->
            args0.let({ args0 ->
                objectMetaToKotlin(args0)
            })
        })

    /**
     * note is a human-readable description of the status of this operation. Maximal length of the note is 1kB, but libraries should be prepared to handle values up to 64kB.
     */
    public val note: Output
        get() = javaResource.note().applyValue({ args0 -> args0 })

    /**
     * reason is why the action was taken. It is human-readable. This field cannot be empty for new Events and it can have at most 128 characters.
     */
    public val reason: Output
        get() = javaResource.reason().applyValue({ args0 -> args0 })

    /**
     * regarding contains the object this Event is about. In most cases it's an Object reporting controller implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because it acts on some changes in a ReplicaSet object.
     */
    public val regarding: Output
        get() = javaResource.regarding().applyValue({ args0 ->
            args0.let({ args0 ->
                objectReferenceToKotlin(args0)
            })
        })

    /**
     * related is the optional secondary object for more complex actions. E.g. when regarding object triggers a creation or deletion of related object.
     */
    public val related: Output
        get() = javaResource.related().applyValue({ args0 ->
            args0.let({ args0 ->
                objectReferenceToKotlin(args0)
            })
        })

    /**
     * reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. This field cannot be empty for new Events.
     */
    public val reportingController: Output
        get() = javaResource.reportingController().applyValue({ args0 -> args0 })

    /**
     * reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`. This field cannot be empty for new Events and it can have at most 128 characters.
     */
    public val reportingInstance: Output
        get() = javaResource.reportingInstance().applyValue({ args0 -> args0 })

    /**
     * series is data about the Event series this event represents or nil if it's a singleton Event.
     */
    public val series: Output
        get() = javaResource.series().applyValue({ args0 ->
            args0.let({ args0 ->
                eventSeriesToKotlin(args0)
            })
        })

    /**
     * type is the type of this event (Normal, Warning), new types could be added in the future. It is machine-readable. This field cannot be empty for new Events.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object EventMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.kubernetes.events.v1.Event::class == javaResource::class

    override fun map(javaResource: Resource): Event = Event(
        javaResource as
            com.pulumi.kubernetes.events.v1.Event,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy