com.pulumi.gcp.apphub.kotlin.Workload.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.apphub.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.apphub.kotlin.outputs.WorkloadAttributes
import com.pulumi.gcp.apphub.kotlin.outputs.WorkloadWorkloadProperty
import com.pulumi.gcp.apphub.kotlin.outputs.WorkloadWorkloadReference
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.gcp.apphub.kotlin.outputs.WorkloadAttributes.Companion.toKotlin as workloadAttributesToKotlin
import com.pulumi.gcp.apphub.kotlin.outputs.WorkloadWorkloadProperty.Companion.toKotlin as workloadWorkloadPropertyToKotlin
import com.pulumi.gcp.apphub.kotlin.outputs.WorkloadWorkloadReference.Companion.toKotlin as workloadWorkloadReferenceToKotlin
/**
* Builder for [Workload].
*/
@PulumiTagMarker
public class WorkloadResourceBuilder internal constructor() {
public var name: String? = null
public var args: WorkloadArgs = WorkloadArgs()
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 WorkloadArgsBuilder.() -> Unit) {
val builder = WorkloadArgsBuilder()
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(): Workload {
val builtJavaResource = com.pulumi.gcp.apphub.Workload(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Workload(builtJavaResource)
}
}
/**
* Workload represents a binary deployment (such as Managed Instance Groups (MIGs), GKE deployments, etc.) that performs the smallest logical subset of business functionality. It registers identified workload to the Application.
* ## Example Usage
* ## Import
* Workload can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/applications/{{application_id}}/workloads/{{workload_id}}`
* * `{{project}}/{{location}}/{{application_id}}/{{workload_id}}`
* * `{{location}}/{{application_id}}/{{workload_id}}`
* When using the `pulumi import` command, Workload can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:apphub/workload:Workload default projects/{{project}}/locations/{{location}}/applications/{{application_id}}/workloads/{{workload_id}}
* ```
* ```sh
* $ pulumi import gcp:apphub/workload:Workload default {{project}}/{{location}}/{{application_id}}/{{workload_id}}
* ```
* ```sh
* $ pulumi import gcp:apphub/workload:Workload default {{location}}/{{application_id}}/{{workload_id}}
* ```
*/
public class Workload internal constructor(
override val javaResource: com.pulumi.gcp.apphub.Workload,
) : KotlinCustomResource(javaResource, WorkloadMapper) {
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
public val applicationId: Output
get() = javaResource.applicationId().applyValue({ args0 -> args0 })
/**
* Consumer provided attributes.
* Structure is documented below.
*/
public val attributes: Output?
get() = javaResource.attributes().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
workloadAttributesToKotlin(args0)
})
}).orElse(null)
})
/**
* Output only. Create time.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* User-defined description of a Workload.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Immutable. The resource name of the original discovered workload.
*/
public val discoveredWorkload: Output
get() = javaResource.discoveredWorkload().applyValue({ args0 -> args0 })
/**
* User-defined name for the Workload.
*/
public val displayName: Output?
get() = javaResource.displayName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Identifier. The resource name of the Workload. Format:"projects/{host-project-id}/locations/{location}/applications/{application-id}/workloads/{workload-id}"
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* Output only. Workload state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
*/
public val state: Output
get() = javaResource.state().applyValue({ args0 -> args0 })
/**
* Output only. A universally unique identifier (UUID) for the `Workload` in the UUID4 format.
*/
public val uid: Output
get() = javaResource.uid().applyValue({ args0 -> args0 })
/**
* Output only. Update time.
*/
public val updateTime: Output
get() = javaResource.updateTime().applyValue({ args0 -> args0 })
/**
* The Workload identifier.
* - - -
*/
public val workloadId: Output
get() = javaResource.workloadId().applyValue({ args0 -> args0 })
/**
* Properties of an underlying compute resource represented by the Workload.
* Structure is documented below.
*/
public val workloadProperties: Output>
get() = javaResource.workloadProperties().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> workloadWorkloadPropertyToKotlin(args0) })
})
})
/**
* Reference of an underlying compute resource represented by the Workload.
* Structure is documented below.
*/
public val workloadReferences: Output>
get() = javaResource.workloadReferences().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> workloadWorkloadReferenceToKotlin(args0) })
})
})
}
public object WorkloadMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.apphub.Workload::class == javaResource::class
override fun map(javaResource: Resource): Workload = Workload(
javaResource as
com.pulumi.gcp.apphub.Workload,
)
}
/**
* @see [Workload].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Workload].
*/
public suspend fun workload(name: String, block: suspend WorkloadResourceBuilder.() -> Unit): Workload {
val builder = WorkloadResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Workload].
* @param name The _unique_ name of the resulting resource.
*/
public fun workload(name: String): Workload {
val builder = WorkloadResourceBuilder()
builder.name(name)
return builder.build()
}