Exemple #1
0
 /// <summary>
 /// Creates a target VPN gateway 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="targetVpnGatewayResource">
 /// 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, TargetVpnGateway targetVpnGatewayResource, gaxgrpc::CallSettings callSettings = null) =>
 Insert(new InsertTargetVpnGatewayRequest
 {
     Project = gax::GaxPreconditions.CheckNotNullOrEmpty(project, nameof(project)),
     Region  = gax::GaxPreconditions.CheckNotNullOrEmpty(region, nameof(region)),
     TargetVpnGatewayResource = gax::GaxPreconditions.CheckNotNull(targetVpnGatewayResource, nameof(targetVpnGatewayResource)),
 }, callSettings);
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, TargetVpnGateway, CallSettings)
            // Additional: InsertAsync(string, string, TargetVpnGateway, CancellationToken)
            // Create client
            TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync();

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

            // 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 targetVpnGatewaysClient.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 void Get()
        {
            moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient> mockGrpcClient = new moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient>(moq::MockBehavior.Strict);
            GetTargetVpnGatewayRequest request = new GetTargetVpnGatewayRequest
            {
                Region           = "regionedb20d96",
                Project          = "projectaa6ff846",
                TargetVpnGateway = "target_vpn_gateway6c481371",
            };
            TargetVpnGateway expectedResponse = new TargetVpnGateway
            {
                Id   = "id74b70bb8",
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                Tunnels           = { "tunnelsf736a212", },
                Region            = "regionedb20d96",
                Status            = TargetVpnGateway.Types.Status.Ready,
                Network           = "networkd22ce091",
                ForwardingRules   =
                {
                    "forwarding_rulesf78b2720",
                },
                Description = "description2cf9da67",
                SelfLink    = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, string, CallSettings)
     // Create client
     TargetVpnGatewaysClient targetVpnGatewaysClient = TargetVpnGatewaysClient.Create();
     // Initialize request argument(s)
     string project          = "";
     string region           = "";
     string targetVpnGateway = "";
     // Make the request
     TargetVpnGateway response = targetVpnGatewaysClient.Get(project, region, targetVpnGateway);
     // End snippet
 }
Exemple #5
0
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, string, TargetVpnGateway, CallSettings)
     // Create client
     TargetVpnGatewaysClient targetVpnGatewaysClient = TargetVpnGatewaysClient.Create();
     // Initialize request argument(s)
     string           project = "";
     string           region  = "";
     TargetVpnGateway targetVpnGatewayResource = new TargetVpnGateway();
     // Make the request
     Operation response = targetVpnGatewaysClient.Insert(project, region, targetVpnGatewayResource);
     // 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
            TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync();

            // Initialize request argument(s)
            string project          = "";
            string region           = "";
            string targetVpnGateway = "";
            // Make the request
            TargetVpnGateway response = await targetVpnGatewaysClient.GetAsync(project, region, targetVpnGateway);

            // End snippet
        }
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetTargetVpnGatewayRequest, CallSettings)
     // Create client
     TargetVpnGatewaysClient targetVpnGatewaysClient = TargetVpnGatewaysClient.Create();
     // Initialize request argument(s)
     GetTargetVpnGatewayRequest request = new GetTargetVpnGatewayRequest
     {
         Region           = "",
         Project          = "",
         TargetVpnGateway = "",
     };
     // Make the request
     TargetVpnGateway response = targetVpnGatewaysClient.Get(request);
     // End snippet
 }
Exemple #8
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, TargetVpnGateway, CallSettings)
            // Additional: InsertAsync(string, string, TargetVpnGateway, CancellationToken)
            // Create client
            TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync();

            // Initialize request argument(s)
            string           project = "";
            string           region  = "";
            TargetVpnGateway targetVpnGatewayResource = new TargetVpnGateway();
            // Make the request
            Operation response = await targetVpnGatewaysClient.InsertAsync(project, region, targetVpnGatewayResource);

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

            // Initialize request argument(s)
            GetTargetVpnGatewayRequest request = new GetTargetVpnGatewayRequest
            {
                Region           = "",
                Project          = "",
                TargetVpnGateway = "",
            };
            // Make the request
            TargetVpnGateway response = await targetVpnGatewaysClient.GetAsync(request);

            // End snippet
        }
Exemple #10
0
        public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient> mockGrpcClient = new moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetTargetVpnGatewayRequest request = new GetTargetVpnGatewayRequest
            {
                Region           = "regionedb20d96",
                Project          = "projectaa6ff846",
                TargetVpnGateway = "target_vpn_gateway6c481371",
            };
            TargetVpnGateway expectedResponse = new TargetVpnGateway
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                Tunnels           = { "tunnelsf736a212", },
                Region            = "regionedb20d96",
                Status            = "status5444cb9a",
                Network           = "networkd22ce091",
                ForwardingRules   =
                {
                    "forwarding_rulesf78b2720",
                },
                Description = "description2cf9da67",
                SelfLink    = "self_link7e87f12d",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>
        /// Creates a target VPN gateway in the specified project and region using the data included in the request.
        /// Documentation https://developers.google.com/compute/v1/reference/targetVpnGateways/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>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(computeService service, string project, string region, TargetVpnGateway 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.TargetVpnGateways.Insert(body, project, region).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetVpnGateways.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Creates a target VPN gateway in the specified project and region using the data included in the request.
        /// Documentation https://developers.google.com/compute/alpha/reference/targetVpnGateways/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 alpha body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, string region, TargetVpnGateway body, TargetVpnGatewaysInsertOptionalParms 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.TargetVpnGateways.Insert(body, project, region);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetVpnGateways.Insert failed.", ex);
            }
        }
Exemple #13
0
 /// <summary>
 /// Creates a target VPN gateway 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="targetVpnGatewayResource">
 /// 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, TargetVpnGateway targetVpnGatewayResource, st::CancellationToken cancellationToken) =>
 InsertAsync(project, region, targetVpnGatewayResource, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));