private void HandleOutput(DetachInstancePoolInstanceRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case StatusParamSet: response = client.Waiters.ForDetachInstancePoolInstance(request, waiterConfig, WaitForStatus).Execute(); break; case Default: response = client.DetachInstancePoolInstance(request).GetAwaiter().GetResult(); break; } WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); }
protected override void ProcessRecord() { base.ProcessRecord(); DetachInstancePoolInstanceRequest request; try { request = new DetachInstancePoolInstanceRequest { InstancePoolId = InstancePoolId, DetachInstancePoolInstanceDetails = DetachInstancePoolInstanceDetails, OpcRetryToken = OpcRetryToken }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <DetachInstancePoolInstanceRequest, DetachInstancePoolInstanceResponse> ForDetachInstancePoolInstance(DetachInstancePoolInstanceRequest request, WaiterConfiguration config, params WorkrequestsService.Models.WorkRequest.StatusEnum[] targetStates) { return(new Waiter <DetachInstancePoolInstanceRequest, DetachInstancePoolInstanceResponse>(() => { var response = client.DetachInstancePoolInstance(request).Result; var getWorkRequestRequest = new Oci.WorkrequestsService.Requests.GetWorkRequestRequest { WorkRequestId = response.OpcWorkRequestId }; workRequestClient.Waiters.ForWorkRequest(getWorkRequestRequest, config, targetStates).Execute(); return response; })); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="statuses">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <DetachInstancePoolInstanceRequest, DetachInstancePoolInstanceResponse> ForDetachInstancePoolInstance(DetachInstancePoolInstanceRequest request, params WorkrequestsService.Models.WorkRequest.StatusEnum[] targetStates) { return(this.ForDetachInstancePoolInstance(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }