/// <summary> /// Creates a <see cref="InstancesClient"/> which uses the specified call invoker for remote operations. /// </summary> /// <param name="callInvoker"> /// The <see cref="grpccore::CallInvoker"/> for remote operations. Must not be null. /// </param> /// <param name="settings">Optional <see cref="InstancesSettings"/>.</param> /// <returns>The created <see cref="InstancesClient"/>.</returns> internal static InstancesClient Create(grpccore::CallInvoker callInvoker, InstancesSettings settings = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); grpcinter::Interceptor interceptor = settings?.Interceptor; if (interceptor != null) { callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor); } Instances.InstancesClient grpcClient = new Instances.InstancesClient(callInvoker); return(new InstancesClientImpl(grpcClient, settings)); }
/// <summary> /// Constructs a client wrapper for the Instances service, with the specified gRPC client and settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="InstancesSettings"/> used within this client.</param> public InstancesClientImpl(Instances.InstancesClient grpcClient, InstancesSettings settings) { GrpcClient = grpcClient; InstancesSettings effectiveSettings = settings ?? InstancesSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings); DeleteInstanceOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.DeleteInstanceOperationsSettings); DebugInstanceOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.DebugInstanceOperationsSettings); _callListInstances = clientHelper.BuildApiCall <ListInstancesRequest, ListInstancesResponse>(grpcClient.ListInstancesAsync, grpcClient.ListInstances, effectiveSettings.ListInstancesSettings).WithGoogleRequestParam("parent", request => request.Parent); Modify_ApiCall(ref _callListInstances); Modify_ListInstancesApiCall(ref _callListInstances); _callGetInstance = clientHelper.BuildApiCall <GetInstanceRequest, Instance>(grpcClient.GetInstanceAsync, grpcClient.GetInstance, effectiveSettings.GetInstanceSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callGetInstance); Modify_GetInstanceApiCall(ref _callGetInstance); _callDeleteInstance = clientHelper.BuildApiCall <DeleteInstanceRequest, lro::Operation>(grpcClient.DeleteInstanceAsync, grpcClient.DeleteInstance, effectiveSettings.DeleteInstanceSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callDeleteInstance); Modify_DeleteInstanceApiCall(ref _callDeleteInstance); _callDebugInstance = clientHelper.BuildApiCall <DebugInstanceRequest, lro::Operation>(grpcClient.DebugInstanceAsync, grpcClient.DebugInstance, effectiveSettings.DebugInstanceSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callDebugInstance); Modify_DebugInstanceApiCall(ref _callDebugInstance); OnConstruction(grpcClient, effectiveSettings, clientHelper); }
partial void OnConstruction(Instances.InstancesClient grpcClient, InstancesSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);