private void HandleOutput(GetPrivateApplicationRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForPrivateApplication(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetPrivateApplication(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.PrivateApplication); }
protected override void ProcessRecord() { base.ProcessRecord(); GetPrivateApplicationRequest request; try { request = new GetPrivateApplicationRequest { PrivateApplicationId = PrivateApplicationId, OpcRequestId = OpcRequestId }; 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 <GetPrivateApplicationRequest, GetPrivateApplicationResponse> ForPrivateApplication(GetPrivateApplicationRequest request, WaiterConfiguration config, params PrivateApplication.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetPrivateApplicationRequest, GetPrivateApplicationResponse>( request, request => client.GetPrivateApplication(request), response => targetStates.Contains(response.PrivateApplication.LifecycleState.Value), targetStates.Contains(PrivateApplication.LifecycleStateEnum.Deleted) ); return(new Waiter <GetPrivateApplicationRequest, GetPrivateApplicationResponse>(config, agent)); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</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 <GetPrivateApplicationRequest, GetPrivateApplicationResponse> ForPrivateApplication(GetPrivateApplicationRequest request, params PrivateApplication.LifecycleStateEnum[] targetStates) { return(this.ForPrivateApplication(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }