/// <summary>
        /// Removes the specified instances from the managed instance group, and from any target pools of which they were members, without deleting the instances.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/abandonInstances
        /// 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 replicapool service.</param>
        /// <param name="project">The Google Developers Console project name.</param>
        /// <param name="zone">The name of the zone in which the instance group manager resides.</param>
        /// <param name="instanceGroupManager">The name of the instance group manager.</param>
        /// <param name="body">A valid replicapool v1beta2 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AbandonInstances(replicapoolService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest 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 (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

                // Make the request.
                return(service.InstanceGroupManagers.AbandonInstances(body, project, zone, instanceGroupManager).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.AbandonInstances failed.", ex);
            }
        }
        /// <summary>
        /// Restarts a replica in a pool.
        /// Documentation https://developers.google.com/replicapool/v1beta1/reference/replicas/restart
        /// 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 replicapool service.</param>
        /// <param name="projectName">The project ID for this request.</param>
        /// <param name="zone">The zone where the replica lives.</param>
        /// <param name="poolName">The replica pool name for this request.</param>
        /// <param name="replicaName">The name of the replica for this request.</param>
        /// <returns>ReplicaResponse</returns>
        public static Replica Restart(replicapoolService service, string projectName, string zone, string poolName, string replicaName)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectName == null)
                {
                    throw new ArgumentNullException(projectName);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (poolName == null)
                {
                    throw new ArgumentNullException(poolName);
                }
                if (replicaName == null)
                {
                    throw new ArgumentNullException(replicaName);
                }

                // Make the request.
                return(service.Replicas.Restart(projectName, zone, poolName, replicaName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Replicas.Restart failed.", ex);
            }
        }
        /// <summary>
        /// Resizes the managed instance group up or down. If resized up, new instances are created using the current instance template. If resized down, instances are removed in the order outlined in Resizing a managed instance group.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/resize
        /// 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 replicapool service.</param>
        /// <param name="project">The Google Developers Console project name.</param>
        /// <param name="zone">The name of the zone in which the instance group manager resides.</param>
        /// <param name="instanceGroupManager">The name of the instance group manager.</param>
        /// <param name="size">Number of instances that should exist in this Instance Group Manager.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Resize(replicapoolService service, string project, string zone, string instanceGroupManager, int size)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

                // Make the request.
                return(service.InstanceGroupManagers.Resize(project, zone, instanceGroupManager, size).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.Resize failed.", ex);
            }
        }
        /// <summary>
        /// Retrieves the list of Instance Group Manager resources contained within the specified zone.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/list
        /// 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 replicapool service.</param>
        /// <param name="project">The Google Developers Console project name.</param>
        /// <param name="zone">The name of the zone in which the instance group manager resides.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>InstanceGroupManagerListResponse</returns>
        public static InstanceGroupManagerList List(replicapoolService service, string project, string zone, InstanceGroupManagersListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }

                // Building the initial request.
                var request = service.InstanceGroupManagers.List(project, zone);

                // Applying optional parameters to the request.
                request = (InstanceGroupManagersResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.List failed.", ex);
            }
        }
        /// <summary>
        /// Deletes a replica pool.
        /// Documentation https://developers.google.com/replicapool/v1beta1/reference/pools/delete
        /// 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 replicapool service.</param>
        /// <param name="projectName">The project ID for this replica pool.</param>
        /// <param name="zone">The zone for this replica pool.</param>
        /// <param name="poolName">The name of the replica pool for this request.</param>
        /// <param name="body">A valid replicapool v1beta1 body.</param>
        public static void Delete(replicapoolService service, string projectName, string zone, string poolName, PoolsDeleteRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectName == null)
                {
                    throw new ArgumentNullException(projectName);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (poolName == null)
                {
                    throw new ArgumentNullException(poolName);
                }

                // Make the request.
                return(service.Pools.Delete(body, projectName, zone, poolName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Pools.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Retrieves the specified zone-specific operation resource.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/zoneOperations/get
        /// 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 replicapool service.</param>
        /// <param name="project">Name of the project scoping this request.</param>
        /// <param name="zone">Name of the zone scoping this request.</param>
        /// <param name="operation">Name of the operation resource to return.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Get(replicapoolService service, string project, string zone, string operation)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (operation == null)
                {
                    throw new ArgumentNullException(operation);
                }

                // Make the request.
                return(service.ZoneOperations.Get(project, zone, operation).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request ZoneOperations.Get failed.", ex);
            }
        }
        /// <summary>
        /// Resize a pool. This is an asynchronous operation, and multiple overlapping resize requests can be made. Replica Pools will use the information from the last resize request.
        /// Documentation https://developers.google.com/replicapool/v1beta1/reference/pools/resize
        /// 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 replicapool service.</param>
        /// <param name="projectName">The project ID for this replica pool.</param>
        /// <param name="zone">The zone for this replica pool.</param>
        /// <param name="poolName">The name of the replica pool for this request.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>PoolResponse</returns>
        public static Pool Resize(replicapoolService service, string projectName, string zone, string poolName, PoolsResizeOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectName == null)
                {
                    throw new ArgumentNullException(projectName);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (poolName == null)
                {
                    throw new ArgumentNullException(poolName);
                }

                // Building the initial request.
                var request = service.Pools.Resize(projectName, zone, poolName);

                // Applying optional parameters to the request.
                request = (PoolsResource.ResizeRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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