3 * Copyright 2018 gRPC authors.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 import * as grpc from 'grpc';
19 import { GcpChannelFactory } from './gcp_channel_factory';
20 import * as protoRoot from './generated/grpc_gcp';
21 import ApiConfig = protoRoot.grpc.gcp.ApiConfig;
23 * Create ApiConfig proto message from config object.
24 * @param apiDefinition Api object that specifies channel pool configuation.
25 * @return A protobuf message type.
27 export declare function createGcpApiConfig(apiDefinition: {}): ApiConfig;
29 * Function for creating a gcp channel factory.
31 * @param address The address of the server to connect to.
32 * @param credentials Channel credentials to use when connecting
33 * @param options A map of channel options that will be passed to the core.
34 * @return {GcpChannelFactory} A GcpChannelFactory instance.
36 export declare function gcpChannelFactoryOverride(address: string, credentials: grpc.ChannelCredentials, options: {}): GcpChannelFactory;
37 export interface MethodDefinition<RequestType, ResponseType> {
39 requestStream: boolean;
40 responseStream: boolean;
41 requestSerialize: grpc.serialize<RequestType>;
42 responseDeserialize: grpc.deserialize<ResponseType>;
44 export interface InputCallProperties<RequestType, ResponseType> {
46 metadata: grpc.Metadata;
47 call: grpc.ClientUnaryCall | grpc.ClientReadableStream<RequestType> | grpc.ClientDuplexStream<RequestType, ResponseType> | grpc.ClientWritableStream<RequestType>;
48 channel: GcpChannelFactory;
49 methodDefinition: MethodDefinition<RequestType, ResponseType>;
50 callOptions: grpc.CallOptions;
53 export interface OutputCallProperties<RequestType, ResponseType> {
55 metadata: grpc.Metadata;
56 call: grpc.ClientUnaryCall | grpc.ClientReadableStream<RequestType> | grpc.ClientDuplexStream<RequestType, ResponseType> | grpc.ClientWritableStream<RequestType>;
57 channel: grpc.Channel;
58 methodDefinition: MethodDefinition<RequestType, ResponseType>;
59 callOptions: grpc.CallOptions;
63 * Pass in call properties and return a new object with modified values.
64 * This function will be used together with gcpChannelFactoryOverride
65 * when constructing a grpc Client.
67 * @param callProperties Call properties with channel factory object.
68 * @return Modified call properties with selected grpc channel object.
70 export declare function gcpCallInvocationTransformer<RequestType, ResponseType>(callProperties: InputCallProperties<RequestType, ResponseType>): OutputCallProperties<RequestType, ResponseType>;
71 export { GcpChannelFactory };