/// <summary>Snippet for Insert</summary> public void Insert() { // Snippet: Insert(string, TargetGrpcProxy, CallSettings) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = TargetGrpcProxiesClient.Create(); // Initialize request argument(s) string project = ""; TargetGrpcProxy targetGrpcProxyResource = new TargetGrpcProxy(); // Make the request lro::Operation <Operation, Operation> response = targetGrpcProxiesClient.Insert(project, targetGrpcProxyResource); // Poll until the returned long-running operation is complete lro::Operation <Operation, Operation> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Operation result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name lro::Operation <Operation, Operation> retrievedResponse = targetGrpcProxiesClient.PollOnceInsert(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Operation retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for PatchAsync</summary> public async Task PatchAsync() { // Snippet: PatchAsync(string, string, TargetGrpcProxy, CallSettings) // Additional: PatchAsync(string, string, TargetGrpcProxy, CancellationToken) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = await TargetGrpcProxiesClient.CreateAsync(); // Initialize request argument(s) string project = ""; string targetGrpcProxy = ""; TargetGrpcProxy targetGrpcProxyResource = new TargetGrpcProxy(); // Make the request lro::Operation <Operation, Operation> response = await targetGrpcProxiesClient.PatchAsync(project, targetGrpcProxy, targetGrpcProxyResource); // Poll until the returned long-running operation is complete lro::Operation <Operation, Operation> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Operation result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name lro::Operation <Operation, Operation> retrievedResponse = await targetGrpcProxiesClient.PollOncePatchAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Operation retrievedResult = retrievedResponse.Result; } // End snippet }
public void GetRequestObject() { moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient> mockGrpcClient = new moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient>(moq::MockBehavior.Strict); GetTargetGrpcProxyRequest request = new GetTargetGrpcProxyRequest { TargetGrpcProxy = "target_grpc_proxy51252bbb", Project = "projectaa6ff846", }; TargetGrpcProxy expectedResponse = new TargetGrpcProxy { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", SelfLinkWithId = "self_link_with_id6d1e3896", ValidateForProxyless = true, Fingerprint = "fingerprint009e6052", UrlMap = "url_map3ccdbf57", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TargetGrpcProxiesClient client = new TargetGrpcProxiesClientImpl(mockGrpcClient.Object, null); TargetGrpcProxy response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAsync() { moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient> mockGrpcClient = new moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient>(moq::MockBehavior.Strict); GetTargetGrpcProxyRequest request = new GetTargetGrpcProxyRequest { TargetGrpcProxy = "target_grpc_proxy51252bbb", Project = "projectaa6ff846", }; TargetGrpcProxy expectedResponse = new TargetGrpcProxy { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", SelfLinkWithId = "self_link_with_id6d1e3896", ValidateForProxyless = true, Fingerprint = "fingerprint009e6052", UrlMap = "url_map3ccdbf57", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetGrpcProxy>(stt::Task.FromResult(expectedResponse), null, null, null, null)); TargetGrpcProxiesClient client = new TargetGrpcProxiesClientImpl(mockGrpcClient.Object, null); TargetGrpcProxy responseCallSettings = await client.GetAsync(request.Project, request.TargetGrpcProxy, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); TargetGrpcProxy responseCancellationToken = await client.GetAsync(request.Project, request.TargetGrpcProxy, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Patches the specified TargetGrpcProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. /// </summary> /// <param name="project"> /// Project ID for this request. /// </param> /// <param name="targetGrpcProxy"> /// Name of the TargetGrpcProxy resource to patch. /// </param> /// <param name="targetGrpcProxyResource"> /// The body resource for this request /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual Operation Patch(string project, string targetGrpcProxy, TargetGrpcProxy targetGrpcProxyResource, gaxgrpc::CallSettings callSettings = null) => Patch(new PatchTargetGrpcProxyRequest { Project = gax::GaxPreconditions.CheckNotNullOrEmpty(project, nameof(project)), TargetGrpcProxy = gax::GaxPreconditions.CheckNotNullOrEmpty(targetGrpcProxy, nameof(targetGrpcProxy)), TargetGrpcProxyResource = gax::GaxPreconditions.CheckNotNull(targetGrpcProxyResource, nameof(targetGrpcProxyResource)), }, callSettings);
/// <summary>Snippet for Get</summary> public void Get() { // Snippet: Get(string, string, CallSettings) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = TargetGrpcProxiesClient.Create(); // Initialize request argument(s) string project = ""; string targetGrpcProxy = ""; // Make the request TargetGrpcProxy response = targetGrpcProxiesClient.Get(project, targetGrpcProxy); // End snippet }
/// <summary>Snippet for Insert</summary> public void Insert() { // Snippet: Insert(string, TargetGrpcProxy, CallSettings) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = TargetGrpcProxiesClient.Create(); // Initialize request argument(s) string project = ""; TargetGrpcProxy targetGrpcProxyResource = new TargetGrpcProxy(); // Make the request Operation response = targetGrpcProxiesClient.Insert(project, targetGrpcProxyResource); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetAsync() { // Snippet: GetAsync(string, string, CallSettings) // Additional: GetAsync(string, string, CancellationToken) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = await TargetGrpcProxiesClient.CreateAsync(); // Initialize request argument(s) string project = ""; string targetGrpcProxy = ""; // Make the request TargetGrpcProxy response = await targetGrpcProxiesClient.GetAsync(project, targetGrpcProxy); // End snippet }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetTargetGrpcProxyRequest, CallSettings) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = TargetGrpcProxiesClient.Create(); // Initialize request argument(s) GetTargetGrpcProxyRequest request = new GetTargetGrpcProxyRequest { TargetGrpcProxy = "", Project = "", }; // Make the request TargetGrpcProxy response = targetGrpcProxiesClient.Get(request); // End snippet }
/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, TargetGrpcProxy, CallSettings) // Additional: InsertAsync(string, TargetGrpcProxy, CancellationToken) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = await TargetGrpcProxiesClient.CreateAsync(); // Initialize request argument(s) string project = ""; TargetGrpcProxy targetGrpcProxyResource = new TargetGrpcProxy(); // Make the request Operation response = await targetGrpcProxiesClient.InsertAsync(project, targetGrpcProxyResource); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetTargetGrpcProxyRequest, CallSettings) // Additional: GetAsync(GetTargetGrpcProxyRequest, CancellationToken) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = await TargetGrpcProxiesClient.CreateAsync(); // Initialize request argument(s) GetTargetGrpcProxyRequest request = new GetTargetGrpcProxyRequest { TargetGrpcProxy = "", Project = "", }; // Make the request TargetGrpcProxy response = await targetGrpcProxiesClient.GetAsync(request); // End snippet }
/// <summary> /// Patches the specified TargetGrpcProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. /// </summary> /// <param name="project"> /// Project ID for this request. /// </param> /// <param name="targetGrpcProxy"> /// Name of the TargetGrpcProxy resource to patch. /// </param> /// <param name="targetGrpcProxyResource"> /// The body resource for this request /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <Operation> PatchAsync(string project, string targetGrpcProxy, TargetGrpcProxy targetGrpcProxyResource, st::CancellationToken cancellationToken) => PatchAsync(project, targetGrpcProxy, targetGrpcProxyResource, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Creates a TargetGrpcProxy in the specified project in the given scope using the parameters that are included in the request. /// </summary> /// <param name="project"> /// Project ID for this request. /// </param> /// <param name="targetGrpcProxyResource"> /// The body resource for this request /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <Operation> InsertAsync(string project, TargetGrpcProxy targetGrpcProxyResource, gaxgrpc::CallSettings callSettings = null) => InsertAsync(new InsertTargetGrpcProxyRequest { Project = gax::GaxPreconditions.CheckNotNullOrEmpty(project, nameof(project)), TargetGrpcProxyResource = gax::GaxPreconditions.CheckNotNull(targetGrpcProxyResource, nameof(targetGrpcProxyResource)), }, callSettings);