private OperationsSettings(OperationsSettings existing) : base(existing)
 {
     GaxPreconditions.CheckNotNull(existing, nameof(existing));
     GetOperationSettings    = existing.GetOperationSettings;
     ListOperationsSettings  = existing.ListOperationsSettings;
     CancelOperationSettings = existing.CancelOperationSettings;
     DeleteOperationSettings = existing.DeleteOperationSettings;
 }
        /// <summary>
        /// Constructs a client wrapper for the Operations service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="OperationsSettings"/> used within this client </param>
        public OperationsClientImpl(Operations.OperationsClient grpcClient, OperationsSettings settings)
        {
            this.GrpcClient = grpcClient;
            OperationsSettings effectiveSettings = settings ?? OperationsSettings.GetDefault();

            _clientHelper     = new ClientHelper(effectiveSettings);
            _callGetOperation = _clientHelper.BuildApiCall <GetOperationRequest, Operation>(
                GrpcClient.GetOperationAsync, GrpcClient.GetOperation, effectiveSettings.GetOperationSettings);
            _callListOperations = _clientHelper.BuildApiCall <ListOperationsRequest, ListOperationsResponse>(
                GrpcClient.ListOperationsAsync, GrpcClient.ListOperations, effectiveSettings.ListOperationsSettings);
            _callCancelOperation = _clientHelper.BuildApiCall <CancelOperationRequest, Empty>(
                GrpcClient.CancelOperationAsync, GrpcClient.CancelOperation, effectiveSettings.CancelOperationSettings);
            _callDeleteOperation = _clientHelper.BuildApiCall <DeleteOperationRequest, Empty>(
                GrpcClient.DeleteOperationAsync, GrpcClient.DeleteOperation, effectiveSettings.DeleteOperationSettings);
        }
        /// <summary>
        /// Synchronously creates a <see cref="OperationsClient"/>, applying defaults for all unspecified settings,
        /// and creating a channel connecting to the given endpoint with application default credentials where
        /// necessary.
        /// </summary>
        /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param>
        /// <param name="settings">Optional <see cref="OperationsSettings"/>.</param>
        /// <returns>The created <see cref="OperationsClient"/>.</returns>
        public static OperationsClient Create(ServiceEndpoint endpoint = null, OperationsSettings settings = null)
        {
            Channel channel = s_channelPool.GetChannel(endpoint ?? DefaultEndpoint);

            return(Create(channel, settings));
        }
 /// <summary>
 /// Creates a <see cref="OperationsClient"/> which uses the specified channel for remote operations.
 /// </summary>
 /// <param name="channel">The <see cref="Channel"/> for remote operations. Must not be null.</param>
 /// <param name="settings">Optional <see cref="OperationsSettings"/>.</param>
 /// <returns>The created <see cref="OperationsClient"/>.</returns>
 public static OperationsClient Create(Channel channel, OperationsSettings settings = null)
 {
     GaxPreconditions.CheckNotNull(channel, nameof(channel));
     Operations.OperationsClient grpcClient = new Operations.OperationsClient(channel);
     return(new OperationsClientImpl(grpcClient, settings));
 }
        // Note: we could have parameterless overloads of Create and CreateAsync,
        // documented to just use the default endpoint, settings and credentials.
        // Pros:
        // - Might be more reassuring on first use
        // - Allows method group conversions
        // Con: overloads!

        /// <summary>
        /// Asynchronously creates a <see cref="OperationsClient"/>, applying defaults for all unspecified settings,
        /// and creating a channel connecting to the given endpoint with application default credentials where
        /// necessary.
        /// </summary>
        /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param>
        /// <param name="settings">Optional <see cref="OperationsSettings"/>.</param>
        /// <returns>The task representing the created <see cref="OperationsClient"/>.</returns>
        public static async Task <OperationsClient> CreateAsync(ServiceEndpoint endpoint = null, OperationsSettings settings = null)
        {
            Channel channel = await s_channelPool.GetChannelAsync(endpoint ?? DefaultEndpoint).ConfigureAwait(false);

            return(Create(channel, settings));
        }