com.google.cloud.baremetalsolution.v2.stub.HttpJsonBareMetalSolutionStub Maven / Gradle / Ivy
Show all versions of google-cloud-bare-metal-solution Show documentation
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.baremetalsolution.v2.stub;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListInstancesPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListLocationsPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListLunsPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListNetworksPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListNfsSharesPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListOSImagesPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListProvisioningQuotasPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListSSHKeysPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListVolumeSnapshotsPagedResponse;
import static com.google.cloud.baremetalsolution.v2.BareMetalSolutionClient.ListVolumesPagedResponse;
import com.google.api.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.httpjson.ApiMethodDescriptor;
import com.google.api.gax.httpjson.HttpJsonCallSettings;
import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
import com.google.api.gax.httpjson.ProtoMessageResponseParser;
import com.google.api.gax.httpjson.ProtoRestSerializer;
import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.baremetalsolution.v2.CreateNfsShareRequest;
import com.google.cloud.baremetalsolution.v2.CreateProvisioningConfigRequest;
import com.google.cloud.baremetalsolution.v2.CreateSSHKeyRequest;
import com.google.cloud.baremetalsolution.v2.CreateVolumeSnapshotRequest;
import com.google.cloud.baremetalsolution.v2.DeleteNfsShareRequest;
import com.google.cloud.baremetalsolution.v2.DeleteSSHKeyRequest;
import com.google.cloud.baremetalsolution.v2.DeleteVolumeSnapshotRequest;
import com.google.cloud.baremetalsolution.v2.DetachLunRequest;
import com.google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleRequest;
import com.google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleResponse;
import com.google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleRequest;
import com.google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleResponse;
import com.google.cloud.baremetalsolution.v2.EvictLunRequest;
import com.google.cloud.baremetalsolution.v2.EvictVolumeRequest;
import com.google.cloud.baremetalsolution.v2.GetInstanceRequest;
import com.google.cloud.baremetalsolution.v2.GetLunRequest;
import com.google.cloud.baremetalsolution.v2.GetNetworkRequest;
import com.google.cloud.baremetalsolution.v2.GetNfsShareRequest;
import com.google.cloud.baremetalsolution.v2.GetProvisioningConfigRequest;
import com.google.cloud.baremetalsolution.v2.GetVolumeRequest;
import com.google.cloud.baremetalsolution.v2.GetVolumeSnapshotRequest;
import com.google.cloud.baremetalsolution.v2.Instance;
import com.google.cloud.baremetalsolution.v2.ListInstancesRequest;
import com.google.cloud.baremetalsolution.v2.ListInstancesResponse;
import com.google.cloud.baremetalsolution.v2.ListLunsRequest;
import com.google.cloud.baremetalsolution.v2.ListLunsResponse;
import com.google.cloud.baremetalsolution.v2.ListNetworkUsageRequest;
import com.google.cloud.baremetalsolution.v2.ListNetworkUsageResponse;
import com.google.cloud.baremetalsolution.v2.ListNetworksRequest;
import com.google.cloud.baremetalsolution.v2.ListNetworksResponse;
import com.google.cloud.baremetalsolution.v2.ListNfsSharesRequest;
import com.google.cloud.baremetalsolution.v2.ListNfsSharesResponse;
import com.google.cloud.baremetalsolution.v2.ListOSImagesRequest;
import com.google.cloud.baremetalsolution.v2.ListOSImagesResponse;
import com.google.cloud.baremetalsolution.v2.ListProvisioningQuotasRequest;
import com.google.cloud.baremetalsolution.v2.ListProvisioningQuotasResponse;
import com.google.cloud.baremetalsolution.v2.ListSSHKeysRequest;
import com.google.cloud.baremetalsolution.v2.ListSSHKeysResponse;
import com.google.cloud.baremetalsolution.v2.ListVolumeSnapshotsRequest;
import com.google.cloud.baremetalsolution.v2.ListVolumeSnapshotsResponse;
import com.google.cloud.baremetalsolution.v2.ListVolumesRequest;
import com.google.cloud.baremetalsolution.v2.ListVolumesResponse;
import com.google.cloud.baremetalsolution.v2.Lun;
import com.google.cloud.baremetalsolution.v2.Network;
import com.google.cloud.baremetalsolution.v2.NfsShare;
import com.google.cloud.baremetalsolution.v2.OperationMetadata;
import com.google.cloud.baremetalsolution.v2.ProvisioningConfig;
import com.google.cloud.baremetalsolution.v2.RenameInstanceRequest;
import com.google.cloud.baremetalsolution.v2.RenameNetworkRequest;
import com.google.cloud.baremetalsolution.v2.RenameNfsShareRequest;
import com.google.cloud.baremetalsolution.v2.RenameVolumeRequest;
import com.google.cloud.baremetalsolution.v2.ResetInstanceRequest;
import com.google.cloud.baremetalsolution.v2.ResetInstanceResponse;
import com.google.cloud.baremetalsolution.v2.ResizeVolumeRequest;
import com.google.cloud.baremetalsolution.v2.RestoreVolumeSnapshotRequest;
import com.google.cloud.baremetalsolution.v2.SSHKey;
import com.google.cloud.baremetalsolution.v2.StartInstanceRequest;
import com.google.cloud.baremetalsolution.v2.StartInstanceResponse;
import com.google.cloud.baremetalsolution.v2.StopInstanceRequest;
import com.google.cloud.baremetalsolution.v2.StopInstanceResponse;
import com.google.cloud.baremetalsolution.v2.SubmitProvisioningConfigRequest;
import com.google.cloud.baremetalsolution.v2.SubmitProvisioningConfigResponse;
import com.google.cloud.baremetalsolution.v2.UpdateInstanceRequest;
import com.google.cloud.baremetalsolution.v2.UpdateNetworkRequest;
import com.google.cloud.baremetalsolution.v2.UpdateNfsShareRequest;
import com.google.cloud.baremetalsolution.v2.UpdateProvisioningConfigRequest;
import com.google.cloud.baremetalsolution.v2.UpdateVolumeRequest;
import com.google.cloud.baremetalsolution.v2.Volume;
import com.google.cloud.baremetalsolution.v2.VolumeSnapshot;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.TypeRegistry;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* REST stub implementation for the BareMetalSolution service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class HttpJsonBareMetalSolutionStub extends BareMetalSolutionStub {
private static final TypeRegistry typeRegistry =
TypeRegistry.newBuilder()
.add(StartInstanceResponse.getDescriptor())
.add(ResetInstanceResponse.getDescriptor())
.add(Empty.getDescriptor())
.add(Volume.getDescriptor())
.add(StopInstanceResponse.getDescriptor())
.add(EnableInteractiveSerialConsoleResponse.getDescriptor())
.add(NfsShare.getDescriptor())
.add(OperationMetadata.getDescriptor())
.add(VolumeSnapshot.getDescriptor())
.add(Instance.getDescriptor())
.add(DisableInteractiveSerialConsoleResponse.getDescriptor())
.add(Network.getDescriptor())
.build();
private static final ApiMethodDescriptor
listInstancesMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/ListInstances")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*}/instances",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListInstancesResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
getInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/GetInstance")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/instances/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Instance.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
updateInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/UpdateInstance")
.setHttpMethod("PATCH")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{instance.name=projects/*/locations/*/instances/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(
fields, "instance.name", request.getInstance().getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("instance", request.getInstance(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(UpdateInstanceRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
renameInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/RenameInstance")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/instances/*}:rename",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Instance.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
resetInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/ResetInstance")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/instances/*}:reset",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(ResetInstanceRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
startInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/StartInstance")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/instances/*}:start",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(StartInstanceRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
stopInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/StopInstance")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/instances/*}:stop",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(StopInstanceRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
enableInteractiveSerialConsoleMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/EnableInteractiveSerialConsole")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/instances/*}:enableInteractiveSerialConsole",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(EnableInteractiveSerialConsoleRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
disableInteractiveSerialConsoleMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/DisableInteractiveSerialConsole")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/instances/*}:disableInteractiveSerialConsole",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(DisableInteractiveSerialConsoleRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor detachLunMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/DetachLun")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{instance=projects/*/locations/*/instances/*}:detachLun",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "instance", request.getInstance());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearInstance().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(DetachLunRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
listSSHKeysMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/ListSSHKeys")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*}/sshKeys",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListSSHKeysResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
createSSHKeyMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/CreateSSHKey")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*}/sshKeys",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "sshKeyId", request.getSshKeyId());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("sshKey", request.getSshKey(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(SSHKey.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
deleteSSHKeyMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/DeleteSSHKey")
.setHttpMethod("DELETE")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/sshKeys/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Empty.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
listVolumesMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/ListVolumes")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*}/volumes",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListVolumesResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor getVolumeMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/GetVolume")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/volumes/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Volume.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
updateVolumeMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/UpdateVolume")
.setHttpMethod("PATCH")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{volume.name=projects/*/locations/*/volumes/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(
fields, "volume.name", request.getVolume().getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("volume", request.getVolume(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(UpdateVolumeRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
renameVolumeMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/RenameVolume")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/volumes/*}:rename",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Volume.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
evictVolumeMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/EvictVolume")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/volumes/*}:evict",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(EvictVolumeRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
resizeVolumeMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/ResizeVolume")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{volume=projects/*/locations/*/volumes/*}:resize",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "volume", request.getVolume());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearVolume().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(ResizeVolumeRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
listNetworksMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/ListNetworks")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*}/networks",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListNetworksResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
listNetworkUsageMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/ListNetworkUsage")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{location=projects/*/locations/*}/networks:listNetworkUsage",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "location", request.getLocation());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListNetworkUsageResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor getNetworkMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/GetNetwork")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/networks/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Network.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
updateNetworkMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/UpdateNetwork")
.setHttpMethod("PATCH")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{network.name=projects/*/locations/*/networks/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(
fields, "network.name", request.getNetwork().getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("network", request.getNetwork(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(UpdateNetworkRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
createVolumeSnapshotMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/CreateVolumeSnapshot")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*/volumes/*}/snapshots",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("volumeSnapshot", request.getVolumeSnapshot(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(VolumeSnapshot.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
restoreVolumeSnapshotMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/RestoreVolumeSnapshot")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{volumeSnapshot=projects/*/locations/*/volumes/*/snapshots/*}:restoreVolumeSnapshot",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(
fields, "volumeSnapshot", request.getVolumeSnapshot());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody(
"*", request.toBuilder().clearVolumeSnapshot().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(RestoreVolumeSnapshotRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
deleteVolumeSnapshotMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/DeleteVolumeSnapshot")
.setHttpMethod("DELETE")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/volumes/*/snapshots/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Empty.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
getVolumeSnapshotMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/GetVolumeSnapshot")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/volumes/*/snapshots/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(VolumeSnapshot.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
listVolumeSnapshotsMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.cloud.baremetalsolution.v2.BareMetalSolution/ListVolumeSnapshots")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*/volumes/*}/snapshots",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListVolumeSnapshotsResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor getLunMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/GetLun")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/volumes/*/luns/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Lun.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
listLunsMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/ListLuns")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{parent=projects/*/locations/*/volumes/*}/luns",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListLunsResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor evictLunMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.cloud.baremetalsolution.v2.BareMetalSolution/EvictLun")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v2/{name=projects/*/locations/*/volumes/*/luns/*}:evict",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(EvictLunRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
getNfsShareMethodDescriptor =
ApiMethodDescriptor.