This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-DockerImageTag { | |
[CmdletBinding()] | |
param ( | |
[string]$ImageName, | |
[switch]$OnlyActive | |
) | |
$FetchedRecords = New-Object System.Collections.ArrayList | |
try { | |
$fetchResult = (Invoke-WebRequest -Uri "https://registry.hub.docker.com/v2/repositories/library/$ImageName/tags/").Content | convertfrom-json | |
if ($fetchResult.count -gt 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
In order to test it, you need to get vsphere SDK for webservices, as this is using the libraries from it. | |
new-webserviceproxy can't handle soap security headers. You also need PKCS#12 pfx certificate (in my example) | |
#> | |
#https://www.dorkbrain.com/docs/2017/09/02/gzip-in-powershell/ | |
Function ConvertTo-GZipString () { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelinebyPropertyName = $True)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-IPsFromString { | |
<# | |
.SYNOPSIS | |
Returns chunks of ips from given string limited to $MaxLength of characters from string | |
.DESCRIPTION | |
If we have 50 ips separated by commas, this function will retrieve as many batches of | |
ips as there can fit inside $maxlength of character from give string. | |
If you have to put in some form which is limited to 255 characters ips this function | |
will diving the ips between | |
By default is assumes tring limit of 255 characters and min of MaxLength-39 to handle |