34 lines
973 B
PowerShell
34 lines
973 B
PowerShell
|
function Get-TeamCityEc2Instance {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Returns an array of the TeamCity EC2 Instances
|
||
|
|
||
|
.PARAMETER Type
|
||
|
Type of TeamCity host(s) to return: All, Server(s), or Agent(s)
|
||
|
|
||
|
.PARAMETER ProfileName
|
||
|
AWS ProfileName
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
[OutputType([Amazon.EC2.Model.Instance[]])]
|
||
|
param(
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[ValidateSet("All", "Server", "Agent")]
|
||
|
[string]$Type = "All",
|
||
|
[Parameter(Mandatory = $true)]
|
||
|
[string]$ProfileName
|
||
|
)
|
||
|
|
||
|
$logLead = Get-LogLeadName
|
||
|
|
||
|
Write-Host "$logLead : Getting hostnames of type $Type"
|
||
|
$teamcityHostnames = Get-TeamCityHostnames -Type $Type
|
||
|
|
||
|
Write-Host "$logLead : Getting instances for hostnames $($teamcityHostnames)"
|
||
|
$teamcityInstances = Get-EC2InstancesByHostname -Servers $teamcityHostnames -ProfileName $ProfileName
|
||
|
|
||
|
Write-Host "$logLead : Found $($teamcityInstances.count)(count) instances to return"
|
||
|
return $teamcityInstances
|
||
|
|
||
|
}
|