Example #1
0
        /// <summary>
        /// Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method.If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted.You can specify a maximum of 1000 instances with this method per request.
        /// Documentation https://developers.google.com/compute/v1/reference/regionInstanceGroupManagers/recreateInstances
        /// 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="instanceGroupManager">Name of the managed instance group.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation RecreateInstances(ComputeService service, string project, string region, string instanceGroupManager, RegionInstanceGroupManagersRecreateRequest body, RegionInstanceGroupManagersRecreateInstancesOptionalParms 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 (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

                // Building the initial request.
                var request = service.RegionInstanceGroupManagers.RecreateInstances(body, project, region, instanceGroupManager);

                // Applying optional parameters to the request.
                request = (RegionInstanceGroupManagersResource.RecreateInstancesRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RegionInstanceGroupManagers.RecreateInstances failed.", ex);
            }
        }
        /// <summary>
        /// Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method.
        /// Documentation https://developers.google.com/compute/beta/reference/regionInstanceGroupManagers/recreateInstances
        /// 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="instanceGroupManager">Name of the managed instance group.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation RecreateInstances(computeService service, string project, string region, string instanceGroupManager, RegionInstanceGroupManagersRecreateRequest 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 (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

                // Make the request.
                return(service.RegionInstanceGroupManagers.RecreateInstances(body, project, region, instanceGroupManager).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RegionInstanceGroupManagers.RecreateInstances failed.", ex);
            }
        }