Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,25 @@
* </td>
* </tr>
* <tr>
* <td><p> GetHealth</td>
* <td><p> Get health info on a reservation slot.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> getHealthAsync(GetHealthReservationSlotRequest request)
* </ul>
* <p>Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.</p>
* <ul>
* <li><p> getHealthAsync(String project, String zone, String parentName, String reservationSlot)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> getHealthOperationCallable()
* <li><p> getHealthCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> GetVersion</td>
* <td><p> Allows customers to get SBOM versions of a reservation slot.</td>
* <td>
Expand Down Expand Up @@ -343,6 +362,146 @@ public final UnaryCallable<GetReservationSlotRequest, ReservationSlotsGetRespons
return stub.getCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get health info on a reservation slot.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ReservationSlotsClient reservationSlotsClient = ReservationSlotsClient.create()) {
* String project = "project-309310695";
* String zone = "zone3744684";
* String parentName = "parentName-244870571";
* String reservationSlot = "reservationSlot-337781782";
* Operation response =
* reservationSlotsClient.getHealthAsync(project, zone, parentName, reservationSlot).get();
* }
* }</pre>
*
* @param project Project ID for this request.
* @param zone Name of the zone for this request. Zone name should conform to RFC1035.
* @param parentName The name of the parent reservation, parent block and parent sub-block. In the
* format of
* reservations/{reservation_name}/reservationBlocks/{reservation_block_name}/reservationSubBlocks/{reservation_sub_block_name}
* @param reservationSlot The name of the reservation slot. Name should conform to RFC1035 or be a
* resource ID.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Operation, Operation> getHealthAsync(
String project, String zone, String parentName, String reservationSlot) {
GetHealthReservationSlotRequest request =
GetHealthReservationSlotRequest.newBuilder()
.setProject(project)
.setZone(zone)
.setParentName(parentName)
.setReservationSlot(reservationSlot)
.build();
return getHealthAsync(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get health info on a reservation slot.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ReservationSlotsClient reservationSlotsClient = ReservationSlotsClient.create()) {
* GetHealthReservationSlotRequest request =
* GetHealthReservationSlotRequest.newBuilder()
* .setParentName("parentName-244870571")
* .setProject("project-309310695")
* .setRequestId("requestId693933066")
* .setReservationSlot("reservationSlot-337781782")
* .setZone("zone3744684")
* .build();
* Operation response = reservationSlotsClient.getHealthAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Operation, Operation> getHealthAsync(
GetHealthReservationSlotRequest request) {
return getHealthOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get health info on a reservation slot.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ReservationSlotsClient reservationSlotsClient = ReservationSlotsClient.create()) {
* GetHealthReservationSlotRequest request =
* GetHealthReservationSlotRequest.newBuilder()
* .setParentName("parentName-244870571")
* .setProject("project-309310695")
* .setRequestId("requestId693933066")
* .setReservationSlot("reservationSlot-337781782")
* .setZone("zone3744684")
* .build();
* OperationFuture<Operation, Operation> future =
* reservationSlotsClient.getHealthOperationCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final OperationCallable<GetHealthReservationSlotRequest, Operation, Operation>
getHealthOperationCallable() {
return stub.getHealthOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get health info on a reservation slot.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ReservationSlotsClient reservationSlotsClient = ReservationSlotsClient.create()) {
* GetHealthReservationSlotRequest request =
* GetHealthReservationSlotRequest.newBuilder()
* .setParentName("parentName-244870571")
* .setProject("project-309310695")
* .setRequestId("requestId693933066")
* .setReservationSlot("reservationSlot-337781782")
* .setZone("zone3744684")
* .build();
* ApiFuture<Operation> future = reservationSlotsClient.getHealthCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetHealthReservationSlotRequest, Operation> getHealthCallable() {
return stub.getHealthCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Allows customers to get SBOM versions of a reservation slot.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
*
* <p>To configure the RetrySettings of a Long Running Operation method, create an
* OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to
* configure the RetrySettings for getVersion:
* configure the RetrySettings for getHealth:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
Expand Down Expand Up @@ -121,6 +121,17 @@ public UnaryCallSettings<GetReservationSlotRequest, ReservationSlotsGetResponse>
return ((ReservationSlotsStubSettings) getStubSettings()).getSettings();
}

/** Returns the object with the settings used for calls to getHealth. */
public UnaryCallSettings<GetHealthReservationSlotRequest, Operation> getHealthSettings() {
return ((ReservationSlotsStubSettings) getStubSettings()).getHealthSettings();
}

/** Returns the object with the settings used for calls to getHealth. */
public OperationCallSettings<GetHealthReservationSlotRequest, Operation, Operation>
getHealthOperationSettings() {
return ((ReservationSlotsStubSettings) getStubSettings()).getHealthOperationSettings();
}

/** Returns the object with the settings used for calls to getVersion. */
public UnaryCallSettings<GetVersionReservationSlotRequest, Operation> getVersionSettings() {
return ((ReservationSlotsStubSettings) getStubSettings()).getVersionSettings();
Expand Down Expand Up @@ -253,6 +264,18 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().getSettings();
}

/** Returns the builder for the settings used for calls to getHealth. */
public UnaryCallSettings.Builder<GetHealthReservationSlotRequest, Operation>
getHealthSettings() {
return getStubSettingsBuilder().getHealthSettings();
}

/** Returns the builder for the settings used for calls to getHealth. */
public OperationCallSettings.Builder<GetHealthReservationSlotRequest, Operation, Operation>
getHealthOperationSettings() {
return getStubSettingsBuilder().getHealthOperationSettings();
}

/** Returns the builder for the settings used for calls to getVersion. */
public UnaryCallSettings.Builder<GetVersionReservationSlotRequest, Operation>
getVersionSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3091,6 +3091,9 @@
"Get": {
"methods": ["get", "get", "getCallable"]
},
"GetHealth": {
"methods": ["getHealthAsync", "getHealthAsync", "getHealthOperationCallable", "getHealthCallable"]
},
"GetVersion": {
"methods": ["getVersionAsync", "getVersionAsync", "getVersionOperationCallable", "getVersionCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.api.pathtemplate.PathTemplate;
import com.google.cloud.compute.v1.GetHealthReservationSlotRequest;
import com.google.cloud.compute.v1.GetReservationSlotRequest;
import com.google.cloud.compute.v1.GetVersionReservationSlotRequest;
import com.google.cloud.compute.v1.ListReservationSlotsRequest;
Expand Down Expand Up @@ -100,6 +101,59 @@ public class HttpJsonReservationSlotsStub extends ReservationSlotsStub {
.build())
.build();

private static final ApiMethodDescriptor<GetHealthReservationSlotRequest, Operation>
getHealthMethodDescriptor =
ApiMethodDescriptor.<GetHealthReservationSlotRequest, Operation>newBuilder()
.setFullMethodName("google.cloud.compute.v1.ReservationSlots/GetHealth")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.<GetHealthReservationSlotRequest>newBuilder()
.setPath(
"/compute/v1/projects/{project}/zones/{zone}/{parentName=reservations/*/reservationBlocks/*/reservationSubBlocks/*}/reservationSlots/{reservationSlot}/getHealth",
request -> {
Map<String, String> fields = new HashMap<>();
ProtoRestSerializer<GetHealthReservationSlotRequest> serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parentName", request.getParentName());
serializer.putPathParam(fields, "project", request.getProject());
serializer.putPathParam(
fields, "reservationSlot", request.getReservationSlot());
serializer.putPathParam(fields, "zone", request.getZone());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<GetHealthReservationSlotRequest> serializer =
ProtoRestSerializer.create();
if (request.hasRequestId()) {
serializer.putQueryParam(fields, "requestId", request.getRequestId());
}
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(GetHealthReservationSlotRequest request, Operation response) -> {
StringBuilder opName = new StringBuilder(response.getName());
opName.append(":").append(request.getProject());
opName.append(":").append(request.getZone());
return HttpJsonOperationSnapshot.newBuilder()
.setName(opName.toString())
.setMetadata(response)
.setDone(Status.DONE.equals(response.getStatus()))
.setResponse(response)
.setError(response.getHttpErrorStatusCode(), response.getHttpErrorMessage())
.build();
})
.build();

private static final ApiMethodDescriptor<GetVersionReservationSlotRequest, Operation>
getVersionMethodDescriptor =
ApiMethodDescriptor.<GetVersionReservationSlotRequest, Operation>newBuilder()
Expand Down Expand Up @@ -276,6 +330,9 @@ public class HttpJsonReservationSlotsStub extends ReservationSlotsStub {
.build();

private final UnaryCallable<GetReservationSlotRequest, ReservationSlotsGetResponse> getCallable;
private final UnaryCallable<GetHealthReservationSlotRequest, Operation> getHealthCallable;
private final OperationCallable<GetHealthReservationSlotRequest, Operation, Operation>
getHealthOperationCallable;
private final UnaryCallable<GetVersionReservationSlotRequest, Operation> getVersionCallable;
private final OperationCallable<GetVersionReservationSlotRequest, Operation, Operation>
getVersionOperationCallable;
Expand All @@ -293,6 +350,9 @@ public class HttpJsonReservationSlotsStub extends ReservationSlotsStub {
private static final PathTemplate GET_RESOURCE_NAME_TEMPLATE =
PathTemplate.create(
"projects/{project}/zones/{zone}/{parent_name=reservations/*/reservationBlocks/*/reservationSubBlocks/*}/reservationSlots/{reservation_slot}");
private static final PathTemplate GET_HEALTH_RESOURCE_NAME_TEMPLATE =
PathTemplate.create(
"projects/{project}/zones/{zone}/{parent_name=reservations/*/reservationBlocks/*/reservationSubBlocks/*}/reservationSlots/{reservation_slot}");
private static final PathTemplate GET_VERSION_RESOURCE_NAME_TEMPLATE =
PathTemplate.create(
"projects/{project}/zones/{zone}/{parent_name=reservations/*/reservationBlocks/*/reservationSubBlocks/*}/reservationSlots/{reservation_slot}");
Expand Down Expand Up @@ -370,6 +430,30 @@ protected HttpJsonReservationSlotsStub(
return GET_RESOURCE_NAME_TEMPLATE.instantiate(resourceNameSegments);
})
.build();
HttpJsonCallSettings<GetHealthReservationSlotRequest, Operation> getHealthTransportSettings =
HttpJsonCallSettings.<GetHealthReservationSlotRequest, Operation>newBuilder()
.setMethodDescriptor(getHealthMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent_name", String.valueOf(request.getParentName()));
builder.add("project", String.valueOf(request.getProject()));
builder.add("reservation_slot", String.valueOf(request.getReservationSlot()));
builder.add("zone", String.valueOf(request.getZone()));
return builder.build();
})
.setResourceNameExtractor(
request -> {
Map<String, String> resourceNameSegments = new HashMap<String, String>();
resourceNameSegments.put("parent_name", String.valueOf(request.getParentName()));
resourceNameSegments.put("project", String.valueOf(request.getProject()));
resourceNameSegments.put(
"reservation_slot", String.valueOf(request.getReservationSlot()));
resourceNameSegments.put("zone", String.valueOf(request.getZone()));
return GET_HEALTH_RESOURCE_NAME_TEMPLATE.instantiate(resourceNameSegments);
})
.build();
HttpJsonCallSettings<GetVersionReservationSlotRequest, Operation> getVersionTransportSettings =
HttpJsonCallSettings.<GetVersionReservationSlotRequest, Operation>newBuilder()
.setMethodDescriptor(getVersionMethodDescriptor)
Expand Down Expand Up @@ -446,6 +530,15 @@ protected HttpJsonReservationSlotsStub(
this.getCallable =
callableFactory.createUnaryCallable(
getTransportSettings, settings.getSettings(), clientContext);
this.getHealthCallable =
callableFactory.createUnaryCallable(
getHealthTransportSettings, settings.getHealthSettings(), clientContext);
this.getHealthOperationCallable =
callableFactory.createOperationCallable(
getHealthTransportSettings,
settings.getHealthOperationSettings(),
clientContext,
httpJsonOperationsStub);
this.getVersionCallable =
callableFactory.createUnaryCallable(
getVersionTransportSettings, settings.getVersionSettings(), clientContext);
Expand Down Expand Up @@ -479,6 +572,7 @@ protected HttpJsonReservationSlotsStub(
public static List<ApiMethodDescriptor> getMethodDescriptors() {
List<ApiMethodDescriptor> methodDescriptors = new ArrayList<>();
methodDescriptors.add(getMethodDescriptor);
methodDescriptors.add(getHealthMethodDescriptor);
methodDescriptors.add(getVersionMethodDescriptor);
methodDescriptors.add(listMethodDescriptor);
methodDescriptors.add(updateMethodDescriptor);
Expand All @@ -490,6 +584,17 @@ public UnaryCallable<GetReservationSlotRequest, ReservationSlotsGetResponse> get
return getCallable;
}

@Override
public UnaryCallable<GetHealthReservationSlotRequest, Operation> getHealthCallable() {
return getHealthCallable;
}

@Override
public OperationCallable<GetHealthReservationSlotRequest, Operation, Operation>
getHealthOperationCallable() {
return getHealthOperationCallable;
}

@Override
public UnaryCallable<GetVersionReservationSlotRequest, Operation> getVersionCallable() {
return getVersionCallable;
Expand Down
Loading
Loading