Public/System/Set-SIAModuleConfiguration.ps1
|
function Set-SIAModuleConfiguration { <# .SYNOPSIS Changes psSIA's module-wide configuration. .DESCRIPTION Updates the request timeout, retry behavior, auto-pagination, or log level used by Invoke-SIARequest for the rest of the PowerShell session. Only the values you supply are changed; everything else keeps its current value. .PARAMETER RequestTimeout Timeout, in seconds, for each HTTP request. Default is 30. .PARAMETER RetryCount Maximum attempts for a retryable GET request. Default is 3. .PARAMETER RetryDelay Base delay, in seconds, between retries when the API does not return a Retry-After header. Default is 2. .PARAMETER AutoPagination Whether cmdlets that support paged results retrieve every page automatically. Default is $true. .PARAMETER LogLevel Verbosity used for internal diagnostic messages. .EXAMPLE Set-SIAModuleConfiguration -RequestTimeout 60 -RetryCount 5 Raises the timeout and retry count for a slow network. .INPUTS None. .OUTPUTS psSIA.ModuleConfiguration #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] [OutputType('psSIA.ModuleConfiguration')] param( [ValidateRange(1, 600)] [int]$RequestTimeout, [ValidateRange(0, 10)] [int]$RetryCount, [ValidateRange(0, 60)] [int]$RetryDelay, [bool]$AutoPagination, [ValidateSet('Silent', 'Normal', 'Verbose')] [string]$LogLevel ) if (-not $PSCmdlet.ShouldProcess('psSIA module configuration', 'Update')) { return } foreach ($name in 'RequestTimeout', 'RetryCount', 'RetryDelay', 'AutoPagination', 'LogLevel') { if ($PSBoundParameters.ContainsKey($name)) { $script:SIAModuleConfig.$name = $PSBoundParameters[$name] } } Get-SIAModuleConfiguration } |