private void SetTemplate()
        {
            InstanceGroupManagersSetInstanceTemplateRequest body =
                new InstanceGroupManagersSetInstanceTemplateRequest
            {
                InstanceTemplate = Template
            };

            if (ShouldProcess($"{Project}/{Zone}/{Name}", "Set Template"))
            {
                InstanceGroupManagersResource.SetInstanceTemplateRequest request =
                    Service.InstanceGroupManagers.SetInstanceTemplate(body, Project, Zone, Name);
                Operation operation = request.Execute();
                AddZoneOperation(Project, Zone, operation, () =>
                {
                    WriteObject(Service.InstanceGroupManagers.Get(Project, Zone, Name));
                });
            }
        }
        /// <summary>
        /// Sets the instance template to use when creating new instances in this group. Existing instances are not affected.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/setInstanceTemplate
        /// 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 SetInstanceTemplate(ReplicapoolService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersSetInstanceTemplateRequest 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.SetInstanceTemplate(body, project, zone, instanceGroupManager).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.SetInstanceTemplate failed.", ex);
            }
        }
 private void SetTemplate()
 {
     InstanceGroupManagersSetInstanceTemplateRequest body =
         new InstanceGroupManagersSetInstanceTemplateRequest
         {
             InstanceTemplate = Template
         };
     if (ShouldProcess($"{Project}/{Zone}/{Name}", "Set Template"))
     {
         InstanceGroupManagersResource.SetInstanceTemplateRequest request =
             Service.InstanceGroupManagers.SetInstanceTemplate(body, Project, Zone, Name);
         Operation operation = request.Execute();
         AddZoneOperation(Project, Zone, operation, () =>
         {
             WriteObject(Service.InstanceGroupManagers.Get(Project, Zone, Name));
         });
     }
 }
Exemple #4
0
        /// <summary>
        /// Specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you recreate them.
        /// Documentation https://developers.google.com/compute/v1/reference/instanceGroupManagers/setInstanceTemplate
        /// 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 SetInstanceTemplate(ComputeService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersSetInstanceTemplateRequest body, InstanceGroupManagersSetInstanceTemplateOptionalParms 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.SetInstanceTemplate(body, project, zone, instanceGroupManager);

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

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