/// <summary>Snippet for PatchAsync</summary>
        public async Task PatchAsync()
        {
            // Snippet: PatchAsync(string, string, string, PacketMirroring, CallSettings)
            // Additional: PatchAsync(string, string, string, PacketMirroring, CancellationToken)
            // Create client
            PacketMirroringsClient packetMirroringsClient = await PacketMirroringsClient.CreateAsync();

            // Initialize request argument(s)
            string          project                 = "";
            string          region                  = "";
            string          packetMirroring         = "";
            PacketMirroring packetMirroringResource = new PacketMirroring();
            // Make the request
            lro::Operation <Operation, Operation> response = await packetMirroringsClient.PatchAsync(project, region, packetMirroring, packetMirroringResource);

            // 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 packetMirroringsClient.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 Get()
        {
            moq::Mock <PacketMirrorings.PacketMirroringsClient> mockGrpcClient = new moq::Mock <PacketMirrorings.PacketMirroringsClient>(moq::MockBehavior.Strict);
            GetPacketMirroringRequest request = new GetPacketMirroringRequest
            {
                PacketMirroring = "packet_mirroringf2de2a5f",
                Region          = "regionedb20d96",
                Project         = "projectaa6ff846",
            };
            PacketMirroring expectedResponse = new PacketMirroring
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                MirroredResources = new PacketMirroringMirroredResourceInfo(),
                Region            = "regionedb20d96",
                Network           = new PacketMirroringNetworkInfo(),
                Enable            = PacketMirroring.Types.Enable.True,
                Filter            = new PacketMirroringFilter(),
                Description       = "description2cf9da67",
                CollectorIlb      = new PacketMirroringForwardingRuleInfo(),
                Priority          = 1546225849U,
                SelfLink          = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            PacketMirroringsClient client   = new PacketMirroringsClientImpl(mockGrpcClient.Object, null);
            PacketMirroring        response = client.Get(request.Project, request.Region, request.PacketMirroring);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #3
0
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, string, PacketMirroring, CallSettings)
     // Create client
     PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.Create();
     // Initialize request argument(s)
     string          project = "";
     string          region  = "";
     PacketMirroring packetMirroringResource = new PacketMirroring();
     // Make the request
     Operation response = packetMirroringsClient.Insert(project, region, packetMirroringResource);
     // End snippet
 }
Example #4
0
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, string, CallSettings)
     // Create client
     PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.Create();
     // Initialize request argument(s)
     string project         = "";
     string region          = "";
     string packetMirroring = "";
     // Make the request
     PacketMirroring response = packetMirroringsClient.Get(project, region, packetMirroring);
     // End snippet
 }
Example #5
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, PacketMirroring, CallSettings)
            // Additional: InsertAsync(string, string, PacketMirroring, CancellationToken)
            // Create client
            PacketMirroringsClient packetMirroringsClient = await PacketMirroringsClient.CreateAsync();

            // Initialize request argument(s)
            string          project = "";
            string          region  = "";
            PacketMirroring packetMirroringResource = new PacketMirroring();
            // Make the request
            Operation response = await packetMirroringsClient.InsertAsync(project, region, packetMirroringResource);

            // End snippet
        }
Example #6
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetAsync()
        {
            // Snippet: GetAsync(string, string, string, CallSettings)
            // Additional: GetAsync(string, string, string, CancellationToken)
            // Create client
            PacketMirroringsClient packetMirroringsClient = await PacketMirroringsClient.CreateAsync();

            // Initialize request argument(s)
            string project         = "";
            string region          = "";
            string packetMirroring = "";
            // Make the request
            PacketMirroring response = await packetMirroringsClient.GetAsync(project, region, packetMirroring);

            // End snippet
        }
Example #7
0
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetPacketMirroringRequest, CallSettings)
     // Create client
     PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.Create();
     // Initialize request argument(s)
     GetPacketMirroringRequest request = new GetPacketMirroringRequest
     {
         PacketMirroring = "",
         Region          = "",
         Project         = "",
     };
     // Make the request
     PacketMirroring response = packetMirroringsClient.Get(request);
     // End snippet
 }
Example #8
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetPacketMirroringRequest, CallSettings)
            // Additional: GetAsync(GetPacketMirroringRequest, CancellationToken)
            // Create client
            PacketMirroringsClient packetMirroringsClient = await PacketMirroringsClient.CreateAsync();

            // Initialize request argument(s)
            GetPacketMirroringRequest request = new GetPacketMirroringRequest
            {
                PacketMirroring = "",
                Region          = "",
                Project         = "",
            };
            // Make the request
            PacketMirroring response = await packetMirroringsClient.GetAsync(request);

            // End snippet
        }
        public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <PacketMirrorings.PacketMirroringsClient> mockGrpcClient = new moq::Mock <PacketMirrorings.PacketMirroringsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetPacketMirroringRequest request = new GetPacketMirroringRequest
            {
                PacketMirroring = "packet_mirroringf2de2a5f",
                Region          = "regionedb20d96",
                Project         = "projectaa6ff846",
            };
            PacketMirroring expectedResponse = new PacketMirroring
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                MirroredResources = new PacketMirroringMirroredResourceInfo(),
                Region            = "regionedb20d96",
                Network           = new PacketMirroringNetworkInfo(),
                Enable            = "enable6d158f20",
                Filter            = new PacketMirroringFilter(),
                Description       = "description2cf9da67",
                CollectorIlb      = new PacketMirroringForwardingRuleInfo(),
                Priority          = 1546225849U,
                SelfLink          = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <PacketMirroring>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            PacketMirroringsClient client = new PacketMirroringsClientImpl(mockGrpcClient.Object, null);
            PacketMirroring        responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }