private void SetTargetPools()
        {
            var body = new InstanceGroupManagersSetTargetPoolsRequest()
            {
                TargetPools = TargetPoolUri
            };

            if (ShouldProcess($"{Project}/{Zone}/{Name}", "Set Target Pools"))
            {
                InstanceGroupManagersResource.SetTargetPoolsRequest request =
                    Service.InstanceGroupManagers.SetTargetPools(body, Project, Zone, Name);
                Operation operation = request.Execute();
                AddZoneOperation(Project, Zone, operation, () =>
                {
                    WriteObject(Service.InstanceGroupManagers.Get(Project, Zone, Name));
                });
            }
        }
        /// <summary>
        /// Modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/setTargetPools
        /// 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 SetTargetPools(ReplicapoolService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersSetTargetPoolsRequest 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.SetTargetPools(body, project, zone, instanceGroupManager).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.SetTargetPools failed.", ex);
            }
        }
 private void SetTargetPools()
 {
     var body = new InstanceGroupManagersSetTargetPoolsRequest()
     {
         TargetPools = TargetPoolUri
     };
     if (ShouldProcess($"{Project}/{Zone}/{Name}", "Set Target Pools"))
     {
         InstanceGroupManagersResource.SetTargetPoolsRequest request =
             Service.InstanceGroupManagers.SetTargetPools(body, Project, Zone, Name);
         Operation operation = request.Execute();
         AddZoneOperation(Project, Zone, operation, () =>
         {
             WriteObject(Service.InstanceGroupManagers.Get(Project, Zone, Name));
         });
     }
 }
示例#4
0
        /// <summary>
        /// Modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group.
        /// Documentation https://developers.google.com/compute/v1/reference/instanceGroupManagers/setTargetPools
        /// 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 SetTargetPools(ComputeService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersSetTargetPoolsRequest body, InstanceGroupManagersSetTargetPoolsOptionalParms 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.SetTargetPools(body, project, zone, instanceGroupManager);

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

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