Skip to content

Commit

Permalink
Added Viewers parameter
Browse files Browse the repository at this point in the history
Modified uneccessary mandatory parameters
  • Loading branch information
jmedd-ats committed Jan 22, 2021
1 parent 63e6d78 commit 8d5d382
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/Functions/Public/iaas/New-vRAProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
.PARAMETER Zones
PSCustomObject(s) with properties for a Cloud Zone
.PARAMETER Viewers
Viewers to add to the Project
.PARAMETER Members
Members to add to the Project
Expand Down Expand Up @@ -52,6 +55,7 @@
Name = 'Test Project'
Description = 'Test Project'
Zones = $CloudZone
Viewers = '[email protected]'
Members = '[email protected]','[email protected]'
Administrators = '[email protected]','[email protected]'
OperationTimeout = 3600
Expand Down Expand Up @@ -115,10 +119,14 @@
[ValidateNotNullOrEmpty()]
[String]$Description,

[Parameter(Mandatory=$true,ParameterSetName="Standard")]
[Parameter(Mandatory=$false,ParameterSetName="Standard")]
[ValidateNotNullOrEmpty()]
[PSCustomObject[]]$Zones,

[Parameter(Mandatory=$false,ParameterSetName="Standard")]
[ValidateNotNullOrEmpty()]
[String[]]$Viewers,

[Parameter(Mandatory=$false,ParameterSetName="Standard")]
[ValidateNotNullOrEmpty()]
[String[]]$Members,
Expand All @@ -127,7 +135,7 @@
[ValidateNotNullOrEmpty()]
[String[]]$Administrators,

[Parameter(Mandatory=$true,ParameterSetName="Standard")]
[Parameter(Mandatory=$false,ParameterSetName="Standard")]
[ValidateNotNullOrEmpty()]
[Int]$OperationTimeout,

Expand Down Expand Up @@ -169,6 +177,7 @@
"name": "$($Name)",
"description": "$($Description)",
"zoneAssignmentConfigurations": [],
"viewers": [],
"members": [],
"administrators": [],
"operationTimeout": $($OperationTimeout),
Expand All @@ -184,6 +193,21 @@
$JSONObject.zoneAssignmentConfigurations += $Zone
}

# --- Add Viewers
if ($PSBoundParameters.ContainsKey("Viewers")){

foreach ($Viewer in $Viewers){

$Addition = @"
{
"email": "$($Viewer)"
}
"@
$AdditionObject = $Addition | ConvertFrom-Json
$JSONObject.viewers += $AdditionObject
}
}

# --- Add Members
if ($PSBoundParameters.ContainsKey("Members")){

Expand Down

0 comments on commit 8d5d382

Please sign in to comment.