rmbolger / Posh-IBWAPI

PowerShell module for interacting with the Infoblox WAPI (REST API).
MIT License
54 stars 8 forks source link

Create functions to abstract fileop functions #8

Closed rmbolger closed 5 years ago

rmbolger commented 7 years ago

While it's currently possible to download files generated via fileop object functions (like DB backups and CSV exports), it's still a tedious process. You have to Invoke-IBFunction for the initial fileop. Then you have Invoke-IBWAPI with the download URL. Then you have to remember to "clean up" your download by calling Invoke-IBWAPI with 'downloadcomplete'.

It would be nice to have some sort of dedicated fileop related functions for Downloading/Uploading files. For example:

Receive-IBFile -func getgriddata -args @{type='BACKUP'} -OutFile .\backup.bak
rmbolger commented 5 years ago

The hard part about this is actually file uploads. Infoblox requires file upload to use multipart/form-data uploads which PowerShell has historically poor support for in the web cmdlets. PowerShell Core 6.1 recently added official support which would work. But I don't want to make PS 6.1 a hard prereq for using the module.

However, I'm pretty sure I can essentially back port enough of how they're doing things in PS 6.1 to make things work in PS 3.0. But it's going to require upping the minimum .NET Framework version to 4.5 so I can use System.Net.Http.MultipartFormDataContent.

rmbolger commented 5 years ago

An initial implementation of Receive-IBFile and Send-IBFile is now in the 2x branch.