示例#1
0
 /// <summary>Snippet for Wait</summary>
 public void WaitRequestObject()
 {
     // Snippet: Wait(WaitRegionOperationRequest, CallSettings)
     // Create client
     RegionOperationsClient regionOperationsClient = RegionOperationsClient.Create();
     // Initialize request argument(s)
     WaitRegionOperationRequest request = new WaitRegionOperationRequest
     {
         Operation = "",
         Region    = "",
         Project   = "",
     };
     // Make the request
     Operation response = regionOperationsClient.Wait(request);
     // End snippet
 }
        public async stt::Task WaitAsync()
        {
            moq::Mock <RegionOperations.RegionOperationsClient> mockGrpcClient = new moq::Mock <RegionOperations.RegionOperationsClient>(moq::MockBehavior.Strict);
            WaitRegionOperationRequest request = new WaitRegionOperationRequest
            {
                Operation = "operation615a23f7",
                Region    = "regionedb20d96",
                Project   = "projectaa6ff846",
            };
            Operation expectedResponse = new Operation
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                User = "******",
                Zone = "zone255f4ea8",
                CreationTimestamp   = "creation_timestamp235e59a1",
                StartTime           = "start_timebd8dd9c4",
                OperationGroupId    = "operation_group_idd2040cf0",
                TargetLink          = "target_link9b435dc0",
                Progress            = 278622268,
                Error               = new Error(),
                EndTime             = "end_time89285d30",
                Region              = "regionedb20d96",
                OperationType       = "operation_typeece9e153",
                Status              = Operation.Types.Status.Pending,
                HttpErrorMessage    = "http_error_messageb5ef3c7f",
                TargetId            = 6263187990225347157UL,
                ClientOperationId   = "client_operation_id4e51b631",
                StatusMessage       = "status_message2c618f86",
                HttpErrorStatusCode = 1766362655,
                Description         = "description2cf9da67",
                InsertTime          = "insert_time7467185a",
                SelfLink            = "self_link7e87f12d",
                Warnings            = { new Warnings(), },
            };

            mockGrpcClient.Setup(x => x.WaitAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            RegionOperationsClient client  = new RegionOperationsClientImpl(mockGrpcClient.Object, null);
            Operation responseCallSettings = await client.WaitAsync(request.Project, request.Region, request.Operation, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Operation responseCancellationToken = await client.WaitAsync(request.Project, request.Region, request.Operation, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void Wait()
        {
            moq::Mock <RegionOperations.RegionOperationsClient> mockGrpcClient = new moq::Mock <RegionOperations.RegionOperationsClient>(moq::MockBehavior.Strict);
            WaitRegionOperationRequest request = new WaitRegionOperationRequest
            {
                Operation = "operation615a23f7",
                Region    = "regionedb20d96",
                Project   = "projectaa6ff846",
            };
            Operation expectedResponse = new Operation
            {
                Id   = "id74b70bb8",
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                User = "******",
                Zone = "zone255f4ea8",
                CreationTimestamp   = "creation_timestamp235e59a1",
                StartTime           = "start_timebd8dd9c4",
                OperationGroupId    = "operation_group_idd2040cf0",
                TargetLink          = "target_link9b435dc0",
                Progress            = 278622268,
                Error               = new Error(),
                EndTime             = "end_time89285d30",
                Region              = "regionedb20d96",
                OperationType       = "operation_typeece9e153",
                Status              = Operation.Types.Status.Pending,
                HttpErrorMessage    = "http_error_messageb5ef3c7f",
                TargetId            = "target_id16dfe255",
                ClientOperationId   = "client_operation_id4e51b631",
                StatusMessage       = "status_message2c618f86",
                HttpErrorStatusCode = 1766362655,
                Description         = "description2cf9da67",
                InsertTime          = "insert_time7467185a",
                SelfLink            = "self_link7e87f12d",
                Warnings            = { new Warnings(), },
            };

            mockGrpcClient.Setup(x => x.Wait(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            RegionOperationsClient client = new RegionOperationsClientImpl(mockGrpcClient.Object, null);
            Operation response            = client.Wait(request.Project, request.Region, request.Operation);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#4
0
        /// <summary>Snippet for WaitAsync</summary>
        public async Task WaitRequestObjectAsync()
        {
            // Snippet: WaitAsync(WaitRegionOperationRequest, CallSettings)
            // Additional: WaitAsync(WaitRegionOperationRequest, CancellationToken)
            // Create client
            RegionOperationsClient regionOperationsClient = await RegionOperationsClient.CreateAsync();

            // Initialize request argument(s)
            WaitRegionOperationRequest request = new WaitRegionOperationRequest
            {
                Operation = "",
                Region    = "",
                Project   = "",
            };
            // Make the request
            Operation response = await regionOperationsClient.WaitAsync(request);

            // End snippet
        }
示例#5
0
 /// <summary>
 /// Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress.
 ///
 /// This method is called on a best-effort basis. Specifically:
 /// - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds.
 /// - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task <Operation> WaitAsync(WaitRegionOperationRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_WaitRegionOperationRequest(ref request, ref callSettings);
     return(_callWait.Async(request, callSettings));
 }
示例#6
0
 /// <summary>
 /// Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress.
 ///
 /// This method is called on a best-effort basis. Specifically:
 /// - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds.
 /// - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override Operation Wait(WaitRegionOperationRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_WaitRegionOperationRequest(ref request, ref callSettings);
     return(_callWait.Sync(request, callSettings));
 }
示例#7
0
 partial void Modify_WaitRegionOperationRequest(ref WaitRegionOperationRequest request, ref gaxgrpc::CallSettings settings);
示例#8
0
 /// <summary>
 /// Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress.
 ///
 /// This method is called on a best-effort basis. Specifically:
 /// - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds.
 /// - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</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> WaitAsync(WaitRegionOperationRequest request, st::CancellationToken cancellationToken) =>
 WaitAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
示例#9
0
 /// <summary>
 /// Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress.
 ///
 /// This method is called on a best-effort basis. Specifically:
 /// - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds.
 /// - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</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> WaitAsync(WaitRegionOperationRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
示例#10
0
 /// <summary>
 /// Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress.
 ///
 /// This method is called on a best-effort basis. Specifically:
 /// - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds.
 /// - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual Operation Wait(WaitRegionOperationRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();