Cif.V3.Management.psm1
# Code in here will be prepended to top of the psm1-file. #Requires -Version 5.0 Set-StrictMode -Version Latest function New-DataBooleanMessage { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${data}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${message} ) Process { 'Creating object: Cif.V3.Management.Model.DataBooleanMessage' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.DataBooleanMessage -ArgumentList @( ${data}, ${message} ) } } function New-DataObjectMessage { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Cif.V3.Management.Model.String]] ${data}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${message} ) Process { 'Creating object: Cif.V3.Management.Model.DataObjectMessage' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.DataObjectMessage -ArgumentList @( ${data}, ${message} ) } } function New-DataTokenMessage { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Cif.V3.Management.Model.Cif.V3.Management.Model.TokenItem]] ${data}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${message} ) Process { 'Creating object: Cif.V3.Management.Model.DataTokenMessage' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.DataTokenMessage -ArgumentList @( ${data}, ${message} ) } } function New-IndicatorItem { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${itype}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${cc}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [String] ${timezone}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String] ${protocol}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [String[]] ${message}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Decimal]] ${id}, [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] [String] ${city}, [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] [String] ${indicator}, [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)] [String] ${reporttime}, [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)] [String] ${group}, [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)] [String] ${asnUnderscoredesc}, [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)] [String] ${provider}, [Parameter(Position = 12, ValueFromPipelineByPropertyName = $true)] [String] ${latitude}, [Parameter(Position = 13, ValueFromPipelineByPropertyName = $true)] [String] ${description}, [Parameter(Position = 14, ValueFromPipelineByPropertyName = $true)] [String[]] ${tags}, [Parameter(Position = 15, ValueFromPipelineByPropertyName = $true)] [String] ${portlist}, [Parameter(Position = 16, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Decimal]] ${confidence}, [Parameter(Position = 17, ValueFromPipelineByPropertyName = $true)] [String] ${rdata}, [Parameter(Position = 18, ValueFromPipelineByPropertyName = $true)] [String] ${lasttime}, [Parameter(Position = 19, ValueFromPipelineByPropertyName = $true)] [String] ${asn}, [Parameter(Position = 20, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Decimal]] ${count}, [Parameter(Position = 21, ValueFromPipelineByPropertyName = $true)] [String] ${peers}, [Parameter(Position = 22, ValueFromPipelineByPropertyName = $true)] [String] ${tlp}, [Parameter(Position = 23, ValueFromPipelineByPropertyName = $true)] [String] ${firsttime}, [Parameter(Position = 24, ValueFromPipelineByPropertyName = $true)] [String] ${region}, [Parameter(Position = 25, ValueFromPipelineByPropertyName = $true)] [String] ${longitude}, [Parameter(Position = 26, ValueFromPipelineByPropertyName = $true)] [String] ${additionalUnderscoredata} ) Process { 'Creating object: Cif.V3.Management.Model.IndicatorItem' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.IndicatorItem -ArgumentList @( ${itype}, ${cc}, ${timezone}, ${protocol}, ${message}, ${id}, ${city}, ${indicator}, ${reporttime}, ${group}, ${asnUnderscoredesc}, ${provider}, ${latitude}, ${description}, ${tags}, ${portlist}, ${confidence}, ${rdata}, ${lasttime}, ${asn}, ${count}, ${peers}, ${tlp}, ${firsttime}, ${region}, ${longitude}, ${additionalUnderscoredata} ) } } function New-IndicatorItemArray { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [Cif.V3.Management.Model.IndicatorItem[]] ${data}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${status} ) Process { 'Creating object: Cif.V3.Management.Model.IndicatorItemArray' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.IndicatorItemArray -ArgumentList @( ${data}, ${status} ) } } function New-IndicatorRequestBody { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${indicator}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String[]] ${tags}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Decimal]] ${confidence}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String] ${group}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [String] ${tlp}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] [String] ${provider} ) Process { 'Creating object: Cif.V3.Management.Model.IndicatorRequestBody' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.IndicatorRequestBody -ArgumentList @( ${indicator}, ${tags}, ${confidence}, ${group}, ${tlp}, ${provider} ) } } function New-TokenItem { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${acl}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${admin}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${expires}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String[]] ${groups}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${id}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${lastUnderscoreactivityUnderscoreat}, [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${read}, [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${revoked}, [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)] [String] ${token}, [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)] [String] ${username}, [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${write} ) Process { 'Creating object: Cif.V3.Management.Model.TokenItem' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.TokenItem -ArgumentList @( ${acl}, ${admin}, ${expires}, ${groups}, ${id}, ${lastUnderscoreactivityUnderscoreat}, ${read}, ${revoked}, ${token}, ${username}, ${write} ) } } function New-TokenItemArray { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [Cif.V3.Management.Model.TokenItem[]] ${data}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${message} ) Process { 'Creating object: Cif.V3.Management.Model.TokenItemArray' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.TokenItemArray -ArgumentList @( ${data}, ${message} ) } } function New-TokensDeleteBody { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${username}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${token} ) Process { 'Creating object: Cif.V3.Management.Model.TokensDeleteBody' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.TokensDeleteBody -ArgumentList @( ${username}, ${token} ) } } function New-TokensRequestBody { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${username}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${admin}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${read}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${revoked}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${write}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] [String[]] ${groups}, [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] [String] ${acl} ) Process { 'Creating object: Cif.V3.Management.Model.TokensRequestBody' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.TokensRequestBody -ArgumentList @( ${username}, ${admin}, ${read}, ${revoked}, ${write}, ${groups}, ${acl} ) } } function New-TokensUpdateBody { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${token}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String[]] ${groups} ) Process { 'Creating object: Cif.V3.Management.Model.TokensUpdateBody' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug New-Object -TypeName Cif.V3.Management.Model.TokensUpdateBody -ArgumentList @( ${token}, ${groups} ) } } function Invoke-HealthApiGetPing { [CmdletBinding()] [Alias('Get-CifPing')] Param ( ) Process { 'Calling method: Invoke-HealthApiGetPing' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:HealthApi.GetPing( ) } } function Invoke-HelpApiGetHelp { [CmdletBinding()] [Alias('Get-CifHelp')] Param ( ) Process { 'Calling method: Invoke-HelpApiGetHelp' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:HelpApi.GetHelp( ) } } function Invoke-HelpApiGetHelpConfidence { [CmdletBinding()] [Alias('Get-CifConfidence')] Param ( ) Process { 'Calling method: Invoke-HelpApiGetHelpConfidence' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:HelpApi.GetHelpConfidence( ) } } function Invoke-IndicatorsApiCreateIndicators { [CmdletBinding()] [Alias('New-CifIndicator')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] [Cif.V3.Management.Model.IndicatorRequestBody] ${indicatorRequestBody} ) Process { 'Calling method: Invoke-IndicatorsApiCreateIndicators' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:IndicatorsApi.CreateIndicators( ${indicatorRequestBody} ) } } function Invoke-IndicatorsApiGetFeed { [CmdletBinding()] [Alias('Get-CifFeed')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] [String] ${itype}, [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${q}, [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int32]] ${nolog}, [Parameter(Position = 3, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${indicator}, [Parameter(Position = 4, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${cc}, [Parameter(Position = 5, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Decimal]] ${asn}, [Parameter(Position = 6, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Decimal]] ${confidence}, [Parameter(Position = 7, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${group}, [Parameter(Position = 8, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${tags}, [Parameter(Position = 9, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${provider}, [Parameter(Position = 10, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${description}, [Parameter(Position = 11, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${rdata}, [Parameter(Position = 12, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${reporttime}, [Parameter(Position = 13, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${firsttime}, [Parameter(Position = 14, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${lasttime}, [Parameter(Position = 15, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int64]] ${limit} ) Process { 'Calling method: Invoke-IndicatorsApiGetFeed' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:IndicatorsApi.GetFeed( ${itype}, ${q}, ${nolog}, ${indicator}, ${cc}, ${asn}, ${confidence}, ${group}, ${tags}, ${provider}, ${description}, ${rdata}, ${reporttime}, ${firsttime}, ${lasttime}, ${limit} ) } } function Invoke-IndicatorsApiGetIndicators { [CmdletBinding()] [Alias('Get-CifIndicator')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${q}, [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${itype}, [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int32]] ${nolog}, [Parameter(Position = 3, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${indicator}, [Parameter(Position = 4, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${cc}, [Parameter(Position = 5, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Decimal]] ${asn}, [Parameter(Position = 6, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Decimal]] ${confidence}, [Parameter(Position = 7, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${group}, [Parameter(Position = 8, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${tags}, [Parameter(Position = 9, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${provider}, [Parameter(Position = 10, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${description}, [Parameter(Position = 11, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${rdata}, [Parameter(Position = 12, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${reporttime}, [Parameter(Position = 13, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${firsttime}, [Parameter(Position = 14, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${lasttime}, [Parameter(Position = 15, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int64]] ${limit} ) Process { 'Calling method: Invoke-IndicatorsApiGetIndicators' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:IndicatorsApi.GetIndicators( ${q}, ${itype}, ${nolog}, ${indicator}, ${cc}, ${asn}, ${confidence}, ${group}, ${tags}, ${provider}, ${description}, ${rdata}, ${reporttime}, ${firsttime}, ${lasttime}, ${limit} ) } } function Invoke-IndicatorsApiGetSearch { [CmdletBinding()] [Alias('Get-CifSearch')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${q}, [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${itype}, [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int32]] ${nolog}, [Parameter(Position = 3, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${indicator}, [Parameter(Position = 4, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${cc}, [Parameter(Position = 5, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Decimal]] ${asn}, [Parameter(Position = 6, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Decimal]] ${confidence}, [Parameter(Position = 7, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${group}, [Parameter(Position = 8, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${tags}, [Parameter(Position = 9, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String[]] ${provider}, [Parameter(Position = 10, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${description}, [Parameter(Position = 11, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${rdata}, [Parameter(Position = 12, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${reporttime}, [Parameter(Position = 13, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${firsttime}, [Parameter(Position = 14, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${lasttime}, [Parameter(Position = 15, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int64]] ${limit} ) Process { 'Calling method: Invoke-IndicatorsApiGetSearch' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:IndicatorsApi.GetSearch( ${q}, ${itype}, ${nolog}, ${indicator}, ${cc}, ${asn}, ${confidence}, ${group}, ${tags}, ${provider}, ${description}, ${rdata}, ${reporttime}, ${firsttime}, ${lasttime}, ${limit} ) } } function Invoke-TokenApiCreateTokens { [CmdletBinding()] [Alias('New-CifToken')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] [Cif.V3.Management.Model.TokensRequestBody] ${tokensRequestBody} ) Process { 'Calling method: Invoke-TokenApiCreateTokens' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:TokenApi.CreateTokens( ${tokensRequestBody} ) } } function Invoke-TokenApiDeleteToken { [CmdletBinding()] [Alias('Remove-CifToken')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] [Cif.V3.Management.Model.TokensDeleteBody] ${tokensDeleteBody} ) Process { 'Calling method: Invoke-TokenApiDeleteToken' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:TokenApi.DeleteToken( ${tokensDeleteBody} ) } } function Invoke-TokenApiGetToken { [CmdletBinding()] [Alias('Get-CifToken')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${username}, [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${token} ) Process { 'Calling method: Invoke-TokenApiGetToken' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:TokenApi.GetToken( ${username}, ${token} ) } } function Invoke-TokenApiUpdateToken { [CmdletBinding()] [Alias('Set-CifToken')] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] [Cif.V3.Management.Model.TokensUpdateBody] ${tokensUpdateBody} ) Process { 'Calling method: Invoke-TokenApiUpdateToken' | Write-Verbose $PSBoundParameters | Out-DebugParameter | Write-Debug $Script:TokenApi.UpdateToken( ${tokensUpdateBody} ) } } <# .Synopsis Helper function to get common parameters (Verbose, Debug, etc.) .Example Get-CommonParameters #> function Get-CommonParameters { function tmp { [CmdletBinding()] Param () } (Get-Command -Name tmp -CommandType Function).Parameters.Keys } <# .Synopsis Helper function to format debug parameter output. .Example $PSBoundParameters | Out-DebugParameter | Write-Debug #> function Out-DebugParameter { [CmdletBinding()] Param ( [Parameter(ValueFromPipeline = $true, Mandatory = $true)] [AllowEmptyCollection()] $InputObject ) Begin { $CommonParameters = Get-CommonParameters } Process { $InputObject.GetEnumerator() | Where-Object { $CommonParameters -notcontains $_.Key } | Format-Table -AutoSize -Property ( @{ Name = 'Parameter' Expression = {$_.Key} }, @{ Name = 'Value' Expression = {$_.Value} } ) | Out-String -Stream | ForEach-Object { if ($_.Trim()) { $_ } } } } # Code in here will be appended to bottom of the psm1-file. #region Initialize APIs if ((Test-Path -Path 'Variable:\PSVersionTable') -eq $false -or ($PSVersionTable.PSVersion.Major -lt 5)) { throw 'Requires PowerShell 5 or greater.' } if ((Test-Path -Path 'Variable:\PSEdition')) { if ($PSEdition -eq 'Desktop') { # Ignore self-signed SSL certificate warning. [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } } } $defaultBasePath = 'https://localhost' if ($null -ne $env:CifV3ApiUri) { $defaultBasePath = $env:CifV3ApiUri } if ((Test-Path -Path 'env:\CifV3ApiKey') -eq $false) { throw 'Environment variable CifV3ApiKey not defined. Set CifV3ApiKey to the token provided to you.' } 'Creating object: Cif.V3.Management.Api.HealthApi' | Write-Verbose $Script:HealthApi = New-Object -TypeName Cif.V3.Management.Api.HealthApi -ArgumentList @($defaultBasePath) if ((Test-Path -Path 'Variable:\HealthApi')) { $Script:HealthApi.Configuration.AddApiKey('Authorization', 'Token token=' + $env:CifV3ApiKey) } else { throw 'Unable to create object HealthApi.' } 'Creating object: Cif.V3.Management.Api.HelpApi' | Write-Verbose $Script:HelpApi = New-Object -TypeName Cif.V3.Management.Api.HelpApi -ArgumentList @($defaultBasePath) if (-not (Test-Path -Path 'Variable:\HelpApi')) { throw 'Unable to create object HelpApi.' } 'Creating object: Cif.V3.Management.Api.IndicatorsApi' | Write-Verbose $Script:IndicatorsApi = New-Object -TypeName Cif.V3.Management.Api.IndicatorsApi -ArgumentList @($defaultBasePath) if ((Test-Path -Path 'Variable:\IndicatorsApi')) { $Script:IndicatorsApi.Configuration.AddApiKey('Authorization', 'Token token=' + $env:CifV3ApiKey) } else { throw 'Unable to create object IndicatorsApi.' } 'Creating object: Cif.V3.Management.Api.TokenApi' | Write-Verbose $Script:TokenApi = New-Object -TypeName Cif.V3.Management.Api.TokenApi -ArgumentList @($defaultBasePath) if ((Test-Path -Path 'Variable:\TokenApi')) { $Script:TokenApi.Configuration.AddApiKey('Authorization', 'Token token=' + $env:CifV3ApiKey) } else { throw 'Unable to create object TokenApi.' } #endregion |