private void RecreateUri()
        {
            var body = new InstanceGroupManagersRecreateInstancesRequest
            {
                Instances = InstanceUri
            };

            if (ShouldProcess("Recreating instances: " + JoinInstanceNames(body.Instances), null,
                              $"Managed Instance Group {Project}/{Zone}/{Name}"))
            {
                InstanceGroupManagersResource.RecreateInstancesRequest request =
                    Service.InstanceGroupManagers.RecreateInstances(body, Project, Zone, Name);
                Operation operation = request.Execute();
                AddZoneOperation(Project, Zone, operation, () =>
                {
                    WriteObject(Service.InstanceGroupManagers.Get(Project, Zone, Name));
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// Recreates the specified instances. The instances are deleted, then recreated using the instance group manager's current instance template.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/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 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 RecreateInstances(ReplicapoolService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersRecreateInstancesRequest 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.RecreateInstances(body, project, zone, instanceGroupManager).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.RecreateInstances failed.", ex);
            }
        }
 private void RecreateUri()
 {
     var body = new InstanceGroupManagersRecreateInstancesRequest
     {
         Instances = InstanceUri
     };
     if (ShouldProcess("Recreating instances: " + JoinInstanceNames(body.Instances), null,
         $"Managed Instance Group {Project}/{Zone}/{Name}"))
     {
         InstanceGroupManagersResource.RecreateInstancesRequest request =
             Service.InstanceGroupManagers.RecreateInstances(body, Project, Zone, Name);
         Operation operation = request.Execute();
         AddZoneOperation(Project, Zone, operation, () =>
         {
             WriteObject(Service.InstanceGroupManagers.Get(Project, Zone, Name));
         });
     }
 }
コード例 #4
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/instanceGroupManagers/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="zone">The name of the zone where the managed instance group is located.</param>
        /// <param name="instanceGroupManager">The 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 zone, string instanceGroupManager, InstanceGroupManagersRecreateInstancesRequest body, InstanceGroupManagersRecreateInstancesOptionalParms 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 (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

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

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

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