Skip to content

Commit

Permalink
fixing issues commented on pull request (Steven Carnes)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carnes authored and Carnes committed Jun 30, 2020
1 parent 778db11 commit e77c743
Show file tree
Hide file tree
Showing 28 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/Functions/Public/Connect-vRAServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
# --- Handle untrusted certificates if necessary
$SignedCertificates = $true

if ($PSBoundParameters.ContainsKey("IgnoreCertRequirements") ){
if ($IgnoreCertRequirements.IsPresent){

if (!$IsCoreCLR) {

Expand Down
2 changes: 1 addition & 1 deletion src/Functions/Public/Invoke-vRARestMethod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
try {

# --- Use either Invoke-WebRequest or Invoke-RestMethod
if ($PSBoundParameters.ContainsKey("WebRequest")) {
if ($WebRequest.IsPresent) {

Invoke-WebRequest @Params
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
'ById' {
foreach ($executionId in $Id) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$executionId'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -86,7 +86,7 @@
'ByName' {
foreach ($pipelineName in $Pipeline) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$pipelineName'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -96,7 +96,7 @@
'ByProject' {
foreach ($projectName in $Project) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$projectName'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -105,7 +105,7 @@
# --- No parameters passed so return all executions
'Standard' {
$Response = Invoke-vRARestMethod -URI $APIUrl -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

}
Expand Down
8 changes: 4 additions & 4 deletions src/Functions/Public/codestream/Get-vRACodeStreamPipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
'ById' {
foreach ($pipelineId in $Id) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$pipelineId'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -85,7 +85,7 @@
'ByName' {
foreach ($pipelineName in $Pipeline) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$pipelineName'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -95,7 +95,7 @@
'ByProject' {
foreach ($projectName in $Project) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$projectName'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -104,7 +104,7 @@
# --- No parameters passed so return all Pipelines
'Standard' {
$Response = Invoke-vRARestMethod -URI $APIUrl -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

}
Expand Down
8 changes: 4 additions & 4 deletions src/Functions/Public/codestream/Get-vRACodeStreamVariable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
'ById' {
foreach ($variableId in $Id) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$variableId'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -86,7 +86,7 @@
'ByName' {
foreach ($variableName in $Variable) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$variableName'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -96,7 +96,7 @@
'ByProject' {
foreach ($projectName in $Project) {
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$projectName'" -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

break
Expand All @@ -105,7 +105,7 @@
# --- No parameters passed so return all Variables
'Standard' {
$Response = Invoke-vRARestMethod -URI $APIUrl -Method GET
CalculateOutput($Response)
CalculateOutput $Response
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/Functions/Public/iaas/Get-vRACloudAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

function CalculateOutput([PSCustomObject]$CloudAccount, [String]$Type) {

if ($Type -ne $nulls){
if ($null -ne $Type){

$CloudAccountType = $Type
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Get-vRARegionEnumerationvSphere {

$APIUrl = "/iaas/api/cloud-accounts-vsphere/region-enumeration"

if ($PSBoundParameters.ContainsKey("AcceptSelfSignedCertificate")) {
if ($AcceptSelfSignedCertificate.IsPresent) {

$AcceptSelfSignedCertificateStatus = 'true'
}
Expand Down
2 changes: 1 addition & 1 deletion src/Functions/Public/iaas/New-vRACloudAccountAzure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
)

begin {
if ($PSBoundParameters.ContainsKey("CreateDefaultZones")) {
if ($CreateDefaultZones.IsPresent) {

$CreateDefaultZonesStatus = 'true'
}
Expand Down
2 changes: 1 addition & 1 deletion src/Functions/Public/iaas/New-vRACloudAccountGCP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ N/2DOnL7ChnG8ZJp45SKq26g6D+OU5rg83KuNMJQ0w3dXuR2ch\nnLxRJH0dt7oA
)

begin {
if ($PSBoundParameters.ContainsKey("CreateDefaultZones")) {
if ($CreateDefaultZones.IsPresent) {

$CreateDefaultZonesStatus = 'true'
}
Expand Down
4 changes: 2 additions & 2 deletions src/Functions/Public/iaas/New-vRACloudAccountvSphere.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

$APIUrl = "/iaas/api/cloud-accounts-vsphere"

if ($PSBoundParameters.ContainsKey("CreateDefaultZones")) {
if ($CreateDefaultZones.IsPresent) {

$CreateDefaultZonesStatus = 'true'
}
Expand All @@ -151,7 +151,7 @@
$CreateDefaultZonesStatus = 'false'
}

if ($PSBoundParameters.ContainsKey("AcceptSelfSignedCertificate")) {
if ($AcceptSelfSignedCertificate.IsPresent) {

$AcceptSelfSignedCertificateStatus = 'true'
}
Expand Down
20 changes: 10 additions & 10 deletions src/Functions/Public/iaas/New-vRAMachineAttachedDisk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
System.Management.Automation.PSObject.
.EXAMPLE
New-vRAMachineAttachedDisk -Id 'b1dd48e71d74267559bb930934470' -blockDeviceId '123456'
New-vRAMachineAttachedDisk -Id 'b1dd48e71d74267559bb930934470' -BlockDeviceId'123456'
.EXAMPLE
New-vRAMachineAttachedDisk -Name 'iaas01' -blockDeviceId '123456'
New-vRAMachineAttachedDisk -Name 'iaas01' -BlockDeviceId'123456'
.EXAMPLE
New-vRAMachineAttachedDisk -Name 'iaas01' -blockDeviceId '123456' -WaitForCompletion
New-vRAMachineAttachedDisk -Name 'iaas01' -BlockDeviceId'123456' -WaitForCompletion
.EXAMPLE
New-vRAMachineAttachedDisk -Name 'iaas01' -blockDeviceId '123456' -WaitForCompletion -CompletionTimeout 300
New-vRAMachineAttachedDisk -Name 'iaas01' -BlockDeviceId'123456' -WaitForCompletion -CompletionTimeout 300
.EXAMPLE
New-vRAMachineAttachedDisk -Name 'iaas01' -blockDeviceId '123456' -DeviceName 'Disk 17' -DeviceDescription 'This is a disk attached from script'
New-vRAMachineAttachedDisk -Name 'iaas01' -BlockDeviceId'123456' -DeviceName 'Disk 17' -DeviceDescription 'This is a disk attached from script'
#>
[CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ByName")][OutputType('System.Management.Automation.PSObject')]
Expand Down Expand Up @@ -92,7 +92,7 @@

function CalculateOutput([String[]]$blockDeviceId,[int]$CompletionTimeout,[switch]$WaitForCompletion,[PSCustomObject]$RestResponse) {

if ($WaitForCompletion) {
if ($WaitForCompletion.IsPresent) {
# if the wait for completion flag is given, the output will be different, we will wait here
# we will use the built-in function to check status
$elapsedTime = 0
Expand Down Expand Up @@ -169,25 +169,25 @@

# --- Get Machine by its id
'ById' {
if ($Force -or $PsCmdlet.ShouldProcess($Id)){
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($Id)){
# --- Check to see if the DiskId's were optionally present
$RestResponse = Invoke-vRARestMethod -URI "$APIUrl`/$Id`/disks" -Method GET -Body $Body

CalculateOutput $blockDeviceId $CompletionTimeout $WaitForCompletion $RestResponse
CalculateOutput $BlockDeviceId$CompletionTimeout $WaitForCompletion $RestResponse
}
break
}

# --- Get Machine by its name
# --- Will need to retrieve the machine first, then use ID to get final output
'ByName' {
if ($Force -or $PsCmdlet.ShouldProcess($Name)){
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($Name)){
$machineResponse = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$Name'`&`$select=id" -Method GET
$machineId = $machineResponse.content[0].id

$RestResponse = Invoke-vRARestMethod -URI "$APIUrl`/$machineId`/disks" -Method POST -Body $Body

CalculateOutput $blockDeviceId $CompletionTimeout $WaitForCompletion $RestResponse
CalculateOutput $BlockDeviceId$CompletionTimeout $WaitForCompletion $RestResponse
}
break
}
Expand Down
2 changes: 1 addition & 1 deletion src/Functions/Public/iaas/New-vRAProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

begin {

if ($PSBoundParameters.ContainsKey("SharedResources")) {
if ($SharedResources.IsPresent) {

$SharedResourcesStatus = 'true'
}
Expand Down
14 changes: 7 additions & 7 deletions src/Functions/Public/iaas/New-vRAVirtualDisk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function New-vRAVirtualDisk {

function CalculateOutput([int]$CompletionTimeout,[switch]$WaitForCompletion,[PSCustomObject]$RestResponse) {

if ($WaitForCompletion) {
if ($WaitForCompletion.IsPresent) {
# if the wait for completion flag is given, the output will be different, we will wait here
# we will use the built-in function to check status
$elapsedTime = 0
Expand Down Expand Up @@ -159,14 +159,14 @@ function New-vRAVirtualDisk {

# --- Get Machine by its id
'ById' {
if ($Force -or $PsCmdlet.ShouldProcess($ProjectId)){
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($ProjectId)){
$Body = @"
{
"capacityInGB": $($CapacityInGB),
"encrypted": $($Encrypted),
"encrypted": $($Encrypted.IsPresent),
"name": "$($Name)",
"description": "$($DeviceDescription)",
"persistent": $($Persistent),
"persistent": $($Persistent.IsPresent),
"projectId": "$($ProjectId)"
}
"@
Expand All @@ -181,17 +181,17 @@ function New-vRAVirtualDisk {
# --- Get Machine by its name
# --- Will need to retrieve the machine first, then use ID to get final output
'ByName' {
if ($Force -or $PsCmdlet.ShouldProcess($ProjectName)){
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($ProjectName)){
$projResponse = Invoke-vRARestMethod -URI "/iaas/api/projects`?`$filter=name eq '$ProjectName'`&`$select=id" -Method GET
$projId = $projResponse.content[0].id

$Body = @"
{
"capacityInGB": $($CapacityInGB),
"encrypted": $($Encrypted),
"encrypted": $($Encrypted.IsPresent),
"name": "$($Name)",
"description": "$($DeviceDescription)",
"persistent": $($Persistent),
"persistent": $($Persistent.IsPresent),
"projectId": "$($projId)"
}
"@
Expand Down
10 changes: 5 additions & 5 deletions src/Functions/Public/iaas/Resize-vRAMachine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
$APIUrl = "/iaas/api/machines"

function CalculateOutput([int]$CompletionTimeout,[switch]$WaitForCompletion,[PSCustomObject]$RestResponse) {
if ($WaitForCompletion) {
if ($WaitForCompletion.IsPresent) {
# if the wait for completion flag is given, the output will be different, we will wait here
# we will use the built-in function to check status
$elapsedTime = 0
Expand Down Expand Up @@ -163,7 +163,7 @@
'ResizeFlavorById' {

foreach ($machineId in $Id) {
if ($Force -or $PsCmdlet.ShouldProcess($machineId)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machineId)) {
$RestResponse = Invoke-vRARestMethod -URI "$APIUrl`/$machineId/operations/resize?name=$Flavor" -Method POST
CalculateOutput $CompletionTimeout $WaitForCompletion $RestResponse
}
Expand All @@ -175,7 +175,7 @@
'ResizeFlavorByName' {

foreach ($machine in $Name) {
if ($Force -or $PsCmdlet.ShouldProcess($machine)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machine)) {
$machineResponse = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$machine'`&`$select=id" -Method GET
$machineId = $machineResponse.content[0].Id

Expand All @@ -190,7 +190,7 @@
'ResizeById' {

foreach ($machineId in $Id) {
if ($Force -or $PsCmdlet.ShouldProcess($machineId)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machineId)) {
$RestResponse = Invoke-vRARestMethod -URI "$APIUrl`/$machineId/operations/resize?memoryInMB=$Memory`&cpuCount=$CPU" -Method POST
CalculateOutput $CompletionTimeout $WaitForCompletion $RestResponse
}
Expand All @@ -202,7 +202,7 @@
'ResizeByName' {

foreach ($machine in $Name) {
if ($Force -or $PsCmdlet.ShouldProcess($machine)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machine)) {
$machineResponse = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$machine'`&`$select=id" -Method GET
$machineId = $machineResponse.content[0].Id

Expand Down
6 changes: 3 additions & 3 deletions src/Functions/Public/iaas/Restart-vRAMachine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
$APIUrl = "/iaas/api/machines"

function CalculateOutput([int]$CompletionTimeout,[switch]$WaitForCompletion,[PSCustomObject]$RestResponse) {
if ($WaitForCompletion) {
if ($WaitForCompletion.IsPresent) {
# if the wait for completion flag is given, the output will be different, we will wait here
# we will use the built-in function to check status
$elapsedTime = 0
Expand Down Expand Up @@ -131,7 +131,7 @@
'ResetById' {

foreach ($machineId in $Id) {
if ($Force -or $PsCmdlet.ShouldProcess($machineId)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machineId)) {
$RestResponse = Invoke-vRARestMethod -URI "$APIUrl`/$machineId/operations/reset" -Method POST
CalculateOutput $CompletionTimeout $WaitForCompletion $RestResponse
}
Expand All @@ -143,7 +143,7 @@
'ResetByName' {

foreach ($machine in $Name) {
if ($Force -or $PsCmdlet.ShouldProcess($machine)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machine)) {
$machineResponse = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$machine'`&`$select=id" -Method GET
$machineId = $machineResponse.content[0].Id

Expand Down
6 changes: 3 additions & 3 deletions src/Functions/Public/iaas/Restart-vRAMachineGuestOS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
$APIUrl = "/iaas/api/machines"

function CalculateOutput([int]$CompletionTimeout,[switch]$WaitForCompletion,[PSCustomObject]$RestResponse) {
if ($WaitForCompletion) {
if ($WaitForCompletion.IsPresent) {
# if the wait for completion flag is given, the output will be different, we will wait here
# we will use the built-in function to check status
$elapsedTime = 0
Expand Down Expand Up @@ -131,7 +131,7 @@
'RebootById' {

foreach ($machineId in $Id) {
if ($Force -or $PsCmdlet.ShouldProcess($machineId)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machineId)) {
$RestResponse = Invoke-vRARestMethod -URI "$APIUrl`/$machineId/operations/reboot" -Method POST
CalculateOutput $CompletionTimeout $WaitForCompletion $RestResponse
}
Expand All @@ -143,7 +143,7 @@
'RebootByName' {

foreach ($machine in $Name) {
if ($Force -or $PsCmdlet.ShouldProcess($machine)) {
if ($Force.IsPresent -or $PsCmdlet.ShouldProcess($machine)) {
$machineResponse = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$machine'`&`$select=id" -Method GET
$machineId = $machineResponse.content[0].Id

Expand Down
Loading

0 comments on commit e77c743

Please sign in to comment.