/// <summary>
 /// Creates a VpnTunnel resource in the specified project and region using the data included in the request.
 /// </summary>
 /// <param name="project">
 /// Project ID for this request.
 /// </param>
 /// <param name="region">
 /// Name of the region for this request.
 /// </param>
 /// <param name="vpnTunnelResource">
 /// 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 Insert(string project, string region, VpnTunnel vpnTunnelResource, gaxgrpc::CallSettings callSettings = null) =>
 Insert(new InsertVpnTunnelRequest
 {
     Project           = gax::GaxPreconditions.CheckNotNullOrEmpty(project, nameof(project)),
     Region            = gax::GaxPreconditions.CheckNotNullOrEmpty(region, nameof(region)),
     VpnTunnelResource = gax::GaxPreconditions.CheckNotNull(vpnTunnelResource, nameof(vpnTunnelResource)),
 }, callSettings);
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, VpnTunnel, CallSettings)
            // Additional: InsertAsync(string, string, VpnTunnel, CancellationToken)
            // Create client
            VpnTunnelsClient vpnTunnelsClient = await VpnTunnelsClient.CreateAsync();

            // Initialize request argument(s)
            string    project           = "";
            string    region            = "";
            VpnTunnel vpnTunnelResource = new VpnTunnel();
            // Make the request
            lro::Operation <Operation, Operation> response = await vpnTunnelsClient.InsertAsync(project, region, vpnTunnelResource);

            // 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 vpnTunnelsClient.PollOnceInsertAsync(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 async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <VpnTunnels.VpnTunnelsClient> mockGrpcClient = new moq::Mock <VpnTunnels.VpnTunnelsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetVpnTunnelRequest request = new GetVpnTunnelRequest
            {
                Region    = "regionedb20d96",
                VpnTunnel = "vpn_tunnelfa4123fd",
                Project   = "projectaa6ff846",
            };
            VpnTunnel expectedResponse = new VpnTunnel
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp   = "creation_timestamp235e59a1",
                VpnGatewayInterface = 1166485993,
                Region               = "regionedb20d96",
                Router               = "routerd55c39f3",
                Status               = "status5444cb9a",
                IkeVersion           = 485306612,
                PeerGcpGateway       = "peer_gcp_gateway613039db",
                LocalTrafficSelector =
                {
                    "local_traffic_selector09bfbb68",
                },
                DetailedStatus        = "detailed_status4e3163c7",
                RemoteTrafficSelector =
                {
                    "remote_traffic_selector8463a07f",
                },
                SharedSecret                 = "shared_secret3a48b317",
                PeerIp                       = "peer_ip5b148b8e",
                PeerExternalGateway          = "peer_external_gatewaye60baaef",
                SharedSecretHash             = "shared_secret_hash3ba18c3b",
                VpnGateway                   = "vpn_gatewayaa15de14",
                Description                  = "description2cf9da67",
                PeerExternalGatewayInterface = -994715857,
                SelfLink                     = "self_link7e87f12d",
                TargetVpnGateway             = "target_vpn_gateway6c481371",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, string, VpnTunnel, CallSettings)
     // Create client
     VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.Create();
     // Initialize request argument(s)
     string    project           = "";
     string    region            = "";
     VpnTunnel vpnTunnelResource = new VpnTunnel();
     // Make the request
     Operation response = vpnTunnelsClient.Insert(project, region, vpnTunnelResource);
     // End snippet
 }
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, string, CallSettings)
     // Create client
     VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.Create();
     // Initialize request argument(s)
     string project   = "";
     string region    = "";
     string vpnTunnel = "";
     // Make the request
     VpnTunnel response = vpnTunnelsClient.Get(project, region, vpnTunnel);
     // End snippet
 }
Пример #6
0
        public void Get()
        {
            moq::Mock <VpnTunnels.VpnTunnelsClient> mockGrpcClient = new moq::Mock <VpnTunnels.VpnTunnelsClient>(moq::MockBehavior.Strict);
            GetVpnTunnelRequest request = new GetVpnTunnelRequest
            {
                Region    = "regionedb20d96",
                VpnTunnel = "vpn_tunnelfa4123fd",
                Project   = "projectaa6ff846",
            };
            VpnTunnel expectedResponse = new VpnTunnel
            {
                Id                   = "id74b70bb8",
                Kind                 = "kindf7aa39d9",
                Name                 = "name1c9368b0",
                PeerGcpGateway       = "peer_gcp_gateway613039db",
                CreationTimestamp    = "creation_timestamp235e59a1",
                LocalTrafficSelector =
                {
                    "local_traffic_selector09bfbb68",
                },
                DetailedStatus        = "detailed_status4e3163c7",
                RemoteTrafficSelector =
                {
                    "remote_traffic_selector8463a07f",
                },
                VpnGatewayInterface = 1166485993,
                SharedSecret        = "shared_secret3a48b317",
                PeerIp = "peer_ip5b148b8e",
                PeerExternalGateway = "peer_external_gatewaye60baaef",
                SharedSecretHash    = "shared_secret_hash3ba18c3b",
                VpnGateway          = "vpn_gatewayaa15de14",
                Region      = "regionedb20d96",
                Router      = "routerd55c39f3",
                Description = "description2cf9da67",
                Status      = VpnTunnel.Types.Status.Provisioning,
                PeerExternalGatewayInterface = -994715857,
                SelfLink         = "self_link7e87f12d",
                IkeVersion       = 485306612,
                TargetVpnGateway = "target_vpn_gateway6c481371",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, VpnTunnel, CallSettings)
            // Additional: InsertAsync(string, string, VpnTunnel, CancellationToken)
            // Create client
            VpnTunnelsClient vpnTunnelsClient = await VpnTunnelsClient.CreateAsync();

            // Initialize request argument(s)
            string    project           = "";
            string    region            = "";
            VpnTunnel vpnTunnelResource = new VpnTunnel();
            // Make the request
            Operation response = await vpnTunnelsClient.InsertAsync(project, region, vpnTunnelResource);

            // End snippet
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetAsync()
        {
            // Snippet: GetAsync(string, string, string, CallSettings)
            // Additional: GetAsync(string, string, string, CancellationToken)
            // Create client
            VpnTunnelsClient vpnTunnelsClient = await VpnTunnelsClient.CreateAsync();

            // Initialize request argument(s)
            string project   = "";
            string region    = "";
            string vpnTunnel = "";
            // Make the request
            VpnTunnel response = await vpnTunnelsClient.GetAsync(project, region, vpnTunnel);

            // End snippet
        }
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetVpnTunnelRequest, CallSettings)
     // Create client
     VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.Create();
     // Initialize request argument(s)
     GetVpnTunnelRequest request = new GetVpnTunnelRequest
     {
         Region    = "",
         VpnTunnel = "",
         Project   = "",
     };
     // Make the request
     VpnTunnel response = vpnTunnelsClient.Get(request);
     // End snippet
 }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetVpnTunnelRequest, CallSettings)
            // Additional: GetAsync(GetVpnTunnelRequest, CancellationToken)
            // Create client
            VpnTunnelsClient vpnTunnelsClient = await VpnTunnelsClient.CreateAsync();

            // Initialize request argument(s)
            GetVpnTunnelRequest request = new GetVpnTunnelRequest
            {
                Region    = "",
                VpnTunnel = "",
                Project   = "",
            };
            // Make the request
            VpnTunnel response = await vpnTunnelsClient.GetAsync(request);

            // End snippet
        }
Пример #11
0
        /// <summary>
        /// Creates a VpnTunnel resource in the specified project and region using the data included in the request.
        /// Documentation https://developers.google.com/compute/v1/reference/vpnTunnels/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="region">Name of the region for this request.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, string region, VpnTunnel body, VpnTunnelsInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }

                // Building the initial request.
                var request = service.VpnTunnels.Insert(body, project, region);

                // Applying optional parameters to the request.
                request = (VpnTunnelsResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request VpnTunnels.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Creates a VpnTunnel resource in the specified project and region using the data included in the request.
        /// Documentation https://developers.google.com/compute/beta/reference/vpnTunnels/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="region">Name of the region for this request.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(computeService service, string project, string region, VpnTunnel body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }

                // Make the request.
                return(service.VpnTunnels.Insert(body, project, region).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request VpnTunnels.Insert failed.", ex);
            }
        }
 /// <summary>
 /// Creates a VpnTunnel resource in the specified project and region using the data included in the request.
 /// </summary>
 /// <param name="project">
 /// Project ID for this request.
 /// </param>
 /// <param name="region">
 /// Name of the region for this request.
 /// </param>
 /// <param name="vpnTunnelResource">
 /// 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> InsertAsync(string project, string region, VpnTunnel vpnTunnelResource, st::CancellationToken cancellationToken) =>
 InsertAsync(project, region, vpnTunnelResource, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));