コード例 #1
0
        /// <summary>Snippet for SetProxyHeader</summary>
        public void SetProxyHeaderRequestObject()
        {
            // Snippet: SetProxyHeader(SetProxyHeaderTargetTcpProxyRequest, CallSettings)
            // Create client
            TargetTcpProxiesClient targetTcpProxiesClient = TargetTcpProxiesClient.Create();
            // Initialize request argument(s)
            SetProxyHeaderTargetTcpProxyRequest request = new SetProxyHeaderTargetTcpProxyRequest
            {
                RequestId = "",
                TargetTcpProxiesSetProxyHeaderRequestResource = new TargetTcpProxiesSetProxyHeaderRequest(),
                Project        = "",
                TargetTcpProxy = "",
            };
            // Make the request
            lro::Operation <Operation, Operation> response = targetTcpProxiesClient.SetProxyHeader(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 = targetTcpProxiesClient.PollOnceSetProxyHeader(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
        }
コード例 #2
0
        public async stt::Task SetProxyHeaderRequestObjectAsync()
        {
            moq::Mock <TargetTcpProxies.TargetTcpProxiesClient> mockGrpcClient = new moq::Mock <TargetTcpProxies.TargetTcpProxiesClient>(moq::MockBehavior.Strict);
            SetProxyHeaderTargetTcpProxyRequest request = new SetProxyHeaderTargetTcpProxyRequest
            {
                RequestId = "request_id362c8df6",
                TargetTcpProxiesSetProxyHeaderRequestResource = new TargetTcpProxiesSetProxyHeaderRequest(),
                Project        = "projectaa6ff846",
                TargetTcpProxy = "target_tcp_proxy074a59b9",
            };
            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.SetProxyHeaderAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TargetTcpProxiesClient client  = new TargetTcpProxiesClientImpl(mockGrpcClient.Object, null);
            Operation responseCallSettings = await client.SetProxyHeaderAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
 /// <summary>Snippet for SetProxyHeader</summary>
 public void SetProxyHeaderRequestObject()
 {
     // Snippet: SetProxyHeader(SetProxyHeaderTargetTcpProxyRequest, CallSettings)
     // Create client
     TargetTcpProxiesClient targetTcpProxiesClient = TargetTcpProxiesClient.Create();
     // Initialize request argument(s)
     SetProxyHeaderTargetTcpProxyRequest request = new SetProxyHeaderTargetTcpProxyRequest
     {
         RequestId = "",
         TargetTcpProxiesSetProxyHeaderRequestResource = new TargetTcpProxiesSetProxyHeaderRequest(),
         Project        = "",
         TargetTcpProxy = "",
     };
     // Make the request
     Operation response = targetTcpProxiesClient.SetProxyHeader(request);
     // End snippet
 }
コード例 #4
0
        /// <summary>Snippet for SetProxyHeaderAsync</summary>
        public async Task SetProxyHeaderRequestObjectAsync()
        {
            // Snippet: SetProxyHeaderAsync(SetProxyHeaderTargetTcpProxyRequest, CallSettings)
            // Additional: SetProxyHeaderAsync(SetProxyHeaderTargetTcpProxyRequest, CancellationToken)
            // Create client
            TargetTcpProxiesClient targetTcpProxiesClient = await TargetTcpProxiesClient.CreateAsync();

            // Initialize request argument(s)
            SetProxyHeaderTargetTcpProxyRequest request = new SetProxyHeaderTargetTcpProxyRequest
            {
                RequestId = "",
                TargetTcpProxiesSetProxyHeaderRequestResource = new TargetTcpProxiesSetProxyHeaderRequest(),
                Project        = "",
                TargetTcpProxy = "",
            };
            // Make the request
            Operation response = await targetTcpProxiesClient.SetProxyHeaderAsync(request);

            // End snippet
        }