/// <summary>Snippet for Insert</summary>
        public void InsertRequestObject()
        {
            // Snippet: Insert(InsertRouteRequest, CallSettings)
            // Create client
            RoutesClient routesClient = RoutesClient.Create();
            // Initialize request argument(s)
            InsertRouteRequest request = new InsertRouteRequest
            {
                RequestId     = "",
                RouteResource = new Route(),
                Project       = "",
            };
            // Make the request
            lro::Operation <Operation, Operation> response = routesClient.Insert(request);

            // 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 = routesClient.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
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a Route resource in the specified project using the data included in the request.
        /// </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 lro::Operation <Operation, Operation> Insert(InsertRouteRequest request, gaxgrpc::CallSettings callSettings = null)
        {
            Modify_InsertRouteRequest(ref request, ref callSettings);
            Operation response = _callInsert.Sync(request, callSettings);
            GetGlobalOperationRequest pollRequest = GetGlobalOperationRequest.FromInitialResponse(response);

            request.PopulatePollRequestFields(pollRequest);
            return(new lro::Operation <Operation, Operation>(response.ToLroResponse(pollRequest.ToLroOperationName()), InsertOperationsClient));
        }
Esempio n. 3
0
 /// <summary>Snippet for Insert</summary>
 public void InsertRequestObject()
 {
     // Snippet: Insert(InsertRouteRequest, CallSettings)
     // Create client
     RoutesClient routesClient = RoutesClient.Create();
     // Initialize request argument(s)
     InsertRouteRequest request = new InsertRouteRequest
     {
         RequestId     = "",
         RouteResource = new Route(),
         Project       = "",
     };
     // Make the request
     Operation response = routesClient.Insert(request);
     // End snippet
 }
        public async stt::Task InsertRequestObjectAsync()
        {
            moq::Mock <Routes.RoutesClient> mockGrpcClient = new moq::Mock <Routes.RoutesClient>(moq::MockBehavior.Strict);
            InsertRouteRequest request = new InsertRouteRequest
            {
                RequestId     = "request_id362c8df6",
                RouteResource = new Route(),
                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.InsertAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            RoutesClient client = new RoutesClientImpl(mockGrpcClient.Object, null);
            Operation    responseCallSettings = await client.InsertAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void InsertRequestObject()
        {
            moq::Mock <Routes.RoutesClient> mockGrpcClient = new moq::Mock <Routes.RoutesClient>(moq::MockBehavior.Strict);
            InsertRouteRequest request = new InsertRouteRequest
            {
                RequestId     = "request_id362c8df6",
                RouteResource = new Route(),
                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.Insert(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            RoutesClient client   = new RoutesClientImpl(mockGrpcClient.Object, null);
            Operation    response = client.Insert(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 6
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertRequestObjectAsync()
        {
            // Snippet: InsertAsync(InsertRouteRequest, CallSettings)
            // Additional: InsertAsync(InsertRouteRequest, CancellationToken)
            // Create client
            RoutesClient routesClient = await RoutesClient.CreateAsync();

            // Initialize request argument(s)
            InsertRouteRequest request = new InsertRouteRequest
            {
                RequestId     = "",
                RouteResource = new Route(),
                Project       = "",
            };
            // Make the request
            Operation response = await routesClient.InsertAsync(request);

            // End snippet
        }
 /// <summary>
 /// Creates a Route resource in the specified project using the data included in the request.
 /// </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> InsertAsync(InsertRouteRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_InsertRouteRequest(ref request, ref callSettings);
     return(_callInsert.Async(request, callSettings));
 }
 /// <summary>
 /// Creates a Route resource in the specified project using the data included in the request.
 /// </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 Insert(InsertRouteRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_InsertRouteRequest(ref request, ref callSettings);
     return(_callInsert.Sync(request, callSettings));
 }
 partial void Modify_InsertRouteRequest(ref InsertRouteRequest request, ref gaxgrpc::CallSettings settings);
 /// <summary>
 /// Creates a Route resource in the specified project using the data included in the request.
 /// </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> InsertAsync(InsertRouteRequest request, st::CancellationToken cancellationToken) =>
 InsertAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Creates a Route resource in the specified project using the data included in the request.
 /// </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> InsertAsync(InsertRouteRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
 /// <summary>
 /// Creates a Route resource in the specified project using the data included in the request.
 /// </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 Insert(InsertRouteRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Esempio n. 13
0
        /// <summary>
        /// Creates a Route resource in the specified project using the data included in the request.
        /// </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 async stt::Task <lro::Operation <Operation, Operation> > InsertAsync(InsertRouteRequest request, gaxgrpc::CallSettings callSettings = null)
        {
            Modify_InsertRouteRequest(ref request, ref callSettings);
            Operation response = await _callInsert.Async(request, callSettings).ConfigureAwait(false);

            GetGlobalOperationRequest pollRequest = GetGlobalOperationRequest.FromInitialResponse(response);

            request.PopulatePollRequestFields(pollRequest);
            return(new lro::Operation <Operation, Operation>(response.ToLroResponse(pollRequest.ToLroOperationName()), InsertOperationsClient));
        }