/// <summary> /// Constructs a client wrapper for the ReportErrorsService service, with the specified gRPC client and settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="ReportErrorsServiceSettings"/> used within this client </param> public ReportErrorsServiceClientImpl(ReportErrorsService.ReportErrorsServiceClient grpcClient, ReportErrorsServiceSettings settings) { this.GrpcClient = grpcClient; ReportErrorsServiceSettings effectiveSettings = settings ?? ReportErrorsServiceSettings.GetDefault(); _clientHelper = new ClientHelper(effectiveSettings); _callReportErrorEvent = _clientHelper.BuildApiCall <ReportErrorEventRequest, ReportErrorEventResponse>( GrpcClient.ReportErrorEventAsync, GrpcClient.ReportErrorEvent, effectiveSettings.ReportErrorEventSettings); }
/// <summary> /// Constructs a client wrapper for the ReportErrorsService service, with the specified gRPC client and /// settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="ReportErrorsServiceSettings"/> used within this client.</param> public ReportErrorsServiceClientImpl(ReportErrorsService.ReportErrorsServiceClient grpcClient, ReportErrorsServiceSettings settings) { GrpcClient = grpcClient; ReportErrorsServiceSettings effectiveSettings = settings ?? ReportErrorsServiceSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings); _callReportErrorEvent = clientHelper.BuildApiCall <ReportErrorEventRequest, ReportErrorEventResponse>(grpcClient.ReportErrorEventAsync, grpcClient.ReportErrorEvent, effectiveSettings.ReportErrorEventSettings).WithGoogleRequestParam("project_name", request => request.ProjectName); Modify_ApiCall(ref _callReportErrorEvent); Modify_ReportErrorEventApiCall(ref _callReportErrorEvent); OnConstruction(grpcClient, effectiveSettings, clientHelper); }
/// <summary> /// Constructs a client wrapper for the ReportErrorsService service, with the specified gRPC client and /// settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="ReportErrorsServiceSettings"/> used within this client.</param> public ReportErrorsServiceClientImpl(ReportErrorsService.ReportErrorsServiceClient grpcClient, ReportErrorsServiceSettings settings) { GrpcClient = grpcClient; ReportErrorsServiceSettings effectiveSettings = settings ?? ReportErrorsServiceSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings); _callReportErrorEvent = clientHelper.BuildApiCall <ReportErrorEventRequest, ReportErrorEventResponse>(grpcClient.ReportErrorEventAsync, grpcClient.ReportErrorEvent, effectiveSettings.ReportErrorEventSettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"project_name={(sysnet::WebUtility.UrlEncode(request.ProjectName))}")); Modify_ApiCall(ref _callReportErrorEvent); Modify_ReportErrorEventApiCall(ref _callReportErrorEvent); OnConstruction(grpcClient, effectiveSettings, clientHelper); }
partial void OnCopy(ReportErrorsServiceSettings existing);
partial void OnConstruction(ReportErrorsService.ReportErrorsServiceClient grpcClient, ReportErrorsServiceSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);
private ReportErrorsServiceSettings(ReportErrorsServiceSettings existing) : base(existing) { gax::GaxPreconditions.CheckNotNull(existing, nameof(existing)); ReportErrorEventSettings = existing.ReportErrorEventSettings; OnCopy(existing); }
/// <summary> /// Creates a <see cref="ReportErrorsServiceClient"/> 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="ReportErrorsServiceSettings"/>.</param> /// <returns>The created <see cref="ReportErrorsServiceClient"/>.</returns> internal static ReportErrorsServiceClient Create(grpccore::CallInvoker callInvoker, ReportErrorsServiceSettings settings = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); grpcinter::Interceptor interceptor = settings?.Interceptor; if (interceptor != null) { callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor); } ReportErrorsService.ReportErrorsServiceClient grpcClient = new ReportErrorsService.ReportErrorsServiceClient(callInvoker); return(new ReportErrorsServiceClientImpl(grpcClient, settings)); }
/// <summary> /// Creates a <see cref="ReportErrorsServiceClient"/> which uses the specified channel for remote operations. /// </summary> /// <param name="channel">The <see cref="grpccore::Channel"/> for remote operations. Must not be null.</param> /// <param name="settings">Optional <see cref="ReportErrorsServiceSettings"/>.</param> /// <returns>The created <see cref="ReportErrorsServiceClient"/>.</returns> public static ReportErrorsServiceClient Create(grpccore::Channel channel, ReportErrorsServiceSettings settings = null) { gax::GaxPreconditions.CheckNotNull(channel, nameof(channel)); return(Create(new grpccore::DefaultCallInvoker(channel), settings)); }
/// <summary> /// Synchronously creates a <see cref="ReportErrorsServiceClient"/>, applying defaults for all unspecified settings, /// and creating a channel connecting to the given endpoint with application default credentials where /// necessary. See the example for how to use custom credentials. /// </summary> /// <example> /// This sample shows how to create a client using default credentials: /// <code> /// using Google.Cloud.ErrorReporting.V1Beta1; /// ... /// // When running on Google Cloud Platform this will use the project Compute Credential. /// // Or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of a JSON /// // credential file to use that credential. /// ReportErrorsServiceClient client = ReportErrorsServiceClient.Create(); /// </code> /// This sample shows how to create a client using credentials loaded from a JSON file: /// <code> /// using Google.Cloud.ErrorReporting.V1Beta1; /// using Google.Apis.Auth.OAuth2; /// using Grpc.Auth; /// using Grpc.Core; /// ... /// GoogleCredential cred = GoogleCredential.FromFile("/path/to/credentials.json"); /// Channel channel = new Channel( /// ReportErrorsServiceClient.DefaultEndpoint.Host, ReportErrorsServiceClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); /// ReportErrorsServiceClient client = ReportErrorsServiceClient.Create(channel); /// ... /// // Shutdown the channel when it is no longer required. /// channel.ShutdownAsync().Wait(); /// </code> /// </example> /// <param name="endpoint">Optional <see cref="gaxgrpc::ServiceEndpoint"/>.</param> /// <param name="settings">Optional <see cref="ReportErrorsServiceSettings"/>.</param> /// <returns>The created <see cref="ReportErrorsServiceClient"/>.</returns> public static ReportErrorsServiceClient Create(gaxgrpc::ServiceEndpoint endpoint = null, ReportErrorsServiceSettings settings = null) { grpccore::Channel channel = s_channelPool.GetChannel(endpoint ?? DefaultEndpoint); return(Create(channel, settings)); }
/// <summary> /// Asynchronously creates a <see cref="ReportErrorsServiceClient"/>, applying defaults for all unspecified settings, /// and creating a channel connecting to the given endpoint with application default credentials where /// necessary. See the example for how to use custom credentials. /// </summary> /// <example> /// This sample shows how to create a client using default credentials: /// <code> /// using Google.Cloud.ErrorReporting.V1Beta1; /// ... /// // When running on Google Cloud Platform this will use the project Compute Credential. /// // Or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of a JSON /// // credential file to use that credential. /// ReportErrorsServiceClient client = await ReportErrorsServiceClient.CreateAsync(); /// </code> /// This sample shows how to create a client using credentials loaded from a JSON file: /// <code> /// using Google.Cloud.ErrorReporting.V1Beta1; /// using Google.Apis.Auth.OAuth2; /// using Grpc.Auth; /// using Grpc.Core; /// ... /// GoogleCredential cred = GoogleCredential.FromFile("/path/to/credentials.json"); /// Channel channel = new Channel( /// ReportErrorsServiceClient.DefaultEndpoint.Host, ReportErrorsServiceClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); /// ReportErrorsServiceClient client = ReportErrorsServiceClient.Create(channel); /// ... /// // Shutdown the channel when it is no longer required. /// await channel.ShutdownAsync(); /// </code> /// </example> /// <param name="endpoint">Optional <see cref="gaxgrpc::ServiceEndpoint"/>.</param> /// <param name="settings">Optional <see cref="ReportErrorsServiceSettings"/>.</param> /// <returns>The task representing the created <see cref="ReportErrorsServiceClient"/>.</returns> public static async stt::Task <ReportErrorsServiceClient> CreateAsync(gaxgrpc::ServiceEndpoint endpoint = null, ReportErrorsServiceSettings settings = null) { grpccore::Channel channel = await s_channelPool.GetChannelAsync(endpoint ?? DefaultEndpoint).ConfigureAwait(false); return(Create(channel, settings)); }
/// <summary> /// Creates a <see cref="ReportErrorsServiceClient"/> 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="ReportErrorsServiceSettings"/>.</param> /// <returns>The created <see cref="ReportErrorsServiceClient"/>.</returns> public static ReportErrorsServiceClient Create(Channel channel, ReportErrorsServiceSettings settings = null) { GaxPreconditions.CheckNotNull(channel, nameof(channel)); ReportErrorsService.ReportErrorsServiceClient grpcClient = new ReportErrorsService.ReportErrorsServiceClient(channel); return(new ReportErrorsServiceClientImpl(grpcClient, settings)); }
/// <summary> /// Creates a <see cref="ReportErrorsServiceClient"/> 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="ReportErrorsServiceSettings"/>.</param> /// <returns>The created <see cref="ReportErrorsServiceClient"/>.</returns> public static ReportErrorsServiceClient Create(grpccore::CallInvoker callInvoker, ReportErrorsServiceSettings settings = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); ReportErrorsService.ReportErrorsServiceClient grpcClient = new ReportErrorsService.ReportErrorsServiceClient(callInvoker); return(new ReportErrorsServiceClientImpl(grpcClient, settings)); }