Venafi / VenafiPS

Powershell module to fully automate your Venafi TLS Protect Datacenter and Cloud platforms!
https://venafips.readthedocs.io/
Apache License 2.0
18 stars 7 forks source link

Allow specifying a Timeout value #237

Closed Saadi6 closed 5 months ago

Saadi6 commented 9 months ago

Summary of the new feature/enhancement

Invoke-WebRequest and Invoke-RestMethod in PowerShell 5.1 have a default timeout of 0 (wait forever). Often times this behaviour is undesirable since this blocks program's execution. Venafi itself imposes a 120 seconds limit on Adaptable framework scripts, which is sometimes hit because Venafi PS was waiting on response from server while creating a new session. Often times this is due to temporary environmental factors such as badly configured load-balancers, network latency, load on server, etc.

Since a developer can anticipate suitable timeout value for an environment they are developing for, ability to set timeout provides a much better way to handle such condition. For e.g. trying again for such (web) exceptions or handling the error differently and then exiting gracefully instead of endlessly waiting or having the entire program forcefully terminated.

While it is possible to define a global timeout using ServicePointManager, this would effect every HTTP request made by the script, and not just the ones made by Venafi PS itself.

Proposed technical implementation details (optional)

Setting Timeout can be achieved by passing a value for timeout property of the underlaying Invoke-WebRequest method with each call to Venafi PS function and/or allow setting a value for timeout when creating a new Venafi session object, which is used while establishing the session and subsequently by all functions when they invoke a call to Venafi’s API.

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 60 days with no activity.