private void HandleOutput(ChangeDedicatedVmHostCompartmentRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case StatusParamSet: response = client.Waiters.ForChangeDedicatedVmHostCompartment(request, waiterConfig, WaitForStatus).Execute(); break; case Default: response = client.ChangeDedicatedVmHostCompartment(request).GetAwaiter().GetResult(); break; } WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); }
protected override void ProcessRecord() { base.ProcessRecord(); ChangeDedicatedVmHostCompartmentRequest request; try { request = new ChangeDedicatedVmHostCompartmentRequest { DedicatedVmHostId = DedicatedVmHostId, ChangeDedicatedVmHostCompartmentDetails = ChangeDedicatedVmHostCompartmentDetails, IfMatch = IfMatch, OpcRequestId = OpcRequestId, 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 <ChangeDedicatedVmHostCompartmentRequest, ChangeDedicatedVmHostCompartmentResponse> ForChangeDedicatedVmHostCompartment(ChangeDedicatedVmHostCompartmentRequest request, WaiterConfiguration config, params WorkrequestsService.Models.WorkRequest.StatusEnum[] targetStates) { return(new Waiter <ChangeDedicatedVmHostCompartmentRequest, ChangeDedicatedVmHostCompartmentResponse>(() => { var response = client.ChangeDedicatedVmHostCompartment(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 <ChangeDedicatedVmHostCompartmentRequest, ChangeDedicatedVmHostCompartmentResponse> ForChangeDedicatedVmHostCompartment(ChangeDedicatedVmHostCompartmentRequest request, params WorkrequestsService.Models.WorkRequest.StatusEnum[] targetStates) { return(this.ForChangeDedicatedVmHostCompartment(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }