Ryan Bolger

Ryan Bolger

Adventures In Tech

Posh-IBWAPI 3.0.0

File upload/download wrappers, named configs, and auto session management

Ryan Bolger

Just shipped a new Posh-IBWAPI release, version 3.0.0. It has only been two days since 2.0.0, but I goofed and shipped 2.0.0 with some breaking changes that I ended up reverting. The biggest feature of the release is the new file upload/download wrappers, Send-IBFile and Recieve-IBFile. They allow you to more easily do things like upload a certificate or download a grid backup and fill a functionality gap that has been bugging me since 1.0.

For example, in 1.x this is how you’d download a grid backup:

# request a download token and URL
$dl = Invoke-IBFunction -ref fileop -name getgriddata -args @{type='BACKUP'}

# download the file
Invoke-IBWAPI -Uri $dl.url -ContentType 'application/force-download' `
              -Credential (Get-IBWAPIConfig).Credential `
              -OutFile .\backup.tar.gz

# inform Infoblox that the download is complete
Invoke-IBFunction -ref fileop -name downloadcomplete -args @{token=$dl.token}

But in 3.x, you can now do this:

Receive-IBFile getgriddata -args @{type='BACKUP'} -OutFile .\backup.tar.gz

Also in the release are named configs which enable saving different credentials for the same grid. The module takes care of session management now as well. So you don’t need to manually deal with WebSession objects to prevent extraneous authentication requests.

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

Changelog

  • Breaking Changes
    • The change to ObjectType parameter in Invoke-IBFunction has been reverted to ObjectRef like in 1.x. I totally confused myself during 2.x development of the *-IBFile functions and thought it had been wrong the whole time. It seems silly to do another major version change after two days. But breaking changes demand it according to semver.
    • The ObjectType parameter in Send-IBFile and Receive-IBFile have been changed to ObjectRef to match Invoke-IBFunction. Both still default to ‘fileop’ and have parameter aliases for ‘type’ and ‘ObjectType’ to maintain compatibility with the short lived 2.x codebase.
  • Fixed example in Invoke-IBFunction help.

And here’s the changelog for 2.0.0 which gives a better idea of what has changed since 1.x:

  • Breaking Changes
    • .NET 4.5+ is now required on PowerShell Desktop edition for full functionality. A warning will be thrown when loading the module if it is not found.
    • The WebSession parameter has been removed from all functions except Invoke-IBWAPI. Session handling is now automatic.
    • New-IBSession has been removed.
    • Get-IBWAPIConfig, Set-IBWAPIConfig, and Remove-IBWAPIConfig have been renamed to Get-IBConfig, Set-IBConfig, and Remove-IBConfig respectively.
    • Save-IBWAPIConfig has been removed. Configs are now saved by default via Set-IBConfig.
    • Configs are now referenced by a ProfileName. Old 1.x configs will be automatically backed up, converted, and the new profiles will have their WAPIHost value set as the initial profile name.
    • Set-IBConfig now has ProfileName as its first parameter.
    • Get-IBConfig and Remove-IBConfig now have ProfileName instead of WAPIHost as their selection parameter.
    • The IgnoreCertificateValidation switch has been renamed to SkipCertificateCheck in all functions and configs to be more in line with PowerShell Core.
    • The ObjectRef parameter in Invoke-IBFunction has been changed to ObjectType which is functionally how it always worked and was inappropriately named. Functions get called against object types not references.
  • New Feature: Automatic session handling. The module will now automatically save and use WebSession objects to increase authentication efficiency over multiple requests and function calls.
  • New Feature: Named configuration profiles. This will allow you to save multiple profiles for the same WAPI host with different credentials, WAPI versions, etc.
  • New functions Send-IBFile and Recieve-IBFile which are convenient wrappers around the fileop functions. See the cmdlet help or the guide in the wiki for more details.
  • Config profiles are now automatically saved to disk when using Set-IBConfig.
  • Set-IBConfig now has a NewName parameter to rename the profile.
  • Get-IBConfig now returns a typed object with a automatically styled display.
  • Remove-IBConfig now has pipeline support both by value and property name so you can pipe the output of Get-IBConfig to it.
  • Get-IBConfig, Set-IBConfig, and Remove-IBConfig now have tab completion on PowerShell 5.0 or later.

Recent posts

See more