Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.compute.kotlin.ResizeRequest.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.ResizeRequestRequestedRunDuration
import com.pulumi.gcp.compute.kotlin.outputs.ResizeRequestStatus
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.gcp.compute.kotlin.outputs.ResizeRequestRequestedRunDuration.Companion.toKotlin as resizeRequestRequestedRunDurationToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.ResizeRequestStatus.Companion.toKotlin as resizeRequestStatusToKotlin
/**
* Builder for [ResizeRequest].
*/
@PulumiTagMarker
public class ResizeRequestResourceBuilder internal constructor() {
public var name: String? = null
public var args: ResizeRequestArgs = ResizeRequestArgs()
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 ResizeRequestArgsBuilder.() -> Unit) {
val builder = ResizeRequestArgsBuilder()
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(): ResizeRequest {
val builtJavaResource = com.pulumi.gcp.compute.ResizeRequest(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ResizeRequest(builtJavaResource)
}
}
/**
* Represents a Managed Instance Group Resize Request
* Resize Requests are the Managed Instance Group implementation of Dynamic Workload Scheduler Flex Start.
* With Dynamic Workload Scheduler in Flex Start mode, you submit a GPU capacity request for your AI/ML jobs by indicating how many you need, a duration, and your preferred region. Dynamic Workload Scheduler intelligently persists the request; once the capacity becomes available, it automatically provisions your VMs enabling your workloads to run continuously for the entire duration of the capacity allocation.
* To get more information about ResizeRequest, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/instanceGroupManagerResizeRequests)
* * How-to Guides
* * [QUICKSTART_TITLE](https://cloud.google.com/compute/docs/instance-groups/create-resize-requests-mig)
* ## Example Usage
* ### Compute Mig Resize Request
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const a3Dws = new gcp.compute.RegionInstanceTemplate("a3_dws", {
* name: "a3-dws",
* region: "us-central1",
* description: "This template is used to create a mig instance that is compatible with DWS resize requests.",
* instanceDescription: "A3 GPU",
* machineType: "a3-highgpu-8g",
* canIpForward: false,
* scheduling: {
* automaticRestart: false,
* onHostMaintenance: "TERMINATE",
* },
* disks: [{
* sourceImage: "cos-cloud/cos-105-lts",
* autoDelete: true,
* boot: true,
* diskType: "pd-ssd",
* diskSizeGb: 960,
* mode: "READ_WRITE",
* }],
* guestAccelerators: [{
* type: "nvidia-h100-80gb",
* count: 8,
* }],
* reservationAffinity: {
* type: "NO_RESERVATION",
* },
* shieldedInstanceConfig: {
* enableVtpm: true,
* enableIntegrityMonitoring: true,
* },
* networkInterfaces: [{
* network: "default",
* }],
* });
* const a3DwsInstanceGroupManager = new gcp.compute.InstanceGroupManager("a3_dws", {
* name: "a3-dws",
* baseInstanceName: "a3-dws",
* zone: "us-central1-a",
* versions: [{
* instanceTemplate: a3Dws.selfLink,
* }],
* instanceLifecyclePolicy: {
* defaultActionOnFailure: "DO_NOTHING",
* },
* waitForInstances: false,
* });
* const a3ResizeRequest = new gcp.compute.ResizeRequest("a3_resize_request", {
* name: "a3-dws",
* instanceGroupManager: a3DwsInstanceGroupManager.name,
* zone: "us-central1-a",
* description: "Test resize request resource",
* resizeBy: 2,
* requestedRunDuration: {
* seconds: "14400",
* nanos: 0,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* a3_dws = gcp.compute.RegionInstanceTemplate("a3_dws",
* name="a3-dws",
* region="us-central1",
* description="This template is used to create a mig instance that is compatible with DWS resize requests.",
* instance_description="A3 GPU",
* machine_type="a3-highgpu-8g",
* can_ip_forward=False,
* scheduling={
* "automatic_restart": False,
* "on_host_maintenance": "TERMINATE",
* },
* disks=[{
* "source_image": "cos-cloud/cos-105-lts",
* "auto_delete": True,
* "boot": True,
* "disk_type": "pd-ssd",
* "disk_size_gb": 960,
* "mode": "READ_WRITE",
* }],
* guest_accelerators=[{
* "type": "nvidia-h100-80gb",
* "count": 8,
* }],
* reservation_affinity={
* "type": "NO_RESERVATION",
* },
* shielded_instance_config={
* "enable_vtpm": True,
* "enable_integrity_monitoring": True,
* },
* network_interfaces=[{
* "network": "default",
* }])
* a3_dws_instance_group_manager = gcp.compute.InstanceGroupManager("a3_dws",
* name="a3-dws",
* base_instance_name="a3-dws",
* zone="us-central1-a",
* versions=[{
* "instance_template": a3_dws.self_link,
* }],
* instance_lifecycle_policy={
* "default_action_on_failure": "DO_NOTHING",
* },
* wait_for_instances=False)
* a3_resize_request = gcp.compute.ResizeRequest("a3_resize_request",
* name="a3-dws",
* instance_group_manager=a3_dws_instance_group_manager.name,
* zone="us-central1-a",
* description="Test resize request resource",
* resize_by=2,
* requested_run_duration={
* "seconds": "14400",
* "nanos": 0,
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var a3Dws = new Gcp.Compute.RegionInstanceTemplate("a3_dws", new()
* {
* Name = "a3-dws",
* Region = "us-central1",
* Description = "This template is used to create a mig instance that is compatible with DWS resize requests.",
* InstanceDescription = "A3 GPU",
* MachineType = "a3-highgpu-8g",
* CanIpForward = false,
* Scheduling = new Gcp.Compute.Inputs.RegionInstanceTemplateSchedulingArgs
* {
* AutomaticRestart = false,
* OnHostMaintenance = "TERMINATE",
* },
* Disks = new[]
* {
* new Gcp.Compute.Inputs.RegionInstanceTemplateDiskArgs
* {
* SourceImage = "cos-cloud/cos-105-lts",
* AutoDelete = true,
* Boot = true,
* DiskType = "pd-ssd",
* DiskSizeGb = 960,
* Mode = "READ_WRITE",
* },
* },
* GuestAccelerators = new[]
* {
* new Gcp.Compute.Inputs.RegionInstanceTemplateGuestAcceleratorArgs
* {
* Type = "nvidia-h100-80gb",
* Count = 8,
* },
* },
* ReservationAffinity = new Gcp.Compute.Inputs.RegionInstanceTemplateReservationAffinityArgs
* {
* Type = "NO_RESERVATION",
* },
* ShieldedInstanceConfig = new Gcp.Compute.Inputs.RegionInstanceTemplateShieldedInstanceConfigArgs
* {
* EnableVtpm = true,
* EnableIntegrityMonitoring = true,
* },
* NetworkInterfaces = new[]
* {
* new Gcp.Compute.Inputs.RegionInstanceTemplateNetworkInterfaceArgs
* {
* Network = "default",
* },
* },
* });
* var a3DwsInstanceGroupManager = new Gcp.Compute.InstanceGroupManager("a3_dws", new()
* {
* Name = "a3-dws",
* BaseInstanceName = "a3-dws",
* Zone = "us-central1-a",
* Versions = new[]
* {
* new Gcp.Compute.Inputs.InstanceGroupManagerVersionArgs
* {
* InstanceTemplate = a3Dws.SelfLink,
* },
* },
* InstanceLifecyclePolicy = new Gcp.Compute.Inputs.InstanceGroupManagerInstanceLifecyclePolicyArgs
* {
* DefaultActionOnFailure = "DO_NOTHING",
* },
* WaitForInstances = false,
* });
* var a3ResizeRequest = new Gcp.Compute.ResizeRequest("a3_resize_request", new()
* {
* Name = "a3-dws",
* InstanceGroupManager = a3DwsInstanceGroupManager.Name,
* Zone = "us-central1-a",
* Description = "Test resize request resource",
* ResizeBy = 2,
* RequestedRunDuration = new Gcp.Compute.Inputs.ResizeRequestRequestedRunDurationArgs
* {
* Seconds = "14400",
* Nanos = 0,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* a3Dws, err := compute.NewRegionInstanceTemplate(ctx, "a3_dws", &compute.RegionInstanceTemplateArgs{
* Name: pulumi.String("a3-dws"),
* Region: pulumi.String("us-central1"),
* Description: pulumi.String("This template is used to create a mig instance that is compatible with DWS resize requests."),
* InstanceDescription: pulumi.String("A3 GPU"),
* MachineType: pulumi.String("a3-highgpu-8g"),
* CanIpForward: pulumi.Bool(false),
* Scheduling: &compute.RegionInstanceTemplateSchedulingArgs{
* AutomaticRestart: pulumi.Bool(false),
* OnHostMaintenance: pulumi.String("TERMINATE"),
* },
* Disks: compute.RegionInstanceTemplateDiskArray{
* &compute.RegionInstanceTemplateDiskArgs{
* SourceImage: pulumi.String("cos-cloud/cos-105-lts"),
* AutoDelete: pulumi.Bool(true),
* Boot: pulumi.Bool(true),
* DiskType: pulumi.String("pd-ssd"),
* DiskSizeGb: pulumi.Int(960),
* Mode: pulumi.String("READ_WRITE"),
* },
* },
* GuestAccelerators: compute.RegionInstanceTemplateGuestAcceleratorArray{
* &compute.RegionInstanceTemplateGuestAcceleratorArgs{
* Type: pulumi.String("nvidia-h100-80gb"),
* Count: pulumi.Int(8),
* },
* },
* ReservationAffinity: &compute.RegionInstanceTemplateReservationAffinityArgs{
* Type: pulumi.String("NO_RESERVATION"),
* },
* ShieldedInstanceConfig: &compute.RegionInstanceTemplateShieldedInstanceConfigArgs{
* EnableVtpm: pulumi.Bool(true),
* EnableIntegrityMonitoring: pulumi.Bool(true),
* },
* NetworkInterfaces: compute.RegionInstanceTemplateNetworkInterfaceArray{
* &compute.RegionInstanceTemplateNetworkInterfaceArgs{
* Network: pulumi.String("default"),
* },
* },
* })
* if err != nil {
* return err
* }
* a3DwsInstanceGroupManager, err := compute.NewInstanceGroupManager(ctx, "a3_dws", &compute.InstanceGroupManagerArgs{
* Name: pulumi.String("a3-dws"),
* BaseInstanceName: pulumi.String("a3-dws"),
* Zone: pulumi.String("us-central1-a"),
* Versions: compute.InstanceGroupManagerVersionArray{
* &compute.InstanceGroupManagerVersionArgs{
* InstanceTemplate: a3Dws.SelfLink,
* },
* },
* InstanceLifecyclePolicy: &compute.InstanceGroupManagerInstanceLifecyclePolicyArgs{
* DefaultActionOnFailure: pulumi.String("DO_NOTHING"),
* },
* WaitForInstances: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewResizeRequest(ctx, "a3_resize_request", &compute.ResizeRequestArgs{
* Name: pulumi.String("a3-dws"),
* InstanceGroupManager: a3DwsInstanceGroupManager.Name,
* Zone: pulumi.String("us-central1-a"),
* Description: pulumi.String("Test resize request resource"),
* ResizeBy: pulumi.Int(2),
* RequestedRunDuration: &compute.ResizeRequestRequestedRunDurationArgs{
* Seconds: pulumi.String("14400"),
* Nanos: pulumi.Int(0),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.RegionInstanceTemplate;
* import com.pulumi.gcp.compute.RegionInstanceTemplateArgs;
* import com.pulumi.gcp.compute.inputs.RegionInstanceTemplateSchedulingArgs;
* import com.pulumi.gcp.compute.inputs.RegionInstanceTemplateDiskArgs;
* import com.pulumi.gcp.compute.inputs.RegionInstanceTemplateGuestAcceleratorArgs;
* import com.pulumi.gcp.compute.inputs.RegionInstanceTemplateReservationAffinityArgs;
* import com.pulumi.gcp.compute.inputs.RegionInstanceTemplateShieldedInstanceConfigArgs;
* import com.pulumi.gcp.compute.inputs.RegionInstanceTemplateNetworkInterfaceArgs;
* import com.pulumi.gcp.compute.InstanceGroupManager;
* import com.pulumi.gcp.compute.InstanceGroupManagerArgs;
* import com.pulumi.gcp.compute.inputs.InstanceGroupManagerVersionArgs;
* import com.pulumi.gcp.compute.inputs.InstanceGroupManagerInstanceLifecyclePolicyArgs;
* import com.pulumi.gcp.compute.ResizeRequest;
* import com.pulumi.gcp.compute.ResizeRequestArgs;
* import com.pulumi.gcp.compute.inputs.ResizeRequestRequestedRunDurationArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var a3Dws = new RegionInstanceTemplate("a3Dws", RegionInstanceTemplateArgs.builder()
* .name("a3-dws")
* .region("us-central1")
* .description("This template is used to create a mig instance that is compatible with DWS resize requests.")
* .instanceDescription("A3 GPU")
* .machineType("a3-highgpu-8g")
* .canIpForward(false)
* .scheduling(RegionInstanceTemplateSchedulingArgs.builder()
* .automaticRestart(false)
* .onHostMaintenance("TERMINATE")
* .build())
* .disks(RegionInstanceTemplateDiskArgs.builder()
* .sourceImage("cos-cloud/cos-105-lts")
* .autoDelete(true)
* .boot(true)
* .diskType("pd-ssd")
* .diskSizeGb("960")
* .mode("READ_WRITE")
* .build())
* .guestAccelerators(RegionInstanceTemplateGuestAcceleratorArgs.builder()
* .type("nvidia-h100-80gb")
* .count(8)
* .build())
* .reservationAffinity(RegionInstanceTemplateReservationAffinityArgs.builder()
* .type("NO_RESERVATION")
* .build())
* .shieldedInstanceConfig(RegionInstanceTemplateShieldedInstanceConfigArgs.builder()
* .enableVtpm(true)
* .enableIntegrityMonitoring(true)
* .build())
* .networkInterfaces(RegionInstanceTemplateNetworkInterfaceArgs.builder()
* .network("default")
* .build())
* .build());
* var a3DwsInstanceGroupManager = new InstanceGroupManager("a3DwsInstanceGroupManager", InstanceGroupManagerArgs.builder()
* .name("a3-dws")
* .baseInstanceName("a3-dws")
* .zone("us-central1-a")
* .versions(InstanceGroupManagerVersionArgs.builder()
* .instanceTemplate(a3Dws.selfLink())
* .build())
* .instanceLifecyclePolicy(InstanceGroupManagerInstanceLifecyclePolicyArgs.builder()
* .defaultActionOnFailure("DO_NOTHING")
* .build())
* .waitForInstances(false)
* .build());
* var a3ResizeRequest = new ResizeRequest("a3ResizeRequest", ResizeRequestArgs.builder()
* .name("a3-dws")
* .instanceGroupManager(a3DwsInstanceGroupManager.name())
* .zone("us-central1-a")
* .description("Test resize request resource")
* .resizeBy(2)
* .requestedRunDuration(ResizeRequestRequestedRunDurationArgs.builder()
* .seconds(14400)
* .nanos(0)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* a3Dws:
* type: gcp:compute:RegionInstanceTemplate
* name: a3_dws
* properties:
* name: a3-dws
* region: us-central1
* description: This template is used to create a mig instance that is compatible with DWS resize requests.
* instanceDescription: A3 GPU
* machineType: a3-highgpu-8g
* canIpForward: false
* scheduling:
* automaticRestart: false
* onHostMaintenance: TERMINATE
* disks:
* - sourceImage: cos-cloud/cos-105-lts
* autoDelete: true
* boot: true
* diskType: pd-ssd
* diskSizeGb: '960'
* mode: READ_WRITE
* guestAccelerators:
* - type: nvidia-h100-80gb
* count: 8
* reservationAffinity:
* type: NO_RESERVATION
* shieldedInstanceConfig:
* enableVtpm: true
* enableIntegrityMonitoring: true
* networkInterfaces:
* - network: default
* a3DwsInstanceGroupManager:
* type: gcp:compute:InstanceGroupManager
* name: a3_dws
* properties:
* name: a3-dws
* baseInstanceName: a3-dws
* zone: us-central1-a
* versions:
* - instanceTemplate: ${a3Dws.selfLink}
* instanceLifecyclePolicy:
* defaultActionOnFailure: DO_NOTHING
* waitForInstances: false
* a3ResizeRequest:
* type: gcp:compute:ResizeRequest
* name: a3_resize_request
* properties:
* name: a3-dws
* instanceGroupManager: ${a3DwsInstanceGroupManager.name}
* zone: us-central1-a
* description: Test resize request resource
* resizeBy: 2
* requestedRunDuration:
* seconds: 14400
* nanos: 0
* ```
*
* ## Import
* ResizeRequest can be imported using any of these accepted formats:
* * `projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/resizeRequests/{{name}}`
* * `{{project}}/{{zone}}/{{instance_group_manager}}/{{name}}`
* * `{{zone}}/{{instance_group_manager}}/{{name}}`
* * `{{instance_group_manager}}/{{name}}`
* When using the `pulumi import` command, ResizeRequest can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/resizeRequest:ResizeRequest default projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/resizeRequests/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/resizeRequest:ResizeRequest default {{project}}/{{zone}}/{{instance_group_manager}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/resizeRequest:ResizeRequest default {{zone}}/{{instance_group_manager}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/resizeRequest:ResizeRequest default {{instance_group_manager}}/{{name}}
* ```
*/
public class ResizeRequest internal constructor(
override val javaResource: com.pulumi.gcp.compute.ResizeRequest,
) : KotlinCustomResource(javaResource, ResizeRequestMapper) {
/**
* The creation timestamp for this resize request in RFC3339 text format.
*/
public val creationTimestamp: Output
get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })
/**
* An optional description of this resize-request.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name of the managed instance group. The name should conform to RFC1035 or be a resource ID.
* Authorization requires the following IAM permission on the specified resource instanceGroupManager:
* *compute.instanceGroupManagers.update
* - - -
*/
public val instanceGroupManager: Output
get() = javaResource.instanceGroupManager().applyValue({ args0 -> args0 })
/**
* The name of this resize request. The name must be 1-63 characters long, and comply with RFC1035.
*/
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 })
/**
* Requested run duration for instances that will be created by this request. At the end of the run duration instance will be deleted.
* Structure is documented below.
*/
public val requestedRunDuration: Output?
get() = javaResource.requestedRunDuration().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> resizeRequestRequestedRunDurationToKotlin(args0) })
}).orElse(null)
})
/**
* The number of instances to be created by this resize request. The group's target size will be increased by this number.
*/
public val resizeBy: Output
get() = javaResource.resizeBy().applyValue({ args0 -> args0 })
/**
* [Output only] Current state of the request.
*/
public val state: Output
get() = javaResource.state().applyValue({ args0 -> args0 })
/**
* [Output only] Status of the request.
* Structure is documented below.
*/
public val statuses: Output>
get() = javaResource.statuses().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
resizeRequestStatusToKotlin(args0)
})
})
})
/**
* Name of the compute zone scoping this request. Name should conform to RFC1035.
*/
public val zone: Output
get() = javaResource.zone().applyValue({ args0 -> args0 })
}
public object ResizeRequestMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.ResizeRequest::class == javaResource::class
override fun map(javaResource: Resource): ResizeRequest = ResizeRequest(
javaResource as
com.pulumi.gcp.compute.ResizeRequest,
)
}
/**
* @see [ResizeRequest].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ResizeRequest].
*/
public suspend fun resizeRequest(
name: String,
block: suspend ResizeRequestResourceBuilder.() -> Unit,
): ResizeRequest {
val builder = ResizeRequestResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ResizeRequest].
* @param name The _unique_ name of the resulting resource.
*/
public fun resizeRequest(name: String): ResizeRequest {
val builder = ResizeRequestResourceBuilder()
builder.name(name)
return builder.build()
}