private void HandleOutput(GetGenericArtifactRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForGenericArtifact(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetGenericArtifact(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.GenericArtifact); }
protected override void ProcessRecord() { base.ProcessRecord(); GetGenericArtifactRequest request; try { request = new GetGenericArtifactRequest { ArtifactId = ArtifactId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <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 <GetGenericArtifactRequest, GetGenericArtifactResponse> ForGenericArtifact(GetGenericArtifactRequest request, params GenericArtifact.LifecycleStateEnum[] targetStates) { return(this.ForGenericArtifact(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }
/// <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 <GetGenericArtifactRequest, GetGenericArtifactResponse> ForGenericArtifact(GetGenericArtifactRequest request, WaiterConfiguration config, params GenericArtifact.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetGenericArtifactRequest, GetGenericArtifactResponse>( request, request => client.GetGenericArtifact(request), response => targetStates.Contains(response.GenericArtifact.LifecycleState.Value), targetStates.Contains(GenericArtifact.LifecycleStateEnum.Deleted) ); return(new Waiter <GetGenericArtifactRequest, GetGenericArtifactResponse>(config, agent)); }