@@ -42,6 +42,12 @@ public static void main(String[] args)
4242 // TODO(developer): Replace these variables before running the sample.
4343 // The ID of the project where you want to reserve resources
4444 // and where the instance template exists.
45+ // By default, no projects are allowed to create or modify shared reservations
46+ // in an organization. Add projects to the Shared Reservations Owner Projects
47+ // (compute.sharedReservationsOwnerProjects) organization policy constraint
48+ // to allow them to create and modify shared reservations.
49+ // For more information visit this page:
50+ // https://cloud.google.com/compute/docs/instances/reservations-shared#shared_reservation_constraint
4551 String projectId = "YOUR_PROJECT_ID" ;
4652 // Zone in which the reservation resides.
4753 String zone = "us-central1-a" ;
@@ -68,6 +74,10 @@ public void createSharedReservation(
6874
6975 ShareSettings shareSettings = ShareSettings .newBuilder ()
7076 .setShareType (String .valueOf (ShareSettings .ShareType .SPECIFIC_PROJECTS ))
77+ // The IDs of projects that can consume this reservation. You can include up to 100
78+ // consumer projects. These projects must be in the same organization as
79+ // the owner project. Don't include the owner project. By default, it is already allowed
80+ // to consume the reservation.
7181 .putProjectMap ("CONSUMER_PROJECT_ID_1" , ShareSettingsProjectConfig .newBuilder ().build ())
7282 .putProjectMap ("CONSUMER_PROJECT_ID_2" , ShareSettingsProjectConfig .newBuilder ().build ())
7383 .build ();
0 commit comments