Skip to content

Commit

Permalink
Merge pull request #270 from jakkulabs/feature-project-custom-properties
Browse files Browse the repository at this point in the history
Add Placement Policy and Custom Properties support to vRA Project functions
  • Loading branch information
jonathanmedd authored May 25, 2021
2 parents d1d88ae + 71c49bd commit fca7ba2
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 297 deletions.
2 changes: 2 additions & 0 deletions src/Functions/Public/iaas/Get-vRAProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
Zones = $Project.zones
SharedResources = $Project.sharedResources
OperationTimeout = $Project.operationTimeout
PlacementPolicy = $Project.placementPolicy
CustomProperties = $Project.customProperties
OrganizationId = $Project.organizationId
Links = $Project._links
}
Expand Down
33 changes: 33 additions & 0 deletions src/Functions/Public/iaas/New-vRAProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
.PARAMETER SharedResources
Deployments are shared between all users in the project
.PARAMETER PlacementPolicy
Placement Policy - Valid values: "DEFAULT" or "SPREAD"
.PARAMETER CustomProperties
Specify the custom properties that should be added to all requests in this project
.PARAMETER JSON
A JSON string with the body payload
Expand All @@ -50,6 +56,10 @@
memoryLimitMb = 107374
}
$CustomProperties = @{}
$CustomProperties.Add('Property1', "Value1")
$CustomProperties.Add('Property2', "Value2")
$ProjectArguments = @{
Name = 'Test Project'
Expand All @@ -60,6 +70,7 @@
Administrators = '[email protected]','[email protected]'
OperationTimeout = 3600
SharedResources = $true
CustomProperties = $CustomProperties
}
New-vRAProject @ProjectArguments
Expand Down Expand Up @@ -142,6 +153,14 @@
[Parameter(Mandatory=$false,ParameterSetName="Standard")]
[Switch]$SharedResources,

[Parameter(Mandatory=$false,ParameterSetName="Standard")]
[ValidateSet("DEFAULT", "SPREAD", IgnoreCase = $false)]
[String]$PlacementPolicy,

[Parameter(Mandatory=$false,ParameterSetName="Standard")]
[ValidateNotNullOrEmpty()]
[Hashtable]$CustomProperties,

[Parameter(Mandatory=$true,ValueFromPipeline=$true,ParameterSetName="JSON")]
[ValidateNotNullOrEmpty()]
[String]$JSON
Expand Down Expand Up @@ -238,6 +257,18 @@
}
}

# --- Add Placement Policy
if ($PSBoundParameters.ContainsKey("PlacementPolicy")){

$JSONObject | Add-Member -MemberType NoteProperty -Name 'placementPolicy' -Value $PlacementPolicy
}

# --- Add Custom Properties
if ($PSBoundParameters.ContainsKey("CustomProperties")){

$JSONObject | Add-Member -MemberType NoteProperty -Name 'customProperties' -Value $CustomProperties
}

$Body = $JSONObject | ConvertTo-Json -Depth 5
}

Expand All @@ -259,6 +290,8 @@
Zones = $Project.zones
SharedResources = $Project.sharedResources
OperationTimeout = $Project.operationTimeout
PlacementPolicy = $Project.placementPolicy
CustomProperties = $Project.customProperties
OrganizationId = $Project.organizationId
Links = $Project._links
}
Expand Down
Loading

0 comments on commit fca7ba2

Please sign in to comment.