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

com.pulumi.googlenative.run.v2.kotlin.Service.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.googlenative.run.v2.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2BinaryAuthorizationResponse
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2ConditionResponse
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2RevisionTemplateResponse
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2TrafficTargetResponse
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2TrafficTargetStatusResponse
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 kotlin.collections.Map
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2BinaryAuthorizationResponse.Companion.toKotlin as googleCloudRunV2BinaryAuthorizationResponseToKotlin
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2ConditionResponse.Companion.toKotlin as googleCloudRunV2ConditionResponseToKotlin
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2RevisionTemplateResponse.Companion.toKotlin as googleCloudRunV2RevisionTemplateResponseToKotlin
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2TrafficTargetResponse.Companion.toKotlin as googleCloudRunV2TrafficTargetResponseToKotlin
import com.pulumi.googlenative.run.v2.kotlin.outputs.GoogleCloudRunV2TrafficTargetStatusResponse.Companion.toKotlin as googleCloudRunV2TrafficTargetStatusResponseToKotlin

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

    public var args: ServiceArgs = ServiceArgs()

    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 ServiceArgsBuilder.() -> Unit) {
        val builder = ServiceArgsBuilder()
        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(): Service {
        val builtJavaResource = com.pulumi.googlenative.run.v2.Service(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Service(builtJavaResource)
    }
}

/**
 * Creates a new Service in a given project and location.
 */
public class Service internal constructor(
    override val javaResource: com.pulumi.googlenative.run.v2.Service,
) : KotlinCustomResource(javaResource, ServiceMapper) {
    /**
     * Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected in new resources. All system annotations in v1 now have a corresponding field in v2 Service. This field follows Kubernetes annotations' namespacing, limits, and rules.
     */
    public val annotations: Output>
        get() = javaResource.annotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Settings for the Binary Authorization feature.
     */
    public val binaryAuthorization: Output
        get() = javaResource.binaryAuthorization().applyValue({ args0 ->
            args0.let({ args0 ->
                googleCloudRunV2BinaryAuthorizationResponseToKotlin(args0)
            })
        })

    /**
     * Arbitrary identifier for the API client.
     */
    public val client: Output
        get() = javaResource.client().applyValue({ args0 -> args0 })

    /**
     * Arbitrary version identifier for the API client.
     */
    public val clientVersion: Output
        get() = javaResource.clientVersion().applyValue({ args0 -> args0 })

    /**
     * The Conditions of all other associated sub-resources. They contain additional diagnostics information in case the Service does not reach its Serving state. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
     */
    public val conditions: Output>
        get() = javaResource.conditions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    googleCloudRunV2ConditionResponseToKotlin(args0)
                })
            })
        })

    /**
     * The creation time.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Email address of the authenticated creator.
     */
    public val creator: Output
        get() = javaResource.creator().applyValue({ args0 -> args0 })

    /**
     * The deletion time.
     */
    public val deleteTime: Output
        get() = javaResource.deleteTime().applyValue({ args0 -> args0 })

    /**
     * User-provided description of the Service. This field currently has a 512-character limit.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * For a deleted resource, the time after which it will be permamently deleted.
     */
    public val expireTime: Output
        get() = javaResource.expireTime().applyValue({ args0 -> args0 })

    /**
     * A number that monotonically increases every time the user modifies the desired state. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a `string` instead of an `integer`.
     */
    public val generation: Output
        get() = javaResource.generation().applyValue({ args0 -> args0 })

    /**
     * Provides the ingress settings for this Service. On output, returns the currently observed ingress settings, or INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
     */
    public val ingress: Output
        get() = javaResource.ingress().applyValue({ args0 -> args0 })

    /**
     * Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system labels in v1 now have a corresponding field in v2 Service.
     */
    public val labels: Output>
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Email address of the last authenticated modifier.
     */
    public val lastModifier: Output
        get() = javaResource.lastModifier().applyValue({ args0 -> args0 })

    /**
     * Name of the last created revision. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
     */
    public val latestCreatedRevision: Output
        get() = javaResource.latestCreatedRevision().applyValue({ args0 -> args0 })

    /**
     * Name of the latest revision that is serving traffic. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
     */
    public val latestReadyRevision: Output
        get() = javaResource.latestReadyRevision().applyValue({ args0 -> args0 })

    /**
     * The launch stage as defined by [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as input, but only BETA and GA-level features are used, this field will be BETA on output.
     */
    public val launchStage: Output
        get() = javaResource.launchStage().applyValue({ args0 -> args0 })

    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The fully qualified name of this Service. In CreateServiceRequest, this field is ignored, and instead composed from CreateServiceRequest.parent and CreateServiceRequest.service_id. Format: projects/{project}/locations/{location}/services/{service_id}
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The generation of this Service currently serving traffic. See comments in `reconciling` for additional information on reconciliation process in Cloud Run. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a `string` instead of an `integer`.
     */
    public val observedGeneration: Output
        get() = javaResource.observedGeneration().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Returns true if the Service is currently being acted upon by the system to bring it into the desired state. When a new Service is created, or an existing one is updated, Cloud Run will asynchronously perform all necessary steps to bring the Service to the desired serving state. This process is called reconciliation. While reconciliation is in process, `observed_generation`, `latest_ready_revison`, `traffic_statuses`, and `uri` will have transient values that might mismatch the intended state: Once reconciliation is over (and this field is false), there are two possible outcomes: reconciliation succeeded and the serving state matches the Service, or there was an error, and reconciliation failed. This state can be found in `terminal_condition.state`. If reconciliation succeeded, the following fields will match: `traffic` and `traffic_statuses`, `observed_generation` and `generation`, `latest_ready_revision` and `latest_created_revision`. If reconciliation failed, `traffic_statuses`, `observed_generation`, and `latest_ready_revision` will have the state of the last serving revision, or empty for newly created Services. Additional information on the failure can be found in `terminal_condition` and `conditions`.
     */
    public val reconciling: Output
        get() = javaResource.reconciling().applyValue({ args0 -> args0 })

    /**
     * Reserved for future use.
     */
    public val satisfiesPzs: Output
        get() = javaResource.satisfiesPzs().applyValue({ args0 -> args0 })

    /**
     * Required. The unique identifier for the Service. It must begin with letter, and cannot end with hyphen; must contain fewer than 50 characters. The name of the service becomes {parent}/services/{service_id}.
     */
    public val serviceId: Output
        get() = javaResource.serviceId().applyValue({ args0 -> args0 })

    /**
     * The template used to create revisions for this Service.
     */
    public val template: Output
        get() = javaResource.template().applyValue({ args0 ->
            args0.let({ args0 ->
                googleCloudRunV2RevisionTemplateResponseToKotlin(args0)
            })
        })

    /**
     * The Condition of this Service, containing its readiness status, and detailed error information in case it did not reach a serving state. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
     */
    public val terminalCondition: Output
        get() = javaResource.terminalCondition().applyValue({ args0 ->
            args0.let({ args0 ->
                googleCloudRunV2ConditionResponseToKotlin(args0)
            })
        })

    /**
     * Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not provided, defaults to 100% traffic to the latest `Ready` Revision.
     */
    public val traffic: Output>
        get() = javaResource.traffic().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    googleCloudRunV2TrafficTargetResponseToKotlin(args0)
                })
            })
        })

    /**
     * Detailed status information for corresponding traffic targets. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
     */
    public val trafficStatuses: Output>
        get() = javaResource.trafficStatuses().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> googleCloudRunV2TrafficTargetStatusResponseToKotlin(args0) })
            })
        })

    /**
     * Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * The last-modified time.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })

    /**
     * The main URI in which this Service is serving traffic.
     */
    public val uri: Output
        get() = javaResource.uri().applyValue({ args0 -> args0 })
}

public object ServiceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.run.v2.Service::class == javaResource::class

    override fun map(javaResource: Resource): Service = Service(
        javaResource as
            com.pulumi.googlenative.run.v2.Service,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy