private void RemoveInstanceFromPool(string project, string region, string name) { TargetPoolsRemoveInstanceRequest removeBody = new TargetPoolsRemoveInstanceRequest { Instances = RemoveInstance.Select(i => new InstanceReference { Instance = i }).ToList() }; AddRegionOperation(project, region, Service.TargetPools.RemoveInstance(removeBody, project, region, name).Execute(), () => WriteObject(Service.TargetPools.Get(project, region, name).Execute())); }
/// <summary>Snippet for RemoveInstance</summary> public void RemoveInstance() { // Snippet: RemoveInstance(string, string, string, TargetPoolsRemoveInstanceRequest, CallSettings) // Create client TargetPoolsClient targetPoolsClient = TargetPoolsClient.Create(); // Initialize request argument(s) string project = ""; string region = ""; string targetPool = ""; TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = new TargetPoolsRemoveInstanceRequest(); // Make the request Operation response = targetPoolsClient.RemoveInstance(project, region, targetPool, targetPoolsRemoveInstanceRequestResource); // End snippet }
/// <summary>Snippet for RemoveInstanceAsync</summary> public async Task RemoveInstanceAsync() { // Snippet: RemoveInstanceAsync(string, string, string, TargetPoolsRemoveInstanceRequest, CallSettings) // Additional: RemoveInstanceAsync(string, string, string, TargetPoolsRemoveInstanceRequest, CancellationToken) // Create client TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; string targetPool = ""; TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = new TargetPoolsRemoveInstanceRequest(); // Make the request Operation response = await targetPoolsClient.RemoveInstanceAsync(project, region, targetPool, targetPoolsRemoveInstanceRequestResource); // End snippet }
/// <summary> /// Removes instance URL from a target pool. /// Documentation https://developers.google.com/compute/beta/reference/targetPools/removeInstance /// 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="targetPool">Name of the TargetPool resource to remove instances from.</param> /// <param name="body">A valid compute beta body.</param> /// <returns>OperationResponse</returns> public static Operation RemoveInstance(computeService service, string project, string region, string targetPool, TargetPoolsRemoveInstanceRequest 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 (targetPool == null) { throw new ArgumentNullException(targetPool); } // Make the request. return(service.TargetPools.RemoveInstance(body, project, region, targetPool).Execute()); } catch (Exception ex) { throw new Exception("Request TargetPools.RemoveInstance failed.", ex); } }
/// <summary> /// Removes instance URL from a target pool. /// Documentation https://developers.google.com/compute/alpha/reference/targetPools/removeInstance /// 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="targetPool">Name of the TargetPool resource to remove instances from.</param> /// <param name="body">A valid Compute alpha body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>OperationResponse</returns> public static Operation RemoveInstance(ComputeService service, string project, string region, string targetPool, TargetPoolsRemoveInstanceRequest body, TargetPoolsRemoveInstanceOptionalParms 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 (targetPool == null) { throw new ArgumentNullException(targetPool); } // Building the initial request. var request = service.TargetPools.RemoveInstance(body, project, region, targetPool); // Applying optional parameters to the request. request = (TargetPoolsResource.RemoveInstanceRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request TargetPools.RemoveInstance failed.", ex); } }