/// <summary>Snippet for AddHealthCheck</summary>
 public void AddHealthCheck()
 {
     // Snippet: AddHealthCheck(string, string, string, TargetPoolsAddHealthCheckRequest, CallSettings)
     // Create client
     TargetPoolsClient targetPoolsClient = TargetPoolsClient.Create();
     // Initialize request argument(s)
     string project    = "";
     string region     = "";
     string targetPool = "";
     TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = new TargetPoolsAddHealthCheckRequest();
     // Make the request
     Operation response = targetPoolsClient.AddHealthCheck(project, region, targetPool, targetPoolsAddHealthCheckRequestResource);
     // End snippet
 }
        /// <summary>Snippet for AddHealthCheckAsync</summary>
        public async Task AddHealthCheckAsync()
        {
            // Snippet: AddHealthCheckAsync(string, string, string, TargetPoolsAddHealthCheckRequest, CallSettings)
            // Additional: AddHealthCheckAsync(string, string, string, TargetPoolsAddHealthCheckRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            string project    = "";
            string region     = "";
            string targetPool = "";
            TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = new TargetPoolsAddHealthCheckRequest();
            // Make the request
            Operation response = await targetPoolsClient.AddHealthCheckAsync(project, region, targetPool, targetPoolsAddHealthCheckRequestResource);

            // End snippet
        }
        /// <summary>
        /// Adds health check URLs to a target pool.
        /// Documentation https://developers.google.com/compute/beta/reference/targetPools/addHealthCheck
        /// 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="targetPool">Name of the target pool to add a health check to.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AddHealthCheck(computeService service, string project, string region, string targetPool, TargetPoolsAddHealthCheckRequest 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);
                }
                if (targetPool == null)
                {
                    throw new ArgumentNullException(targetPool);
                }

                // Make the request.
                return(service.TargetPools.AddHealthCheck(body, project, region, targetPool).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetPools.AddHealthCheck failed.", ex);
            }
        }
Exemple #4
0
        /// <summary>
        /// Adds health check URLs to a target pool.
        /// Documentation https://developers.google.com/compute/alpha/reference/targetPools/addHealthCheck
        /// 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="targetPool">Name of the target pool to add a health check to.</param>
        /// <param name="body">A valid Compute alpha body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AddHealthCheck(ComputeService service, string project, string region, string targetPool, TargetPoolsAddHealthCheckRequest body, TargetPoolsAddHealthCheckOptionalParms 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 (targetPool == null)
                {
                    throw new ArgumentNullException(targetPool);
                }

                // Building the initial request.
                var request = service.TargetPools.AddHealthCheck(body, project, region, targetPool);

                // Applying optional parameters to the request.
                request = (TargetPoolsResource.AddHealthCheckRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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