Ryan Bolger

Ryan Bolger

Adventures In Tech

Posh-IBWAPI 3.2.0

Per-call profiles

Ryan Bolger

Just shipped a new Posh-IBWAPI release, version 3.2.0. There is now a ProfileName parameter associated with all of the public functions that have connection specific parameters such as WAPIHost, WAPIVersion, and Credential. This should make it easier to change profiles on a per-call basis instead of needing to run Set-IBConfig to switch away and back again.

You might use this to make it easier to compare data between different grids. You could also use this to setup some protection against accidental mistakes if you create both an “admin” profile and a “readonly” profile. Most of the time, your default profile would be read-only. When you specifically needed to do something that requires write access, you just specify the admin profile name.

# set the readonly profile as active
Set-IBConfig readonly

# do stuff normally that only requires readonly
Get-IBObject zone_auth -Filter 'view=default','fqdn=example.com'

# try and fail to do something that would require write access
Get-IBObject zone_auth -Filter 'view=default','fqdn=example.com' |
    Set-IBObject -Template @{comment='new comment'}

# which forces you to try again using the admin profile for the Set command
Get-IBObject zone_auth -Filter 'view=default','fqdn=example.com' |
    Set-IBObject -Template @{comment='new comment'} -ProfileName admin

Updated versions can be found in the PowerShell Gallery or GitHub. Installation instructions are in the Readme.

Changelog

  • An optional ProfileName parameter has been added to the public functions that already accept connection specific parameters (#49). This will allow you to switch profiles on a per-call basis more easily. The connection specific parameters will still override the a specified profile’s values. These are the affected functions:
    • Get-IBObject
    • Get-IBSchema
    • Invoke-IBFunction
    • New-IBObject
    • Receive-IBFile
    • Remove-IBObject
    • Send-IBFile
    • Set-IBObject
  • ProfileName is now a positional parameter in Remove-IBConfig
  • Minor efficiency improvements in Get-IBObject for results with many pages.
  • The name of the default branch in git has been renamed from master to main.

Recent Posts

categories