All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.datastream.v1.stub.HttpJsonDatastreamStub Maven / Gradle / Ivy

Go to download

Datastream is a serverless and easy-to-use change data capture (CDC) and replication service. It allows you to synchronize data across heterogeneous databases and applications reliably, and with minimal latency and downtime.

There is a newer version: 1.53.0
Show newest version
/*
 * 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.datastream.v1.stub;

import static com.google.cloud.datastream.v1.DatastreamClient.FetchStaticIpsPagedResponse;
import static com.google.cloud.datastream.v1.DatastreamClient.ListConnectionProfilesPagedResponse;
import static com.google.cloud.datastream.v1.DatastreamClient.ListLocationsPagedResponse;
import static com.google.cloud.datastream.v1.DatastreamClient.ListPrivateConnectionsPagedResponse;
import static com.google.cloud.datastream.v1.DatastreamClient.ListRoutesPagedResponse;
import static com.google.cloud.datastream.v1.DatastreamClient.ListStreamObjectsPagedResponse;
import static com.google.cloud.datastream.v1.DatastreamClient.ListStreamsPagedResponse;

import com.google.api.HttpRule;
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.datastream.v1.ConnectionProfile;
import com.google.cloud.datastream.v1.CreateConnectionProfileRequest;
import com.google.cloud.datastream.v1.CreatePrivateConnectionRequest;
import com.google.cloud.datastream.v1.CreateRouteRequest;
import com.google.cloud.datastream.v1.CreateStreamRequest;
import com.google.cloud.datastream.v1.DeleteConnectionProfileRequest;
import com.google.cloud.datastream.v1.DeletePrivateConnectionRequest;
import com.google.cloud.datastream.v1.DeleteRouteRequest;
import com.google.cloud.datastream.v1.DeleteStreamRequest;
import com.google.cloud.datastream.v1.DiscoverConnectionProfileRequest;
import com.google.cloud.datastream.v1.DiscoverConnectionProfileResponse;
import com.google.cloud.datastream.v1.FetchStaticIpsRequest;
import com.google.cloud.datastream.v1.FetchStaticIpsResponse;
import com.google.cloud.datastream.v1.GetConnectionProfileRequest;
import com.google.cloud.datastream.v1.GetPrivateConnectionRequest;
import com.google.cloud.datastream.v1.GetRouteRequest;
import com.google.cloud.datastream.v1.GetStreamObjectRequest;
import com.google.cloud.datastream.v1.GetStreamRequest;
import com.google.cloud.datastream.v1.ListConnectionProfilesRequest;
import com.google.cloud.datastream.v1.ListConnectionProfilesResponse;
import com.google.cloud.datastream.v1.ListPrivateConnectionsRequest;
import com.google.cloud.datastream.v1.ListPrivateConnectionsResponse;
import com.google.cloud.datastream.v1.ListRoutesRequest;
import com.google.cloud.datastream.v1.ListRoutesResponse;
import com.google.cloud.datastream.v1.ListStreamObjectsRequest;
import com.google.cloud.datastream.v1.ListStreamObjectsResponse;
import com.google.cloud.datastream.v1.ListStreamsRequest;
import com.google.cloud.datastream.v1.ListStreamsResponse;
import com.google.cloud.datastream.v1.LookupStreamObjectRequest;
import com.google.cloud.datastream.v1.OperationMetadata;
import com.google.cloud.datastream.v1.PrivateConnection;
import com.google.cloud.datastream.v1.Route;
import com.google.cloud.datastream.v1.StartBackfillJobRequest;
import com.google.cloud.datastream.v1.StartBackfillJobResponse;
import com.google.cloud.datastream.v1.StopBackfillJobRequest;
import com.google.cloud.datastream.v1.StopBackfillJobResponse;
import com.google.cloud.datastream.v1.Stream;
import com.google.cloud.datastream.v1.StreamObject;
import com.google.cloud.datastream.v1.UpdateConnectionProfileRequest;
import com.google.cloud.datastream.v1.UpdateStreamRequest;
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.common.collect.ImmutableMap;
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 Datastream service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class HttpJsonDatastreamStub extends DatastreamStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() .add(Empty.getDescriptor()) .add(ConnectionProfile.getDescriptor()) .add(OperationMetadata.getDescriptor()) .add(Route.getDescriptor()) .add(PrivateConnection.getDescriptor()) .add(Stream.getDescriptor()) .build(); private static final ApiMethodDescriptor< ListConnectionProfilesRequest, ListConnectionProfilesResponse> listConnectionProfilesMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/ListConnectionProfiles") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/connectionProfiles", 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, "orderBy", request.getOrderBy()); 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(ListConnectionProfilesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getConnectionProfileMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/GetConnectionProfile") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/connectionProfiles/*}", 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(ConnectionProfile.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createConnectionProfileMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/CreateConnectionProfile") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/connectionProfiles", 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, "connectionProfileId", request.getConnectionProfileId()); serializer.putQueryParam(fields, "force", request.getForce()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody( "connectionProfile", request.getConnectionProfile(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateConnectionProfileRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateConnectionProfileMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/UpdateConnectionProfile") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{connectionProfile.name=projects/*/locations/*/connectionProfiles/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "connectionProfile.name", request.getConnectionProfile().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "force", request.getForce()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody( "connectionProfile", request.getConnectionProfile(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateConnectionProfileRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteConnectionProfileMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/DeleteConnectionProfile") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/connectionProfiles/*}", 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, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteConnectionProfileRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor< DiscoverConnectionProfileRequest, DiscoverConnectionProfileResponse> discoverConnectionProfileMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/DiscoverConnectionProfile") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/connectionProfiles:discover", 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("*", request.toBuilder().clearParent().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(DiscoverConnectionProfileResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listStreamsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/ListStreams") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/streams", 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, "orderBy", request.getOrderBy()); 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(ListStreamsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getStreamMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/GetStream") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/streams/*}", 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(Stream.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createStreamMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/CreateStream") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/streams", 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, "force", request.getForce()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "streamId", request.getStreamId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("stream", request.getStream(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateStreamRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateStreamMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/UpdateStream") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{stream.name=projects/*/locations/*/streams/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "stream.name", request.getStream().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "force", request.getForce()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("stream", request.getStream(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateStreamRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteStreamMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/DeleteStream") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/streams/*}", 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, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteStreamRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor getStreamObjectMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/GetStreamObject") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/streams/*/objects/*}", 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(StreamObject.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor lookupStreamObjectMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/LookupStreamObject") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/streams/*}/objects:lookup", 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("*", request.toBuilder().clearParent().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(StreamObject.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listStreamObjectsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/ListStreamObjects") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/streams/*}/objects", 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(ListStreamObjectsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor startBackfillJobMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/StartBackfillJob") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{object=projects/*/locations/*/streams/*/objects/*}:startBackfillJob", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "object", request.getObject()); 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().clearObject().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(StartBackfillJobResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor stopBackfillJobMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/StopBackfillJob") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{object=projects/*/locations/*/streams/*/objects/*}:stopBackfillJob", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "object", request.getObject()); 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().clearObject().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(StopBackfillJobResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor fetchStaticIpsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/FetchStaticIps") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*}:fetchStaticIps", 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, "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(FetchStaticIpsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createPrivateConnectionMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/CreatePrivateConnection") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/privateConnections", 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, "force", request.getForce()); serializer.putQueryParam( fields, "privateConnectionId", request.getPrivateConnectionId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody( "privateConnection", request.getPrivateConnection(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreatePrivateConnectionRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor getPrivateConnectionMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/GetPrivateConnection") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/privateConnections/*}", 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(PrivateConnection.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< ListPrivateConnectionsRequest, ListPrivateConnectionsResponse> listPrivateConnectionsMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/ListPrivateConnections") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/privateConnections", 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, "orderBy", request.getOrderBy()); 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(ListPrivateConnectionsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deletePrivateConnectionMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/DeletePrivateConnection") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/privateConnections/*}", 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, "force", request.getForce()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeletePrivateConnectionRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor createRouteMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/CreateRoute") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes", 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, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "routeId", request.getRouteId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("route", request.getRoute(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateRouteRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor getRouteMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/GetRoute") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}", 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(Route.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listRoutesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/ListRoutes") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes", 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, "orderBy", request.getOrderBy()); 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(ListRoutesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteRouteMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.datastream.v1.Datastream/DeleteRoute") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}", 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, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteRouteRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor listLocationsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.location.Locations/ListLocations") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*}/locations", 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(ListLocationsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getLocationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.location.Locations/GetLocation") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*}", 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(Location.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private final UnaryCallable listConnectionProfilesCallable; private final UnaryCallable listConnectionProfilesPagedCallable; private final UnaryCallable getConnectionProfileCallable; private final UnaryCallable createConnectionProfileCallable; private final OperationCallable< CreateConnectionProfileRequest, ConnectionProfile, OperationMetadata> createConnectionProfileOperationCallable; private final UnaryCallable updateConnectionProfileCallable; private final OperationCallable< UpdateConnectionProfileRequest, ConnectionProfile, OperationMetadata> updateConnectionProfileOperationCallable; private final UnaryCallable deleteConnectionProfileCallable; private final OperationCallable deleteConnectionProfileOperationCallable; private final UnaryCallable discoverConnectionProfileCallable; private final UnaryCallable listStreamsCallable; private final UnaryCallable listStreamsPagedCallable; private final UnaryCallable getStreamCallable; private final UnaryCallable createStreamCallable; private final OperationCallable createStreamOperationCallable; private final UnaryCallable updateStreamCallable; private final OperationCallable updateStreamOperationCallable; private final UnaryCallable deleteStreamCallable; private final OperationCallable deleteStreamOperationCallable; private final UnaryCallable getStreamObjectCallable; private final UnaryCallable lookupStreamObjectCallable; private final UnaryCallable listStreamObjectsCallable; private final UnaryCallable listStreamObjectsPagedCallable; private final UnaryCallable startBackfillJobCallable; private final UnaryCallable stopBackfillJobCallable; private final UnaryCallable fetchStaticIpsCallable; private final UnaryCallable fetchStaticIpsPagedCallable; private final UnaryCallable createPrivateConnectionCallable; private final OperationCallable< CreatePrivateConnectionRequest, PrivateConnection, OperationMetadata> createPrivateConnectionOperationCallable; private final UnaryCallable getPrivateConnectionCallable; private final UnaryCallable listPrivateConnectionsCallable; private final UnaryCallable listPrivateConnectionsPagedCallable; private final UnaryCallable deletePrivateConnectionCallable; private final OperationCallable deletePrivateConnectionOperationCallable; private final UnaryCallable createRouteCallable; private final OperationCallable createRouteOperationCallable; private final UnaryCallable getRouteCallable; private final UnaryCallable listRoutesCallable; private final UnaryCallable listRoutesPagedCallable; private final UnaryCallable deleteRouteCallable; private final OperationCallable deleteRouteOperationCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; private final HttpJsonStubCallableFactory callableFactory; public static final HttpJsonDatastreamStub create(DatastreamStubSettings settings) throws IOException { return new HttpJsonDatastreamStub(settings, ClientContext.create(settings)); } public static final HttpJsonDatastreamStub create(ClientContext clientContext) throws IOException { return new HttpJsonDatastreamStub( DatastreamStubSettings.newHttpJsonBuilder().build(), clientContext); } public static final HttpJsonDatastreamStub create( ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { return new HttpJsonDatastreamStub( DatastreamStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of HttpJsonDatastreamStub, using the given settings. This is protected * so that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected HttpJsonDatastreamStub(DatastreamStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new HttpJsonDatastreamCallableFactory()); } /** * Constructs an instance of HttpJsonDatastreamStub, using the given settings. This is protected * so that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected HttpJsonDatastreamStub( DatastreamStubSettings settings, ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.httpJsonOperationsStub = HttpJsonOperationsStub.create( clientContext, callableFactory, typeRegistry, ImmutableMap.builder() .put( "google.longrunning.Operations.CancelOperation", HttpRule.newBuilder() .setPost("/v1/{name=projects/*/locations/*/operations/*}:cancel") .build()) .put( "google.longrunning.Operations.DeleteOperation", HttpRule.newBuilder() .setDelete("/v1/{name=projects/*/locations/*/operations/*}") .build()) .put( "google.longrunning.Operations.GetOperation", HttpRule.newBuilder() .setGet("/v1/{name=projects/*/locations/*/operations/*}") .build()) .put( "google.longrunning.Operations.ListOperations", HttpRule.newBuilder() .setGet("/v1/{name=projects/*/locations/*}/operations") .build()) .build()); HttpJsonCallSettings listConnectionProfilesTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(listConnectionProfilesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getConnectionProfileTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getConnectionProfileMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createConnectionProfileTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createConnectionProfileMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateConnectionProfileTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateConnectionProfileMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "connection_profile.name", String.valueOf(request.getConnectionProfile().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteConnectionProfileTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteConnectionProfileMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings discoverConnectionProfileTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(discoverConnectionProfileMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listStreamsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listStreamsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getStreamTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getStreamMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createStreamTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createStreamMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateStreamTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateStreamMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("stream.name", String.valueOf(request.getStream().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteStreamTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteStreamMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getStreamObjectTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getStreamObjectMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings lookupStreamObjectTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(lookupStreamObjectMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listStreamObjectsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listStreamObjectsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings startBackfillJobTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(startBackfillJobMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("object", String.valueOf(request.getObject())); return builder.build(); }) .build(); HttpJsonCallSettings stopBackfillJobTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(stopBackfillJobMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("object", String.valueOf(request.getObject())); return builder.build(); }) .build(); HttpJsonCallSettings fetchStaticIpsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(fetchStaticIpsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createPrivateConnectionTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createPrivateConnectionMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getPrivateConnectionTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getPrivateConnectionMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listPrivateConnectionsTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(listPrivateConnectionsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings deletePrivateConnectionTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deletePrivateConnectionMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createRouteTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createRouteMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getRouteTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getRouteMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listRoutesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listRoutesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings deleteRouteTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteRouteMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listLocationsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listLocationsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getLocationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getLocationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.listConnectionProfilesCallable = callableFactory.createUnaryCallable( listConnectionProfilesTransportSettings, settings.listConnectionProfilesSettings(), clientContext); this.listConnectionProfilesPagedCallable = callableFactory.createPagedCallable( listConnectionProfilesTransportSettings, settings.listConnectionProfilesSettings(), clientContext); this.getConnectionProfileCallable = callableFactory.createUnaryCallable( getConnectionProfileTransportSettings, settings.getConnectionProfileSettings(), clientContext); this.createConnectionProfileCallable = callableFactory.createUnaryCallable( createConnectionProfileTransportSettings, settings.createConnectionProfileSettings(), clientContext); this.createConnectionProfileOperationCallable = callableFactory.createOperationCallable( createConnectionProfileTransportSettings, settings.createConnectionProfileOperationSettings(), clientContext, httpJsonOperationsStub); this.updateConnectionProfileCallable = callableFactory.createUnaryCallable( updateConnectionProfileTransportSettings, settings.updateConnectionProfileSettings(), clientContext); this.updateConnectionProfileOperationCallable = callableFactory.createOperationCallable( updateConnectionProfileTransportSettings, settings.updateConnectionProfileOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteConnectionProfileCallable = callableFactory.createUnaryCallable( deleteConnectionProfileTransportSettings, settings.deleteConnectionProfileSettings(), clientContext); this.deleteConnectionProfileOperationCallable = callableFactory.createOperationCallable( deleteConnectionProfileTransportSettings, settings.deleteConnectionProfileOperationSettings(), clientContext, httpJsonOperationsStub); this.discoverConnectionProfileCallable = callableFactory.createUnaryCallable( discoverConnectionProfileTransportSettings, settings.discoverConnectionProfileSettings(), clientContext); this.listStreamsCallable = callableFactory.createUnaryCallable( listStreamsTransportSettings, settings.listStreamsSettings(), clientContext); this.listStreamsPagedCallable = callableFactory.createPagedCallable( listStreamsTransportSettings, settings.listStreamsSettings(), clientContext); this.getStreamCallable = callableFactory.createUnaryCallable( getStreamTransportSettings, settings.getStreamSettings(), clientContext); this.createStreamCallable = callableFactory.createUnaryCallable( createStreamTransportSettings, settings.createStreamSettings(), clientContext); this.createStreamOperationCallable = callableFactory.createOperationCallable( createStreamTransportSettings, settings.createStreamOperationSettings(), clientContext, httpJsonOperationsStub); this.updateStreamCallable = callableFactory.createUnaryCallable( updateStreamTransportSettings, settings.updateStreamSettings(), clientContext); this.updateStreamOperationCallable = callableFactory.createOperationCallable( updateStreamTransportSettings, settings.updateStreamOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteStreamCallable = callableFactory.createUnaryCallable( deleteStreamTransportSettings, settings.deleteStreamSettings(), clientContext); this.deleteStreamOperationCallable = callableFactory.createOperationCallable( deleteStreamTransportSettings, settings.deleteStreamOperationSettings(), clientContext, httpJsonOperationsStub); this.getStreamObjectCallable = callableFactory.createUnaryCallable( getStreamObjectTransportSettings, settings.getStreamObjectSettings(), clientContext); this.lookupStreamObjectCallable = callableFactory.createUnaryCallable( lookupStreamObjectTransportSettings, settings.lookupStreamObjectSettings(), clientContext); this.listStreamObjectsCallable = callableFactory.createUnaryCallable( listStreamObjectsTransportSettings, settings.listStreamObjectsSettings(), clientContext); this.listStreamObjectsPagedCallable = callableFactory.createPagedCallable( listStreamObjectsTransportSettings, settings.listStreamObjectsSettings(), clientContext); this.startBackfillJobCallable = callableFactory.createUnaryCallable( startBackfillJobTransportSettings, settings.startBackfillJobSettings(), clientContext); this.stopBackfillJobCallable = callableFactory.createUnaryCallable( stopBackfillJobTransportSettings, settings.stopBackfillJobSettings(), clientContext); this.fetchStaticIpsCallable = callableFactory.createUnaryCallable( fetchStaticIpsTransportSettings, settings.fetchStaticIpsSettings(), clientContext); this.fetchStaticIpsPagedCallable = callableFactory.createPagedCallable( fetchStaticIpsTransportSettings, settings.fetchStaticIpsSettings(), clientContext); this.createPrivateConnectionCallable = callableFactory.createUnaryCallable( createPrivateConnectionTransportSettings, settings.createPrivateConnectionSettings(), clientContext); this.createPrivateConnectionOperationCallable = callableFactory.createOperationCallable( createPrivateConnectionTransportSettings, settings.createPrivateConnectionOperationSettings(), clientContext, httpJsonOperationsStub); this.getPrivateConnectionCallable = callableFactory.createUnaryCallable( getPrivateConnectionTransportSettings, settings.getPrivateConnectionSettings(), clientContext); this.listPrivateConnectionsCallable = callableFactory.createUnaryCallable( listPrivateConnectionsTransportSettings, settings.listPrivateConnectionsSettings(), clientContext); this.listPrivateConnectionsPagedCallable = callableFactory.createPagedCallable( listPrivateConnectionsTransportSettings, settings.listPrivateConnectionsSettings(), clientContext); this.deletePrivateConnectionCallable = callableFactory.createUnaryCallable( deletePrivateConnectionTransportSettings, settings.deletePrivateConnectionSettings(), clientContext); this.deletePrivateConnectionOperationCallable = callableFactory.createOperationCallable( deletePrivateConnectionTransportSettings, settings.deletePrivateConnectionOperationSettings(), clientContext, httpJsonOperationsStub); this.createRouteCallable = callableFactory.createUnaryCallable( createRouteTransportSettings, settings.createRouteSettings(), clientContext); this.createRouteOperationCallable = callableFactory.createOperationCallable( createRouteTransportSettings, settings.createRouteOperationSettings(), clientContext, httpJsonOperationsStub); this.getRouteCallable = callableFactory.createUnaryCallable( getRouteTransportSettings, settings.getRouteSettings(), clientContext); this.listRoutesCallable = callableFactory.createUnaryCallable( listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); this.listRoutesPagedCallable = callableFactory.createPagedCallable( listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); this.deleteRouteCallable = callableFactory.createUnaryCallable( deleteRouteTransportSettings, settings.deleteRouteSettings(), clientContext); this.deleteRouteOperationCallable = callableFactory.createOperationCallable( deleteRouteTransportSettings, settings.deleteRouteOperationSettings(), clientContext, httpJsonOperationsStub); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.listLocationsPagedCallable = callableFactory.createPagedCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.getLocationCallable = callableFactory.createUnaryCallable( getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @InternalApi public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(listConnectionProfilesMethodDescriptor); methodDescriptors.add(getConnectionProfileMethodDescriptor); methodDescriptors.add(createConnectionProfileMethodDescriptor); methodDescriptors.add(updateConnectionProfileMethodDescriptor); methodDescriptors.add(deleteConnectionProfileMethodDescriptor); methodDescriptors.add(discoverConnectionProfileMethodDescriptor); methodDescriptors.add(listStreamsMethodDescriptor); methodDescriptors.add(getStreamMethodDescriptor); methodDescriptors.add(createStreamMethodDescriptor); methodDescriptors.add(updateStreamMethodDescriptor); methodDescriptors.add(deleteStreamMethodDescriptor); methodDescriptors.add(getStreamObjectMethodDescriptor); methodDescriptors.add(lookupStreamObjectMethodDescriptor); methodDescriptors.add(listStreamObjectsMethodDescriptor); methodDescriptors.add(startBackfillJobMethodDescriptor); methodDescriptors.add(stopBackfillJobMethodDescriptor); methodDescriptors.add(fetchStaticIpsMethodDescriptor); methodDescriptors.add(createPrivateConnectionMethodDescriptor); methodDescriptors.add(getPrivateConnectionMethodDescriptor); methodDescriptors.add(listPrivateConnectionsMethodDescriptor); methodDescriptors.add(deletePrivateConnectionMethodDescriptor); methodDescriptors.add(createRouteMethodDescriptor); methodDescriptors.add(getRouteMethodDescriptor); methodDescriptors.add(listRoutesMethodDescriptor); methodDescriptors.add(deleteRouteMethodDescriptor); methodDescriptors.add(listLocationsMethodDescriptor); methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } public HttpJsonOperationsStub getHttpJsonOperationsStub() { return httpJsonOperationsStub; } @Override public UnaryCallable listConnectionProfilesCallable() { return listConnectionProfilesCallable; } @Override public UnaryCallable listConnectionProfilesPagedCallable() { return listConnectionProfilesPagedCallable; } @Override public UnaryCallable getConnectionProfileCallable() { return getConnectionProfileCallable; } @Override public UnaryCallable createConnectionProfileCallable() { return createConnectionProfileCallable; } @Override public OperationCallable createConnectionProfileOperationCallable() { return createConnectionProfileOperationCallable; } @Override public UnaryCallable updateConnectionProfileCallable() { return updateConnectionProfileCallable; } @Override public OperationCallable updateConnectionProfileOperationCallable() { return updateConnectionProfileOperationCallable; } @Override public UnaryCallable deleteConnectionProfileCallable() { return deleteConnectionProfileCallable; } @Override public OperationCallable deleteConnectionProfileOperationCallable() { return deleteConnectionProfileOperationCallable; } @Override public UnaryCallable discoverConnectionProfileCallable() { return discoverConnectionProfileCallable; } @Override public UnaryCallable listStreamsCallable() { return listStreamsCallable; } @Override public UnaryCallable listStreamsPagedCallable() { return listStreamsPagedCallable; } @Override public UnaryCallable getStreamCallable() { return getStreamCallable; } @Override public UnaryCallable createStreamCallable() { return createStreamCallable; } @Override public OperationCallable createStreamOperationCallable() { return createStreamOperationCallable; } @Override public UnaryCallable updateStreamCallable() { return updateStreamCallable; } @Override public OperationCallable updateStreamOperationCallable() { return updateStreamOperationCallable; } @Override public UnaryCallable deleteStreamCallable() { return deleteStreamCallable; } @Override public OperationCallable deleteStreamOperationCallable() { return deleteStreamOperationCallable; } @Override public UnaryCallable getStreamObjectCallable() { return getStreamObjectCallable; } @Override public UnaryCallable lookupStreamObjectCallable() { return lookupStreamObjectCallable; } @Override public UnaryCallable listStreamObjectsCallable() { return listStreamObjectsCallable; } @Override public UnaryCallable listStreamObjectsPagedCallable() { return listStreamObjectsPagedCallable; } @Override public UnaryCallable startBackfillJobCallable() { return startBackfillJobCallable; } @Override public UnaryCallable stopBackfillJobCallable() { return stopBackfillJobCallable; } @Override public UnaryCallable fetchStaticIpsCallable() { return fetchStaticIpsCallable; } @Override public UnaryCallable fetchStaticIpsPagedCallable() { return fetchStaticIpsPagedCallable; } @Override public UnaryCallable createPrivateConnectionCallable() { return createPrivateConnectionCallable; } @Override public OperationCallable createPrivateConnectionOperationCallable() { return createPrivateConnectionOperationCallable; } @Override public UnaryCallable getPrivateConnectionCallable() { return getPrivateConnectionCallable; } @Override public UnaryCallable listPrivateConnectionsCallable() { return listPrivateConnectionsCallable; } @Override public UnaryCallable listPrivateConnectionsPagedCallable() { return listPrivateConnectionsPagedCallable; } @Override public UnaryCallable deletePrivateConnectionCallable() { return deletePrivateConnectionCallable; } @Override public OperationCallable deletePrivateConnectionOperationCallable() { return deletePrivateConnectionOperationCallable; } @Override public UnaryCallable createRouteCallable() { return createRouteCallable; } @Override public OperationCallable createRouteOperationCallable() { return createRouteOperationCallable; } @Override public UnaryCallable getRouteCallable() { return getRouteCallable; } @Override public UnaryCallable listRoutesCallable() { return listRoutesCallable; } @Override public UnaryCallable listRoutesPagedCallable() { return listRoutesPagedCallable; } @Override public UnaryCallable deleteRouteCallable() { return deleteRouteCallable; } @Override public OperationCallable deleteRouteOperationCallable() { return deleteRouteOperationCallable; } @Override public UnaryCallable listLocationsCallable() { return listLocationsCallable; } @Override public UnaryCallable listLocationsPagedCallable() { return listLocationsPagedCallable; } @Override public UnaryCallable getLocationCallable() { return getLocationCallable; } @Override public final void close() { try { backgroundResources.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Failed to close resource", e); } } @Override public void shutdown() { backgroundResources.shutdown(); } @Override public boolean isShutdown() { return backgroundResources.isShutdown(); } @Override public boolean isTerminated() { return backgroundResources.isTerminated(); } @Override public void shutdownNow() { backgroundResources.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return backgroundResources.awaitTermination(duration, unit); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy