/// <summary>
        /// Creates a ForwardingRule resource in the specified project and region using the data included in the request.
        /// Documentation https://developers.google.com/compute/alpha/reference/globalForwardingRules/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="body">A valid compute alpha body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(computeService service, string project, ForwardingRule 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);
                }

                // Make the request.
                return(service.GlobalForwardingRules.Insert(body, project).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request GlobalForwardingRules.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Creates a GlobalForwardingRule resource in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/alpha/reference/globalForwardingRules/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="body">A valid Compute alpha body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, ForwardingRule body, GlobalForwardingRulesInsertOptionalParms 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);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request GlobalForwardingRules.Insert failed.", ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>Snippet for PatchAsync</summary>
        public async Task PatchAsync()
        {
            // Snippet: PatchAsync(string, string, ForwardingRule, CallSettings)
            // Additional: PatchAsync(string, string, ForwardingRule, CancellationToken)
            // Create client
            GlobalForwardingRulesClient globalForwardingRulesClient = await GlobalForwardingRulesClient.CreateAsync();

            // Initialize request argument(s)
            string         project                = "";
            string         forwardingRule         = "";
            ForwardingRule forwardingRuleResource = new ForwardingRule();
            // Make the request
            lro::Operation <Operation, Operation> response = await globalForwardingRulesClient.PatchAsync(project, forwardingRule, forwardingRuleResource);

            // 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 globalForwardingRulesClient.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
        }
Exemplo n.º 4
0
        /// <summary>Snippet for Insert</summary>
        public void Insert()
        {
            // Snippet: Insert(string, ForwardingRule, CallSettings)
            // Create client
            GlobalForwardingRulesClient globalForwardingRulesClient = GlobalForwardingRulesClient.Create();
            // Initialize request argument(s)
            string         project = "";
            ForwardingRule forwardingRuleResource = new ForwardingRule();
            // Make the request
            lro::Operation <Operation, Operation> response = globalForwardingRulesClient.Insert(project, forwardingRuleResource);

            // 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 = globalForwardingRulesClient.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
        }
Exemplo n.º 5
0
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, ForwardingRule, CallSettings)
     // Create client
     GlobalForwardingRulesClient globalForwardingRulesClient = GlobalForwardingRulesClient.Create();
     // Initialize request argument(s)
     string         project = "";
     ForwardingRule forwardingRuleResource = new ForwardingRule();
     // Make the request
     Operation response = globalForwardingRulesClient.Insert(project, forwardingRuleResource);
     // End snippet
 }
Exemplo n.º 6
0
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, CallSettings)
     // Create client
     GlobalForwardingRulesClient globalForwardingRulesClient = GlobalForwardingRulesClient.Create();
     // Initialize request argument(s)
     string project        = "";
     string forwardingRule = "";
     // Make the request
     ForwardingRule response = globalForwardingRulesClient.Get(project, forwardingRule);
     // End snippet
 }
Exemplo n.º 7
0
 /// <summary>Snippet for Patch</summary>
 public void Patch()
 {
     // Snippet: Patch(string, string, string, ForwardingRule, CallSettings)
     // Create client
     ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.Create();
     // Initialize request argument(s)
     string         project                = "";
     string         region                 = "";
     string         forwardingRule         = "";
     ForwardingRule forwardingRuleResource = new ForwardingRule();
     // Make the request
     Operation response = forwardingRulesClient.Patch(project, region, forwardingRule, forwardingRuleResource);
     // End snippet
 }
Exemplo n.º 8
0
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetGlobalForwardingRuleRequest, CallSettings)
     // Create client
     GlobalForwardingRulesClient globalForwardingRulesClient = GlobalForwardingRulesClient.Create();
     // Initialize request argument(s)
     GetGlobalForwardingRuleRequest request = new GetGlobalForwardingRuleRequest
     {
         ForwardingRule = "",
         Project        = "",
     };
     // Make the request
     ForwardingRule response = globalForwardingRulesClient.Get(request);
     // End snippet
 }
Exemplo n.º 9
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, ForwardingRule, CallSettings)
            // Additional: InsertAsync(string, ForwardingRule, CancellationToken)
            // Create client
            GlobalForwardingRulesClient globalForwardingRulesClient = await GlobalForwardingRulesClient.CreateAsync();

            // Initialize request argument(s)
            string         project = "";
            ForwardingRule forwardingRuleResource = new ForwardingRule();
            // Make the request
            Operation response = await globalForwardingRulesClient.InsertAsync(project, forwardingRuleResource);

            // End snippet
        }
Exemplo n.º 10
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetAsync()
        {
            // Snippet: GetAsync(string, string, CallSettings)
            // Additional: GetAsync(string, string, CancellationToken)
            // Create client
            GlobalForwardingRulesClient globalForwardingRulesClient = await GlobalForwardingRulesClient.CreateAsync();

            // Initialize request argument(s)
            string project        = "";
            string forwardingRule = "";
            // Make the request
            ForwardingRule response = await globalForwardingRulesClient.GetAsync(project, forwardingRule);

            // End snippet
        }
Exemplo n.º 11
0
        /// <summary>Snippet for PatchAsync</summary>
        public async Task PatchAsync()
        {
            // Snippet: PatchAsync(string, string, string, ForwardingRule, CallSettings)
            // Additional: PatchAsync(string, string, string, ForwardingRule, CancellationToken)
            // Create client
            ForwardingRulesClient forwardingRulesClient = await ForwardingRulesClient.CreateAsync();

            // Initialize request argument(s)
            string         project                = "";
            string         region                 = "";
            string         forwardingRule         = "";
            ForwardingRule forwardingRuleResource = new ForwardingRule();
            // Make the request
            Operation response = await forwardingRulesClient.PatchAsync(project, region, forwardingRule, forwardingRuleResource);

            // End snippet
        }
