Esempio n. 1
0
 /// <summary>Snippet for RemoveInstances</summary>
 public void RemoveInstances()
 {
     // Snippet: RemoveInstances(string, string, string, InstanceGroupsRemoveInstancesRequest, CallSettings)
     // Create client
     InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.Create();
     // Initialize request argument(s)
     string project       = "";
     string zone          = "";
     string instanceGroup = "";
     InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = new InstanceGroupsRemoveInstancesRequest();
     // Make the request
     Operation response = instanceGroupsClient.RemoveInstances(project, zone, instanceGroup, instanceGroupsRemoveInstancesRequestResource);
     // End snippet
 }
Esempio n. 2
0
        /// <summary>Snippet for RemoveInstancesAsync</summary>
        public async Task RemoveInstancesAsync()
        {
            // Snippet: RemoveInstancesAsync(string, string, string, InstanceGroupsRemoveInstancesRequest, CallSettings)
            // Additional: RemoveInstancesAsync(string, string, string, InstanceGroupsRemoveInstancesRequest, CancellationToken)
            // Create client
            InstanceGroupsClient instanceGroupsClient = await InstanceGroupsClient.CreateAsync();

            // Initialize request argument(s)
            string project       = "";
            string zone          = "";
            string instanceGroup = "";
            InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = new InstanceGroupsRemoveInstancesRequest();
            // Make the request
            Operation response = await instanceGroupsClient.RemoveInstancesAsync(project, zone, instanceGroup, instanceGroupsRemoveInstancesRequestResource);

            // End snippet
        }
Esempio n. 3
0
        /// <summary>
        /// Removes one or more instances from the specified instance group, but does not delete those instances.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 before the VM instance is removed or deleted.
        /// Documentation https://developers.google.com/compute/beta/reference/instanceGroups/removeInstances
        /// 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 instance group is located.</param>
        /// <param name="instanceGroup">The name of the instance group where the specified instances will be removed.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation RemoveInstances(ComputeService service, string project, string zone, string instanceGroup, InstanceGroupsRemoveInstancesRequest body, InstanceGroupsRemoveInstancesOptionalParms 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 (instanceGroup == null)
                {
                    throw new ArgumentNullException(instanceGroup);
                }

                // Building the initial request.
                var request = service.InstanceGroups.RemoveInstances(body, project, zone, instanceGroup);

                // Applying optional parameters to the request.
                request = (InstanceGroupsResource.RemoveInstancesRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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