Package com.pulumi.gcp.compute
Class Reservation
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.gcp.compute.Reservation
-
public class Reservation extends com.pulumi.resources.CustomResource
Represents a reservation resource. A reservation ensures that capacity is held in a specific zone even if the reserved VMs are not running. Reservations apply only to Compute Engine, Cloud Dataproc, and Google Kubernetes Engine VM usage.Reservations do not apply to `f1-micro` or `g1-small` machine types, preemptible VMs, sole tenant nodes, or other services not listed above like Cloud SQL and Dataflow. To get more information about Reservation, see: * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/reservations) * How-to Guides * [Reserving zonal resources](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) ## Example Usage ### Reservation Basic ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.Reservation; import com.pulumi.gcp.compute.ReservationArgs; import com.pulumi.gcp.compute.inputs.ReservationSpecificReservationArgs; import com.pulumi.gcp.compute.inputs.ReservationSpecificReservationInstancePropertiesArgs; 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 gceReservation = new Reservation("gceReservation", ReservationArgs.builder() .specificReservation(ReservationSpecificReservationArgs.builder() .count(1) .instanceProperties(ReservationSpecificReservationInstancePropertiesArgs.builder() .machineType("n2-standard-2") .minCpuPlatform("Intel Cascade Lake") .build()) .build()) .zone("us-central1-a") .build()); } } ``` ## Import Reservation can be imported using any of these accepted formats ```sh $ pulumi import gcp:compute/reservation:Reservation default projects/{{project}}/zones/{{zone}}/reservations/{{name}} ``` ```sh $ pulumi import gcp:compute/reservation:Reservation default {{project}}/{{zone}}/{{name}} ``` ```sh $ pulumi import gcp:compute/reservation:Reservation default {{zone}}/{{name}} ``` ```sh $ pulumi import gcp:compute/reservation:Reservation default {{name}} ```
-
-
Constructor Summary
Constructors Constructor Description Reservation(java.lang.String name)
Reservation(java.lang.String name, ReservationArgs args)
Reservation(java.lang.String name, ReservationArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
commitment()
com.pulumi.core.Output<java.lang.String>
creationTimestamp()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
static Reservation
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ReservationState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
project()
com.pulumi.core.Output<java.lang.String>
selfLink()
com.pulumi.core.Output<ReservationShareSettings>
shareSettings()
com.pulumi.core.Output<ReservationSpecificReservation>
specificReservation()
com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
specificReservationRequired()
com.pulumi.core.Output<java.lang.String>
status()
com.pulumi.core.Output<java.lang.String>
zone()
-
-
-
Constructor Detail
-
Reservation
public Reservation(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
Reservation
public Reservation(java.lang.String name, ReservationArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
Reservation
public Reservation(java.lang.String name, ReservationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
commitment
public com.pulumi.core.Output<java.lang.String> commitment()
- Returns:
- Full or partial URL to a parent commitment. This field displays for reservations that are tied to a commitment.
-
creationTimestamp
public com.pulumi.core.Output<java.lang.String> creationTimestamp()
- Returns:
- Creation timestamp in RFC3339 text format.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- An optional description of this resource.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `a-z?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
-
project
public com.pulumi.core.Output<java.lang.String> project()
- Returns:
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
-
selfLink
public com.pulumi.core.Output<java.lang.String> selfLink()
- Returns:
- The URI of the created resource.
-
shareSettings
public com.pulumi.core.Output<ReservationShareSettings> shareSettings()
- Returns:
- The share setting for reservations. Structure is documented below.
-
specificReservation
public com.pulumi.core.Output<ReservationSpecificReservation> specificReservation()
- Returns:
- Reservation for instances with specific machine shapes. Structure is documented below.
-
specificReservationRequired
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> specificReservationRequired()
- Returns:
- When set to true, only VMs that target this reservation by name can consume this reservation. Otherwise, it can be consumed by VMs with affinity for any reservation. Defaults to false.
-
status
public com.pulumi.core.Output<java.lang.String> status()
- Returns:
- The status of the reservation.
-
zone
public com.pulumi.core.Output<java.lang.String> zone()
- Returns:
- The zone where the reservation is made.
-
get
public static Reservation get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ReservationState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-