Exemplo n.º 12
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetGlobalForwardingRuleRequest, CallSettings)
            // Additional: GetAsync(GetGlobalForwardingRuleRequest, CancellationToken)
            // Create client
            GlobalForwardingRulesClient globalForwardingRulesClient = await GlobalForwardingRulesClient.CreateAsync();

            // Initialize request argument(s)
            GetGlobalForwardingRuleRequest request = new GetGlobalForwardingRuleRequest
            {
                ForwardingRule = "",
                Project        = "",
            };
            // Make the request
            ForwardingRule response = await globalForwardingRulesClient.GetAsync(request);

            // End snippet
        }
Exemplo n.º 13
0
        public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <GlobalForwardingRules.GlobalForwardingRulesClient> mockGrpcClient = new moq::Mock <GlobalForwardingRules.GlobalForwardingRulesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetGlobalForwardingRuleRequest request = new GetGlobalForwardingRuleRequest
            {
                Project        = "projectaa6ff846",
                ForwardingRule = "forwarding_rule51d5478e",
            };
            ForwardingRule expectedResponse = new ForwardingRule
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp             = "creation_timestamp235e59a1",
                IPAddress                     = "I_p_addressf1537179",
                Ports                         = { "ports9860f047", },
                IsMirroringCollector          = false,
                Region                        = "regionedb20d96",
                LabelFingerprint              = "label_fingerprint06ccff3a",
                PscConnectionStatus           = "psc_connection_status437a3762",
                Target                        = "targetaefbae42",
                PortRange                     = "port_ranged4420f7d",
                ServiceDirectoryRegistrations =
                {
                    new ForwardingRuleServiceDirectoryRegistration(),
                },
                Network             = "networkd22ce091",
                Fingerprint         = "fingerprint009e6052",
                PscConnectionId     = 1768355415909345202UL,
                IpVersion           = "ip_versionde91b460",
                BackendService      = "backend_serviceed490d45",
                Subnetwork          = "subnetworkf55bf572",
                ServiceName         = "service_named5df05d5",
                LoadBalancingScheme = "load_balancing_scheme21346104",
                ServiceLabel        = "service_label5f95d0c0",
                Description         = "description2cf9da67",
                AllPorts            = false,
                SelfLink            = "self_link7e87f12d",
                MetadataFilters     =
                {
                    new MetadataFilter(),
                },
                IPProtocol        = "I_p_protocold854c15f",
                AllowGlobalAccess = false,
                Labels            =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                NetworkTier = "network_tiere6fea951",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetRequestObject()
        {
            moq::Mock <ForwardingRules.ForwardingRulesClient> mockGrpcClient = new moq::Mock <ForwardingRules.ForwardingRulesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetForwardingRuleRequest request = new GetForwardingRuleRequest
            {
                Region         = "regionedb20d96",
                Project        = "projectaa6ff846",
                ForwardingRule = "forwarding_rule51d5478e",
            };
            ForwardingRule expectedResponse = new ForwardingRule
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp             = "creation_timestamp235e59a1",
                IPAddress                     = "I_p_addressf1537179",
                Ports                         = { "ports9860f047", },
                IsMirroringCollector          = false,
                Region                        = "regionedb20d96",
                LabelFingerprint              = "label_fingerprint06ccff3a",
                PscConnectionStatus           = ForwardingRule.Types.PscConnectionStatus.UndefinedPscConnectionStatus,
                Target                        = "targetaefbae42",
                PortRange                     = "port_ranged4420f7d",
                ServiceDirectoryRegistrations =
                {
                    new ForwardingRuleServiceDirectoryRegistration(),
                },
                Network             = "networkd22ce091",
                Fingerprint         = "fingerprint009e6052",
                PscConnectionId     = 1768355415909345202UL,
                IpVersion           = ForwardingRule.Types.IpVersion.UndefinedIpVersion,
                BackendService      = "backend_serviceed490d45",
                Subnetwork          = "subnetworkf55bf572",
                ServiceName         = "service_named5df05d5",
                LoadBalancingScheme = ForwardingRule.Types.LoadBalancingScheme.UndefinedLoadBalancingScheme,
                ServiceLabel        = "service_label5f95d0c0",
                Description         = "description2cf9da67",
                AllPorts            = false,
                SelfLink            = "self_link7e87f12d",
                MetadataFilters     =
                {
                    new MetadataFilter(),
                },
                IPProtocol        = ForwardingRule.Types.IPProtocol.Udp,
                AllowGlobalAccess = false,
                Labels            =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                NetworkTier = ForwardingRule.Types.NetworkTier.Standard,
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ForwardingRulesClient client   = new ForwardingRulesClientImpl(mockGrpcClient.Object, null);
            ForwardingRule        response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field.
        /// Documentation https://developers.google.com/compute/alpha/reference/forwardingRules/patch
        /// 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 scoping this request.</param>
        /// <param name="forwardingRule">Name of the ForwardingRule resource to patch.</param>
        /// <param name="body">A valid Compute alpha body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Patch(ComputeService service, string project, string region, string forwardingRule, ForwardingRule body, ForwardingRulesPatchOptionalParms 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);
                }
                if (forwardingRule == null)
                {
                    throw new ArgumentNullException(forwardingRule);
                }

                // Building the initial request.
                var request = service.ForwardingRules.Patch(body, project, region, forwardingRule);

                // Applying optional parameters to the request.
                request = (ForwardingRulesResource.PatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request ForwardingRules.Patch failed.", ex);
            }
        }