├── .DS_Store ├── .editorconfig ├── .vscode └── settings.json ├── CONTRIBUTING.md ├── GitVersion.yml ├── LICENSE ├── config └── changelogConfig.json └── src ├── Functions ├── Private │ ├── NewDynamicParam.ps1 │ └── xRequires.ps1 └── Public │ ├── Connect-vRAServer.ps1 │ ├── Disconnect-vRAServer.ps1 │ ├── Invoke-vRARestMethod.ps1 │ ├── blueprint │ ├── Get-vRABlueprint.ps1 │ └── Get-vRABlueprintVersion.ps1 │ ├── catalog │ └── Get-vRACatalogItem.ps1 │ ├── codestream │ ├── Get-vRACodeStreamExecution.ps1 │ ├── Get-vRACodeStreamPipeline.ps1 │ ├── Get-vRACodeStreamVariable.ps1 │ ├── Remove-vRACodeStreamExecution.ps1 │ ├── Remove-vRACodeStreamVariable.ps1 │ └── Update-vRACodeStreamVariable.ps1 │ ├── content │ └── Get-vRAContentSource.ps1 │ ├── deployment │ └── Get-vRADeployment.ps1 │ ├── iaas │ ├── Get-vRAAPIVersion.ps1 │ ├── Get-vRABlockDevice.ps1 │ ├── Get-vRACloudAccount.ps1 │ ├── Get-vRACloudZone.ps1 │ ├── Get-vRAExternalNetworkIPRange.ps1 │ ├── Get-vRAFabricAWSVolumeType.ps1 │ ├── Get-vRAFabricAzureStorageAccount.ps1 │ ├── Get-vRAFabricCompute.ps1 │ ├── Get-vRAFabricImage.ps1 │ ├── Get-vRAFabricNetwork.ps1 │ ├── Get-vRAFlavorProfile.ps1 │ ├── Get-vRAImageProfile.ps1 │ ├── Get-vRALoadBalancer.ps1 │ ├── Get-vRAMachine.ps1 │ ├── Get-vRAMachineDisk.ps1 │ ├── Get-vRANetwork.ps1 │ ├── Get-vRANetworkDomain.ps1 │ ├── Get-vRANetworkIPRange.ps1 │ ├── Get-vRANetworkProfile.ps1 │ ├── Get-vRAProject.ps1 │ ├── Get-vRARegion.ps1 │ ├── Get-vRARegionEnumerationvSphere.ps1 │ ├── Get-vRARequest.ps1 │ ├── Get-vRASecurityGroup.ps1 │ ├── Get-vRAStorageProfile.ps1 │ ├── Get-vRATag.ps1 │ ├── Get-vRAvSphereFabricDatastore.ps1 │ ├── Get-vRAvSphereFabricNetwork.ps1 │ ├── Get-vRAvSphereFabricStoragePolicy.ps1 │ ├── New-vRACloudAccountAzure.ps1 │ ├── New-vRACloudAccountGCP.ps1 │ ├── New-vRACloudAccountvSphere.ps1 │ ├── New-vRAMachineAttachedDisk.ps1 │ ├── New-vRANetworkProfile.ps1 │ ├── New-vRAProject.ps1 │ ├── New-vRAVirtualDisk.ps1 │ ├── Remove-vRACloudAccount.ps1 │ ├── Remove-vRAProject.ps1 │ ├── Resize-vRAMachine.ps1 │ ├── Resize-vRAVirtualDisk.ps1 │ ├── Restart-vRAMachine.ps1 │ ├── Restart-vRAMachineGuestOS.ps1 │ ├── Set-vRAProject.ps1 │ ├── Start-vRAMachine.ps1 │ ├── Stop-vRAMachine.ps1 │ ├── Stop-vRAMachineGuestOS.ps1 │ ├── Suspend-vRAMachine.ps1 │ ├── Update-vRAExternalNetworkIPRange.ps1 │ └── Update-vRAvSphereFabricNetwork.ps1 │ └── relocation │ ├── Get-vRAOnboardingDeployment.ps1 │ ├── Get-vRAOnboardingPlan.ps1 │ ├── Get-vRAOnboardingPlanExecution.ps1 │ ├── Get-vRAOnboardingResource.ps1 │ ├── Invoke-vRAOnboardingPlan.ps1 │ ├── New-vRAOnboardingDeployment.ps1 │ ├── New-vRAOnboardingPlan.ps1 │ ├── New-vRAOnboardingResource.ps1 │ ├── Remove-vRAOnboardingDeployment.ps1 │ ├── Remove-vRAOnboardingPlan.ps1 │ └── Remove-vRAOnboardingResource.ps1 ├── PowervRA.psd1 └── PowervRA.psm1 /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakkulabs/PowervRA/e7c27e76e9d466c60e780c0e5fc19f849ea0ccb7/.DS_Store -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Default .editorconfig 2 | # https://gds-way.cloudapps.digital/manuals/programming-languages/editorconfig 3 | # https://github.com/PowerShell/PowerShellEditorServices/blob/master/.editorconfig 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = space 9 | trim_trailing_whitespace = true 10 | charset = utf-8 11 | insert_final_newline = true 12 | end_of_line = lf 13 | 14 | [*.{json,yml}] 15 | indent_size = 2 16 | 17 | [*.{ps1,psm1,psd1}] 18 | indent_size = 4 19 | 20 | [*.{cs}] 21 | indent_size = 4 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "gitdoc.enabled": false 3 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | -------------------------------------------------------------------------------- /GitVersion.yml: -------------------------------------------------------------------------------- 1 | mode: ContinuousDelivery 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Jakku Labs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/changelogConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "categories": [ 3 | { 4 | "title": "## 🚀 Features", 5 | "labels": ["feature"] 6 | }, 7 | { 8 | "title": "## 🐛 Bugfixes", 9 | "labels": ["bug"] 10 | }, 11 | { 12 | "title": "## 🧪 Tests", 13 | "labels": ["test"] 14 | } 15 | ], 16 | "ignore_labels": [ 17 | "ignore" 18 | ], 19 | "template": "${{CHANGELOG}}\n\n
\nUncategorized\n\n${{UNCATEGORIZED}}\n
" 20 | } -------------------------------------------------------------------------------- /src/Functions/Private/xRequires.ps1: -------------------------------------------------------------------------------- 1 | function xRequires { 2 | <# 3 | .SYNOPSIS 4 | Checks the required API Version for the current function 5 | 6 | .DESCRIPTION 7 | Checks the required API Version for the current function 8 | 9 | .PARAMETER Version 10 | The API Version that the function supports. 11 | 12 | The version number passed to this parameter must be in the following format.. it can't be a single character. 13 | 14 | - 6.2.4 15 | - 7.0 16 | - 7.0.1 17 | - 7.1 18 | - 7.2 19 | 20 | .INPUTS 21 | System.Int 22 | System.Management.Automation.PSObject. 23 | 24 | .OUTPUTS 25 | None 26 | 27 | .EXAMPLE 28 | 29 | function Get-Example { 30 | 31 | # This function does not support API versions lower than Version 7 32 | xRequires -Version "7.0" 33 | 34 | } 35 | 36 | #> 37 | 38 | [CmdletBinding()][Alias("FunctionRequires")] 39 | Param ( 40 | [Parameter(Mandatory=$true, Position=0)] 41 | [String]$Version 42 | ) 43 | 44 | # --- Test for vRA API version 45 | if (-not $Script:vRAConnection){ 46 | throw "vRA Connection variable does not exist. Please run Connect-vRAServer first to create it" 47 | } 48 | 49 | # --- Convert version strings to [version] objects 50 | $APIVersion = [version]$Script:vRAConnection.APIVersion 51 | $RequiredVersion = [version]$Version 52 | 53 | if ($APIVersion -lt $RequiredVersion) { 54 | $PSCallStack = Get-PSCallStack 55 | Write-Error -Message "$($PSCallStack[1].Command) is not supported with vRA API version $($Script:vRAConnection.APIVersion)" 56 | break 57 | } 58 | } -------------------------------------------------------------------------------- /src/Functions/Public/Disconnect-vRAServer.ps1: -------------------------------------------------------------------------------- 1 | function Disconnect-vRAServer { 2 | <# 3 | .SYNOPSIS 4 | Disconnect from a vRA server 5 | 6 | .DESCRIPTION 7 | Disconnect from a vRA server by removing the authorization token and the vRAConnection script variable from PowerShell 8 | 9 | .EXAMPLE 10 | Disconnect-vRAServer 11 | 12 | .EXAMPLE 13 | Disconnect-vRAServer -Confirm:$false 14 | #> 15 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High")] 16 | 17 | Param () 18 | 19 | # --- Test for existing connection to vRA 20 | if (-not $Script:vRAConnection){ 21 | 22 | throw "vRA Connection variable does not exist. Please run Connect-vRAServer first to create it" 23 | } 24 | 25 | if ($PSCmdlet.ShouldProcess($Script:vRAConnection.Server)){ 26 | 27 | try { 28 | 29 | # --- Remove custom Security Protocol if it has been specified 30 | if ($Script:vRAConnection.SslProtocol -ne 'Default'){ 31 | 32 | if (!$IsCoreCLR) { 33 | 34 | [System.Net.ServicePointManager]::SecurityProtocol -= [System.Net.SecurityProtocolType]::$($Script:vRAConnection.SslProtocol) 35 | } 36 | } 37 | 38 | } 39 | catch [Exception]{ 40 | 41 | throw 42 | 43 | } 44 | finally { 45 | 46 | # --- Remove the vRAConnection script variable 47 | Write-Verbose -Message "Removing vRAConnection script variable" 48 | Remove-Variable -Name vRAConnection -Scope Script -Force -ErrorAction SilentlyContinue 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/Functions/Public/blueprint/Get-vRABlueprint.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRABlueprint { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Blueprint 5 | 6 | .DESCRIPTION 7 | Get a vRA Blueprint 8 | 9 | .PARAMETER Id 10 | The ID of the Blueprint 11 | 12 | .PARAMETER Name 13 | The Name of the Blueprint 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRABlueprint 23 | 24 | .EXAMPLE 25 | Get-vRABlueprint -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRABlueprint -Name 'TestBlueprint' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/blueprint/api/blueprints' 46 | 47 | function CalculateOutput([PSCustomObject]$Blueprint) { 48 | 49 | [PSCustomObject] @{ 50 | Name = $Blueprint.name 51 | Content = $Blueprint.content 52 | Id = $Blueprint.id 53 | CreatedAt = $Blueprint.createdAt 54 | CreatedBy = $Blueprint.createdBy 55 | UpdatedAt = $Blueprint.updatedAt 56 | UpdatedBy = $Blueprint.updatedBy 57 | OrgId = $Blueprint.orgId 58 | ProjectId = $Blueprint.projectId 59 | ProjectName = $Blueprint.projectName 60 | Description = $Blueprint.description 61 | Status = $Blueprint.status 62 | TotalVersions = $Blueprint.totalVersions 63 | TotalReleasedVersions = $Blueprint.totalReleasedVersions 64 | RequestScopeOrg = $Blueprint.requestScopeOrg 65 | Valid = $Blueprint.valid 66 | ValidationMessages = $Blueprint.validationMessages 67 | ContentSourceSyncMessages = $Blueprint.contentSourceSyncMessages 68 | } 69 | } 70 | } 71 | 72 | process { 73 | 74 | try { 75 | 76 | switch ($PsCmdlet.ParameterSetName) { 77 | 78 | # --- Get Blueprint by Id 79 | 'ById' { 80 | 81 | foreach ($BlueprintId in $Id){ 82 | 83 | $URI = "$($APIUrl)/$($BlueprintId)" 84 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 85 | 86 | foreach($Blueprint in $Response){ 87 | CalculateOutput $Blueprint 88 | } 89 | } 90 | 91 | break 92 | } 93 | # --- Get Blueprint by Name 94 | 'ByName' { 95 | 96 | foreach ($BlueprintName in $Name){ 97 | 98 | $URI = "$($APIUrl)" 99 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 100 | 101 | foreach ($Blueprint in $Response.content) { 102 | if($Blueprint.name -eq $BlueprintName){ 103 | # Get individual blueprint link 104 | $BlueprintSelfLink = $blueprint.selfLink 105 | 106 | # Get full blueprint resource info 107 | $FullBlueprints = Invoke-vRARestMethod -Method GET -URI $BlueprintSelfLink -Verbose:$VerbosePreference 108 | foreach ($FullBlueprint in $FullBlueprints){ 109 | CalculateOutput $FullBlueprint 110 | } 111 | } 112 | } 113 | } 114 | 115 | break 116 | } 117 | # --- No parameters passed so return all Blueprints 118 | 'Standard' { 119 | 120 | $URI = $APIUrl 121 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 122 | 123 | foreach ($Blueprint in $Response.content) { 124 | # Get individual blueprint link 125 | $BlueprintSelfLink = $blueprint.selfLink 126 | 127 | # Get full blueprint resource info 128 | $FullBlueprints = Invoke-vRARestMethod -Method GET -URI $BlueprintSelfLink -Verbose:$VerbosePreference 129 | foreach ($FullBlueprint in $FullBlueprints){ 130 | CalculateOutput $FullBlueprint 131 | } 132 | } 133 | } 134 | } 135 | } 136 | catch [Exception]{ 137 | 138 | throw 139 | } 140 | } 141 | 142 | end { 143 | 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/Functions/Public/blueprint/Get-vRABlueprintVersion.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRABlueprintVersion { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Blueprint's Versions 5 | 6 | .DESCRIPTION 7 | Get a vRA Blueprint's Versions 8 | 9 | .PARAMETER Blueprint 10 | The vRA Blueprint object as returned by Get-vRABlueprint 11 | 12 | .INPUTS 13 | System.String 14 | 15 | .OUTPUTS 16 | System.Management.Automation.PSObject 17 | 18 | .EXAMPLE 19 | Get-vRABlueprint | Get-vRABlueprintVersion 20 | 21 | .EXAMPLE 22 | Get-vRABlueprintVersion -Blueprint (Get-vRABlueprint -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9') 23 | 24 | .EXAMPLE 25 | Get-vRABlueprintVersion -Blueprint (Get-vRABlueprint -Name 'TestBlueprint') 26 | 27 | #> 28 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 29 | 30 | Param ( 31 | 32 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="Blueprint")] 33 | [ValidateNotNullOrEmpty()] 34 | [PSCustomObject[]]$Blueprint 35 | ) 36 | 37 | begin { 38 | $APIUrl = '/blueprint/api/blueprints' 39 | 40 | function CalculateOutput([PSCustomObject]$BlueprintVersion) { 41 | 42 | [PSCustomObject] @{ 43 | Id = $BlueprintVersion.id 44 | CreatedAt = $BlueprintVersion.createdAt 45 | CreatedBy = $BlueprintVersion.createdBy 46 | UpdatedAt = $BlueprintVersion.updatedAt 47 | UpdatedBy = $BlueprintVersion.updatedBy 48 | OrganizationId = $BlueprintVersion.orgId 49 | ProjectId = $BlueprintVersion.projectId 50 | ProjectName = $BlueprintVersion.projectName 51 | SelfLink = $BlueprintVersion.selfLink 52 | BlueprintId = $BlueprintVersion.blueprintId 53 | Name = $BlueprintVersion.name 54 | Description = $BlueprintVersion.description 55 | Version = $BlueprintVersion.version 56 | Status = $BlueprintVersion.status 57 | VersionDescription = $BlueprintVersion.versionDescription 58 | VersionChangeLog = $BlueprintVersion.versionChangeLog 59 | Valid = $BlueprintVersion.valid 60 | } 61 | } 62 | } 63 | 64 | process { 65 | 66 | try { 67 | 68 | switch ($PsCmdlet.ParameterSetName) { 69 | 70 | # --- Get BlueprintVersion from Blueprint object 71 | 'Blueprint' { 72 | 73 | foreach ($Blueprintobj in $Blueprint){ 74 | 75 | $URI = "$($APIUrl)/$($Blueprintobj.Id)/versions" 76 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 77 | 78 | foreach($version in $Response.content){ 79 | CalculateOutput $version 80 | } 81 | } 82 | 83 | break 84 | } 85 | } 86 | } 87 | catch [Exception]{ 88 | 89 | throw 90 | } 91 | } 92 | 93 | end { 94 | 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Functions/Public/catalog/Get-vRACatalogItem.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRACatalogItem { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Catalog Item 5 | 6 | .DESCRIPTION 7 | Get a vRA Catalog Item 8 | 9 | .PARAMETER Id 10 | The ID of the Catalog Item 11 | 12 | .PARAMETER Name 13 | The Name of the Catalog Item 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRACatalogItem 23 | 24 | .EXAMPLE 25 | Get-vRACatalogItem -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRACatalogItem -Name 'TestCatalogItem' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/catalog/api/items' 46 | 47 | function CalculateOutput([PSCustomObject]$CatalogItem) { 48 | 49 | [PSCustomObject] @{ 50 | Id = $CatalogItem.id 51 | Name = $CatalogItem.name 52 | Description = $CatalogItem.description 53 | Type = $CatalogItem.type 54 | ProjectIds = $CatalogItem.projectIds 55 | CreatedAt = $CatalogItem.createdAt 56 | CreatedBy = $CatalogItem.createdBy 57 | LastUpdatedAt = $CatalogItem.lastUpdatedAt 58 | LastUpdatedBy = $CatalogItem.lastUpdatedBy 59 | IconId = $CatalogItem.iconId 60 | BulkRequestLimit = $CatalogItem.bulkRequestLimit 61 | } 62 | } 63 | } 64 | 65 | process { 66 | 67 | try { 68 | 69 | switch ($PsCmdlet.ParameterSetName) { 70 | 71 | # --- Get Catalog Item by Id 72 | 'ById' { 73 | 74 | foreach ($CatalogItemId in $Id){ 75 | 76 | $URI = "$($APIUrl)?`$filter=id eq '$($CatalogItemId)'" 77 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 78 | 79 | foreach ($CatalogItem in $Response.content) { 80 | 81 | CalculateOutput $CatalogItem 82 | } 83 | } 84 | 85 | break 86 | } 87 | # --- Get Catalog Item by Name 88 | 'ByName' { 89 | 90 | foreach ($CatalogItemName in $Name){ 91 | 92 | $URI = "$($APIUrl)?`$filter=name eq '$($CatalogItemName)'" 93 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 94 | 95 | foreach ($CatalogItem in $Response.content){ 96 | 97 | CalculateOutput $CatalogItem 98 | } 99 | } 100 | 101 | break 102 | } 103 | # --- No parameters passed so return all Catalog Items 104 | 'Standard' { 105 | 106 | $URI = $APIUrl 107 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 108 | 109 | foreach ($CatalogItem in $Response.content){ 110 | 111 | CalculateOutput $CatalogItem 112 | } 113 | } 114 | } 115 | } 116 | catch [Exception]{ 117 | 118 | throw 119 | } 120 | } 121 | 122 | end { 123 | 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/Functions/Public/codestream/Get-vRACodeStreamExecution.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRACodeStreamExecution { 2 | <# 3 | .SYNOPSIS 4 | Retrieve vRA Code Stream Execution depending on input 5 | 6 | .DESCRIPTION 7 | Retrieve a list of vRA Code Stream Executions or a single Execution depending on input 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Code Stream Execution 11 | 12 | .PARAMETER Pipeline 13 | The name of the Pipeline of the vRA Code Stream Execution 14 | 15 | .PARAMETER Project 16 | The name of the Project of the vRA Code Stream Execution 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject. 20 | 21 | .EXAMPLE 22 | Get-vRACodeStreamExecution 23 | 24 | .EXAMPLE 25 | Get-vRACodeStreamExecution -Id '96afe0f9-a2ac-4468-8671-a2ca6fdbca37' 26 | 27 | .EXAMPLE 28 | Get-vRACodeStreamExecution -Pipeline 'My Pipeline' 29 | 30 | .EXAMPLE 31 | Get-vRACodeStreamExecution -Project 'My Project' 32 | 33 | #> 34 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 35 | 36 | Param ( 37 | 38 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 39 | [ValidateNotNullOrEmpty()] 40 | [String[]]$Id, 41 | 42 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 43 | [ValidateNotNullOrEmpty()] 44 | [String[]]$Pipeline, 45 | 46 | [Parameter(Mandatory=$true,ParameterSetName="ByProject")] 47 | [ValidateNotNullOrEmpty()] 48 | [String[]]$Project 49 | 50 | ) 51 | Begin { 52 | 53 | $APIUrl = "/pipeline/api/executions" 54 | 55 | function CalculateOutput($ResponseObject) { 56 | foreach ($Record in $ResponseObject.documents.PsObject.Properties) { 57 | [PSCustomObject]@{ 58 | Name = $Record.value.name+" #"+$Record.value.index 59 | Project = $Record.value.project 60 | Id = $Record.value.id 61 | LastUpdated = $Record.value.updatedAt 62 | Status = $Record.value.status 63 | StatusMessage = $Record.value.statusMessage 64 | ExecutedBy = $Record.value._executedBy 65 | } 66 | } 67 | } 68 | } 69 | Process { 70 | 71 | try { 72 | 73 | switch ($PsCmdlet.ParameterSetName) { 74 | 75 | # --- Get Execution by its id 76 | 'ById' { 77 | foreach ($ExecutionId in $Id) { 78 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$ExecutionId'" -Method GET 79 | CalculateOutput $Response 80 | } 81 | 82 | break 83 | } 84 | 85 | # --- Get Execution by its pipeline name 86 | 'ByName' { 87 | foreach ($PipelineName in $Pipeline) { 88 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$PipelineName'" -Method GET 89 | CalculateOutput $Response 90 | } 91 | 92 | break 93 | } 94 | 95 | # --- Get Execution by its project name 96 | 'ByProject' { 97 | foreach ($ProjectName in $Project) { 98 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$ProjectName'" -Method GET 99 | CalculateOutput $Response 100 | } 101 | 102 | break 103 | } 104 | 105 | # --- No parameters passed so return all executions 106 | 'Standard' { 107 | $Response = Invoke-vRARestMethod -URI $APIUrl -Method GET 108 | CalculateOutput $Response 109 | } 110 | 111 | } 112 | 113 | 114 | } 115 | catch [Exception]{ 116 | 117 | throw 118 | } 119 | } 120 | End { 121 | 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/Functions/Public/codestream/Get-vRACodeStreamPipeline.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRACodeStreamPipeline { 2 | <# 3 | .SYNOPSIS 4 | Retrieve vRA Code Stream Pipeline depending on input 5 | 6 | .DESCRIPTION 7 | Retrieve a list of vRA Code Stream Pipelines or a single Pipeline depending on input 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Code Stream Pipeline 11 | 12 | .PARAMETER Pipeline 13 | The name of the Pipeline of the vRA Code Stream Pipeline 14 | 15 | .PARAMETER Project 16 | The name of the Project of the vRA Code Stream Pipeline 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject. 20 | 21 | .EXAMPLE 22 | Get-vRACodeStreamPipeline 23 | 24 | .EXAMPLE 25 | Get-vRACodeStreamPipeline -Id '96afe0f9-a2ac-4468-8671-a2ca6fdbca37' 26 | 27 | .EXAMPLE 28 | Get-vRACodeStreamPipeline -Pipeline 'My Pipeline' 29 | 30 | .EXAMPLE 31 | Get-vRACodeStreamPipeline -Project 'My Project' 32 | 33 | #> 34 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 35 | 36 | Param ( 37 | 38 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 39 | [ValidateNotNullOrEmpty()] 40 | [String[]]$Id, 41 | 42 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 43 | [ValidateNotNullOrEmpty()] 44 | [String[]]$Pipeline, 45 | 46 | [Parameter(Mandatory=$true,ParameterSetName="ByProject")] 47 | [ValidateNotNullOrEmpty()] 48 | [String[]]$Project 49 | 50 | ) 51 | Begin { 52 | 53 | $APIUrl = "/pipeline/api/pipelines" 54 | 55 | function CalculateOutput($ResponseObject) { 56 | foreach ($Record in $ResponseObject.documents.PsObject.Properties) { 57 | [PSCustomObject]@{ 58 | Name = $Record.value.name 59 | Project = $Record.value.project 60 | Id = $Record.value.id 61 | LastUpdated = $Record.value.updatedAt 62 | UpdatedBy = $Record.value._updatedBy 63 | State = $Record.value.state 64 | } 65 | } 66 | } 67 | } 68 | Process { 69 | 70 | try { 71 | 72 | switch ($PsCmdlet.ParameterSetName) { 73 | 74 | # --- Get Pipeline by its id 75 | 'ById' { 76 | foreach ($PipelineId in $Id) { 77 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$PipelineId'" -Method GET 78 | CalculateOutput $Response 79 | } 80 | 81 | break 82 | } 83 | 84 | # --- Get Pipeline by its pipeline name 85 | 'ByName' { 86 | foreach ($PipelineName in $Pipeline) { 87 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$PipelineName'" -Method GET 88 | CalculateOutput $Response 89 | } 90 | 91 | break 92 | } 93 | 94 | # --- Get Pipeline by its project name 95 | 'ByProject' { 96 | foreach ($ProjectName in $Project) { 97 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$ProjectName'" -Method GET 98 | CalculateOutput $Response 99 | } 100 | 101 | break 102 | } 103 | 104 | # --- No parameters passed so return all Pipelines 105 | 'Standard' { 106 | $Response = Invoke-vRARestMethod -URI $APIUrl -Method GET 107 | CalculateOutput $Response 108 | } 109 | 110 | } 111 | 112 | 113 | } 114 | catch [Exception]{ 115 | 116 | throw 117 | } 118 | } 119 | End { 120 | 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/Functions/Public/codestream/Get-vRACodeStreamVariable.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRACodeStreamVariable { 2 | <# 3 | .SYNOPSIS 4 | Retrieve vRA Code Stream Variable depending on input 5 | 6 | .DESCRIPTION 7 | Retrieve a list of vRA Code Stream Variables or a single Variable depending on input 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Code Stream Variable 11 | 12 | .PARAMETER Variable 13 | The name of the Variable of the vRA Code Stream Variable 14 | 15 | .PARAMETER Project 16 | The name of the Project of the vRA Code Stream Variable 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject. 20 | 21 | .EXAMPLE 22 | Get-vRACodeStreamVariable 23 | 24 | .EXAMPLE 25 | Get-vRACodeStreamVariable -Id '96afe0f9-a2ac-4468-8671-a2ca6fdbca37' 26 | 27 | .EXAMPLE 28 | Get-vRACodeStreamVariable -Variable 'My Variable' 29 | 30 | .EXAMPLE 31 | Get-vRACodeStreamVariable -Project 'My Project' 32 | 33 | #> 34 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 35 | 36 | Param ( 37 | 38 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 39 | [ValidateNotNullOrEmpty()] 40 | [String[]]$Id, 41 | 42 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 43 | [ValidateNotNullOrEmpty()] 44 | [String[]]$Variable, 45 | 46 | [Parameter(Mandatory=$true,ParameterSetName="ByProject")] 47 | [ValidateNotNullOrEmpty()] 48 | [String[]]$Project 49 | 50 | ) 51 | Begin { 52 | 53 | $APIUrl = "/pipeline/api/variables" 54 | 55 | function CalculateOutput($ResponseObject) { 56 | foreach ($Record in $ResponseObject.documents.PsObject.Properties) { 57 | [PSCustomObject]@{ 58 | Name = $Record.value.name 59 | Project = $Record.value.project 60 | Id = $Record.value.id 61 | Type = $Record.value.type 62 | LastUpdated = $Record.value.updatedAt 63 | CreatedBy = $Record.value._createdBy 64 | Value = $Record.value.value 65 | } 66 | } 67 | } 68 | } 69 | Process { 70 | 71 | try { 72 | 73 | switch ($PsCmdlet.ParameterSetName) { 74 | 75 | # --- Get Variable by its id 76 | 'ById' { 77 | foreach ($VariableId in $Id) { 78 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$VariableId'" -Method GET 79 | CalculateOutput $Response 80 | } 81 | 82 | break 83 | } 84 | 85 | # --- Get Variable by its name 86 | 'ByName' { 87 | foreach ($VariableName in $Variable) { 88 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$VariableName'" -Method GET 89 | CalculateOutput $Response 90 | } 91 | 92 | break 93 | } 94 | 95 | # --- Get Variable by its project name 96 | 'ByProject' { 97 | foreach ($ProjectName in $Project) { 98 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$ProjectName'" -Method GET 99 | CalculateOutput $Response 100 | } 101 | 102 | break 103 | } 104 | 105 | # --- No parameters passed so return all Variables 106 | 'Standard' { 107 | $Response = Invoke-vRARestMethod -URI $APIUrl -Method GET 108 | CalculateOutput $Response 109 | } 110 | 111 | } 112 | 113 | 114 | } 115 | catch [Exception]{ 116 | 117 | throw 118 | } 119 | } 120 | End { 121 | 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/Functions/Public/codestream/Remove-vRACodeStreamExecution.ps1: -------------------------------------------------------------------------------- 1 | function Remove-vRACodeStreamExecution { 2 | <# 3 | .SYNOPSIS 4 | Remove a vRA Code Stream Execution 5 | 6 | .DESCRIPTION 7 | Remove a vRA Code Stream Execution 8 | 9 | .PARAMETER Id 10 | The Id of the vRA Code Stream Execution 11 | 12 | .INPUTS 13 | System.String 14 | 15 | .EXAMPLE 16 | ReRemove-vRACodeStreamExecution -Id '4b3bd194-9b5f-40fd-9ed0-58d997237999' 17 | 18 | .EXAMPLE 19 | Get-vRACodeStreamExecution -Pipeline 'My Pipeline' | ReRemove-vRACodeStreamExecution 20 | 21 | #> 22 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ById")] 23 | 24 | Param ( 25 | 26 | [parameter(Mandatory=$true, ValueFromPipelineByPropertyName, ParameterSetName="ById")] 27 | [ValidateNotNullOrEmpty()] 28 | [String[]]$Id 29 | 30 | ) 31 | 32 | begin {} 33 | 34 | process { 35 | 36 | try { 37 | 38 | switch ($PSCmdlet.ParameterSetName) { 39 | 40 | 'ById' { 41 | 42 | foreach ($ExecutionId in $Id) { 43 | 44 | if ($PSCmdlet.ShouldProcess($ExecutionId)){ 45 | 46 | $URI = "/pipeline/api/executions/$($ExecutionId)" 47 | 48 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 49 | } 50 | } 51 | 52 | break 53 | } 54 | } 55 | } 56 | catch [Exception]{ 57 | 58 | throw 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Functions/Public/codestream/Remove-vRACodeStreamVariable.ps1: -------------------------------------------------------------------------------- 1 | function Remove-vRACodeStreamVariable { 2 | <# 3 | .SYNOPSIS 4 | Remove a vRA Code Stream Variable 5 | 6 | .DESCRIPTION 7 | Remove a vRA Code Stream Variable 8 | 9 | .PARAMETER Id 10 | The Id of the vRA Code Stream Variable 11 | 12 | .INPUTS 13 | System.String 14 | 15 | .EXAMPLE 16 | Remove-vRACodeStreamVariable -Id '4b3bd194-9b5f-40fd-9ed0-58d997237999' 17 | 18 | .EXAMPLE 19 | -Variable 'My Variable' | Remove-vRACodeStreamVariable 20 | 21 | #> 22 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ById")] 23 | 24 | Param ( 25 | 26 | [parameter(Mandatory=$true, ValueFromPipelineByPropertyName, ParameterSetName="ById")] 27 | [ValidateNotNullOrEmpty()] 28 | [String[]]$Id 29 | 30 | ) 31 | 32 | begin {} 33 | 34 | process { 35 | 36 | try { 37 | 38 | switch ($PSCmdlet.ParameterSetName) { 39 | 40 | 'ById' { 41 | 42 | foreach ($VariableId in $Id) { 43 | 44 | if ($PSCmdlet.ShouldProcess($VariableId)){ 45 | 46 | $URI = "/pipeline/api/variables/$($VariableId)" 47 | 48 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 49 | } 50 | } 51 | 52 | break 53 | } 54 | } 55 | } 56 | catch [Exception]{ 57 | 58 | throw 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Functions/Public/codestream/Update-vRACodeStreamVariable.ps1: -------------------------------------------------------------------------------- 1 | function Update-vRACodeStreamVariable { 2 | <# 3 | .SYNOPSIS 4 | Update a vRealize Automation Code Stream Variable 5 | 6 | .DESCRIPTION 7 | Update a vRealize Automation Code Stream Variable 8 | 9 | .PARAMETER Id 10 | vRealize Automation Code Stream Variable Id 11 | 12 | .PARAMETER Name 13 | Name of the vRealize Automation Code Stream Variable 14 | 15 | .PARAMETER Description 16 | A description of the vRealize Automation Code Stream Variable 17 | 18 | .PARAMETER Value 19 | vRealize Automation Code Stream Variable Value 20 | 21 | .PARAMETER Type 22 | vRealize Automation Code Stream Variable Type 23 | 24 | .PARAMETER JSON 25 | A JSON string with the body payload 26 | 27 | .INPUTS 28 | System.String 29 | 30 | .OUTPUTS 31 | System.Management.Automation.PSObject 32 | 33 | .EXAMPLE 34 | Update-vRACodeStreamVariable -Name "My Variable" -Type REGULAR -Id 05352fc5-24c2-4ead-b6c0-5373e60a1b3d -Description "Updated from PowervRA!" -Value "New value" 35 | 36 | .EXAMPLE 37 | -Variable "My Variable" | Update-vRACodeStreamVariable -Value "New value" -Description "New Description" 38 | 39 | .EXAMPLE 40 | $JSON = @" 41 | { 42 | "name": "My Variable", 43 | "description": "My variable description" 44 | "type": "REGULAR", 45 | "value": "testing1" 46 | } 47 | "@ 48 | 49 | $JSON | Update-vRACodeStreamVariable -Id 05352fc5-24c2-4ead-b6c0-5373e60a1b3d 50 | 51 | 52 | #> 53 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="Low",DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 54 | 55 | Param ( 56 | 57 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName,ParameterSetName="Standard")] 58 | [ValidateNotNullOrEmpty()] 59 | [String]$Name, 60 | 61 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName,ParameterSetName="Standard")] 62 | [parameter(ParameterSetName = "JSON")] 63 | [ValidateNotNullOrEmpty()] 64 | [String]$Id, 65 | 66 | [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName,ParameterSetName="Standard")] 67 | [ValidateNotNullOrEmpty()] 68 | [String]$Description, 69 | 70 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName,ParameterSetName="Standard")] 71 | [ValidateSet("REGULAR","SECRET","RESTRICTED")] 72 | [ValidateNotNullOrEmpty()] 73 | [String]$Type, 74 | 75 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 76 | [ValidateNotNullOrEmpty()] 77 | [String]$Value, 78 | 79 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ParameterSetName="JSON")] 80 | [ValidateNotNullOrEmpty()] 81 | [String]$JSON 82 | 83 | ) 84 | 85 | begin { } 86 | 87 | process { 88 | 89 | if ($PSBoundParameters.ContainsKey("JSON")) { 90 | $Body = $JSON 91 | } else { 92 | if($Description) { 93 | $Body = @" 94 | { 95 | "name": "$($Name)", 96 | "description": "$($Description)", 97 | "type": "$($Type)", 98 | "value": "$($Value)" 99 | } 100 | "@ 101 | } else { 102 | $Body = @" 103 | { 104 | "name": "$($Name)", 105 | "type": "$($Type)", 106 | "value": "$($Value)" 107 | } 108 | "@ 109 | } 110 | } 111 | 112 | # --- Update the Variable 113 | try { 114 | if ($PSCmdlet.ShouldProcess($Id)){ 115 | 116 | $URI = "/pipeline/api/variables/$($Id)" 117 | $Variable = Invoke-vRARestMethod -Method PUT -URI $URI -Body $Body -Verbose:$VerbosePreference 118 | 119 | [PSCustomObject] @{ 120 | Name = $Variable.name 121 | Description = $Variable.description 122 | Id = $Variable.id 123 | Type = $Variable.type 124 | Value = $Variable.value 125 | Project = $Variable.project 126 | } 127 | } 128 | } 129 | catch [Exception] { 130 | 131 | throw 132 | } 133 | } 134 | end { 135 | 136 | } 137 | } -------------------------------------------------------------------------------- /src/Functions/Public/content/Get-vRAContentSource.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAContentSource { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Content Source 5 | 6 | .DESCRIPTION 7 | Get a vRA Content Source 8 | 9 | .PARAMETER Id 10 | The ID of the Content Source 11 | 12 | .PARAMETER Name 13 | The Name of the Content Source 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAContentSource 23 | 24 | .EXAMPLE 25 | Get-vRAContentSource -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAContentSource -Name 'TestContentSource' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/content/api/sources' 46 | 47 | function CalculateOutput([PSCustomObject]$ContentSource) { 48 | 49 | [PSCustomObject] @{ 50 | Id = $ContentSource.id 51 | Name = $ContentSource.name 52 | TypeId = $ContentSource.typeId 53 | CreatedAt = $ContentSource.createdAt 54 | CreatedBy = $ContentSource.createdBy 55 | LastUpdatedAt = $ContentSource.lastUpdatedAt 56 | LastUpdatedBy = $ContentSource.lastUpdatedBy 57 | Config = $ContentSource.config 58 | SyncEnabled = $ContentSource.syncEnabled 59 | } 60 | } 61 | } 62 | 63 | process { 64 | 65 | try { 66 | 67 | switch ($PsCmdlet.ParameterSetName) { 68 | 69 | # --- Get Content Source by Id 70 | 'ById' { 71 | 72 | foreach ($ContentSourceId in $Id){ 73 | 74 | $URI = "$($APIUrl)?`$filter=id eq '$($ContentSourceId)'" 75 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 76 | 77 | foreach ($ContentSource in $Response.content) { 78 | CalculateOutput $ContentSource 79 | } 80 | } 81 | 82 | break 83 | } 84 | # --- Get Content Source by Name 85 | 'ByName' { 86 | 87 | foreach ($ContentSourceName in $Name){ 88 | 89 | $URI = "$($APIUrl)?`$filter=name eq '$($ContentSourceName)'" 90 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 91 | 92 | foreach ($ContentSource in $Response.content) { 93 | CalculateOutput $ContentSource 94 | } 95 | } 96 | 97 | break 98 | } 99 | # --- No parameters passed so return all Content Sources 100 | 'Standard' { 101 | 102 | $URI = $APIUrl 103 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 104 | 105 | foreach ($ContentSource in $Response.content) { 106 | CalculateOutput $ContentSource 107 | } 108 | } 109 | } 110 | } 111 | catch [Exception]{ 112 | 113 | throw 114 | } 115 | } 116 | 117 | end { 118 | 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/Functions/Public/deployment/Get-vRADeployment.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRADeployment { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Deployment 5 | 6 | .DESCRIPTION 7 | Get a vRA Deployment 8 | 9 | .PARAMETER Id 10 | The ID of the Deployment 11 | 12 | .PARAMETER Name 13 | The Name of the Deployment 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRADeployment 23 | 24 | .EXAMPLE 25 | Get-vRADeployment -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRADeployment -Name 'TestDeployment' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/deployment/api/deployments' 46 | 47 | function CalculateOutput([PSCustomObject]$Deployment) { 48 | 49 | [PSCustomObject] @{ 50 | Id = $Deployment.id 51 | Name = $Deployment.name 52 | OrgId = $Deployment.orgId 53 | CatalogItemId = $Deployment.catalogItemId 54 | CatalogItemVersion = $Deployment.catalogItemVersion 55 | BlueprintId = $Deployment.blueprintId 56 | BlueprintVersion = $Deployment.blueprintVersion 57 | IconId = $Deployment.iconId 58 | CreatedAt = $Deployment.createdAt 59 | CreatedBy = $Deployment.createdBy 60 | LastUpdatedAt = $Deployment.lastUpdatedAt 61 | LastUpdatedBy = $Deployment.lastUpdatedBy 62 | LeaseExpireAt = $Deployment.leaseExpireAt 63 | Inputs = $Deployment.inputs 64 | ProjectId = $Deployment.projectId 65 | Status = $Deployment.status 66 | } 67 | } 68 | } 69 | 70 | process { 71 | 72 | try { 73 | 74 | switch ($PsCmdlet.ParameterSetName) { 75 | 76 | # --- Get Deployment by Id 77 | 'ById' { 78 | 79 | foreach ($DeploymentId in $Id){ 80 | 81 | $URI = "$($APIUrl)?`$filter=id eq '$($DeploymentId)'" 82 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 83 | 84 | foreach ($Deployment in $Response.content) { 85 | CalculateOutput $Deployment 86 | } 87 | } 88 | 89 | break 90 | } 91 | # --- Get Deployment by Name 92 | 'ByName' { 93 | 94 | foreach ($DeploymentName in $Name){ 95 | 96 | $URI = "$($APIUrl)?`$filter=name eq '$($DeploymentName)'" 97 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 98 | 99 | foreach ($Deployment in $Response.content) { 100 | CalculateOutput $Deployment 101 | } 102 | } 103 | 104 | break 105 | } 106 | # --- No parameters passed so return all Deployments 107 | 'Standard' { 108 | 109 | $URI = $APIUrl 110 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 111 | 112 | foreach ($Deployment in $Response.content) { 113 | CalculateOutput $Deployment 114 | } 115 | } 116 | } 117 | } 118 | catch [Exception]{ 119 | 120 | throw 121 | } 122 | } 123 | 124 | end { 125 | 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAAPIVersion.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAAPIVersion { 2 | <# 3 | .SYNOPSIS 4 | Retrieve vRA API version information 5 | 6 | .DESCRIPTION 7 | Retrieve vRA API version information 8 | 9 | .OUTPUTS 10 | System.Management.Automation.PSObject. 11 | 12 | .EXAMPLE 13 | Get-vRAAPIVersion 14 | 15 | #> 16 | [CmdletBinding()][OutputType('System.Management.Automation.PSObject')] 17 | 18 | Param () 19 | 20 | try { 21 | 22 | $URI = "/iaas/api/about" 23 | $Response = Invoke-vRARestMethod -URI $URI -Method GET 24 | 25 | [pscustomobject] @{ 26 | 27 | APIVersion = $Response.latestApiVersion 28 | SupportedAPIs = $Response.supportedApis.apiversion 29 | } 30 | } 31 | catch [Exception]{ 32 | 33 | throw 34 | } 35 | } -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRABlockDevice.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRABlockDevice { 2 | <# 3 | .SYNOPSIS 4 | Retrieve vRA Block Device(s)[Hard Disks] depending on input 5 | 6 | .DESCRIPTION 7 | Retrieve a list of vRA Block Devices or a single Block Device depending on input 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Block Device 11 | 12 | .PARAMETER Name 13 | The Name of the Block Device 14 | 15 | .OUTPUTS 16 | System.Management.Automation.PSObject. 17 | 18 | .EXAMPLE 19 | Get-vRABlockDevice 20 | 21 | .EXAMPLE 22 | Get-vRABlockDevice -Id 'b1dd48e71d74267559bb930934470' 23 | 24 | .EXAMPLE 25 | Get-vRABlockDevice -Name 'my-disk' 26 | 27 | #> 28 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 29 | 30 | Param ( 31 | 32 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$Name 39 | 40 | ) 41 | Begin { 42 | 43 | $APIUrl = "/iaas/api/block-devices" 44 | 45 | function CalculateOutput([PSCustomObject]$Response) { 46 | 47 | foreach ($Record in $Response.content) { 48 | [PSCustomObject]@{ 49 | Owner = $Record.owner 50 | Links = $Record._links 51 | ExternalZoneId = $Record.externalZoneId 52 | ExternalRegionId = $Record.externalRegionId 53 | Description = $Record.description 54 | ExternalId = $Record.externalId 55 | OrgId = $Record.orgId 56 | Tags = $Record.tags 57 | OrganizationId = $Record.organizationId 58 | CapacityInGB = $Record.capacityInGB 59 | CreatedAt = $Record.createdAt 60 | CloudAccountIds = $Record.cloudAccountIds 61 | CustomProperties = $Record.customProperties 62 | DeploymentId = $Record.deploymentId 63 | Name = $Record.name 64 | Id = $Record.id 65 | Persistent = $Record.persistent 66 | ProjectId = $Record.projectId 67 | UpdatedAt = $Record.updatedAt 68 | Status = $Record.status 69 | } 70 | } 71 | } 72 | } 73 | Process 74 | { 75 | try { 76 | 77 | switch ($PsCmdlet.ParameterSetName) { 78 | 79 | # --- Get Block Device by its id 80 | 'ById' { 81 | foreach ($MachineId in $Id) { 82 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$MachineId'" -Method GET 83 | CalculateOutput $Response 84 | } 85 | 86 | break 87 | } 88 | 89 | # --- Get Block Device by its name 90 | 'ByName' { 91 | foreach ($MachineName in $Name) { 92 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$MachineName'" -Method GET 93 | CalculateOutput $Response 94 | } 95 | 96 | break 97 | } 98 | 99 | # --- No parameters passed so return all Block Devices 100 | 'Standard' { 101 | $Response = Invoke-vRARestMethod -URI $APIUrl -Method GET 102 | CalculateOutput $Response 103 | } 104 | 105 | } 106 | 107 | 108 | } 109 | catch [Exception]{ 110 | 111 | throw 112 | } 113 | } 114 | End { 115 | 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRACloudAccount.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRACloudAccount { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Cloud Account. 5 | 6 | .DESCRIPTION 7 | Get a vRA Cloud Account. 8 | 9 | .PARAMETER Id 10 | The id of the Cloud Account 11 | 12 | .PARAMETER Name 13 | The name of the Cloud Account 14 | 15 | .PARAMETER Type 16 | Cloud Account Type, e.g. vSphere, Azure, AWS, GCP etc 17 | 18 | .INPUTS 19 | System.String 20 | 21 | .OUTPUTS 22 | System.Management.Automation.PSObject 23 | 24 | .EXAMPLE 25 | Get-vRACloudAccount 26 | 27 | .EXAMPLE 28 | Get-vRACloudAccount -Id d6f8b87ba95ab675597c97eefdd9c 29 | 30 | .EXAMPLE 31 | Get-vRACloudAccount -Name vSphere_test 32 | 33 | .EXAMPLE 34 | Get-vRACloudAccount -Type vSphere 35 | 36 | #> 37 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 38 | 39 | Param ( 40 | 41 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 42 | [ValidateNotNullOrEmpty()] 43 | [String[]]$Id, 44 | 45 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 46 | [ValidateNotNullOrEmpty()] 47 | [String[]]$Name, 48 | 49 | [Parameter(Mandatory=$false)] 50 | [ValidateSet('azure','aws','gcp','nsx-t','nsx-v','vmc','vsphere')] 51 | [String]$Type 52 | ) 53 | 54 | Begin { 55 | $APIUrl = '/iaas/api/cloud-accounts' 56 | 57 | if ($PSBoundParameters.ContainsKey('Type')){ 58 | 59 | $APIUrl = $APIUrl + "-$Type" 60 | } 61 | 62 | function CalculateOutput([PSCustomObject]$CloudAccount, [String]$Type) { 63 | 64 | if ($null -ne $Type){ 65 | 66 | $CloudAccountType = $Type 67 | } 68 | else { 69 | 70 | $CloudAccountType = $CloudAccount.cloudAccountType 71 | } 72 | 73 | [PSCustomObject] @{ 74 | 75 | Name = $CloudAccount.name 76 | Description = $CloudAccount.description 77 | Id = $CloudAccount.id 78 | CloudAccountType = $CloudAccountType 79 | EnabledRegionIds = $CloudAccount.enabledRegionIds 80 | CustomProperties = $CloudAccount.customProperties 81 | OrganizationId = $CloudAccount.organizationId 82 | Links = $CloudAccount._links 83 | } 84 | } 85 | } 86 | 87 | Process { 88 | 89 | try { 90 | 91 | switch ($PsCmdlet.ParameterSetName) { 92 | 93 | # --- Get Cloud Account by id 94 | 'ById' { 95 | 96 | foreach ($CloudAccountId in $Id) { 97 | 98 | $URI = "$APIUrl/$($CloudAccountId)" 99 | 100 | $CloudAccount = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 101 | 102 | CalculateOutput $CloudAccount $Type 103 | } 104 | 105 | break 106 | } 107 | # --- Get Cloud Account by name 108 | 'ByName' { 109 | 110 | $URI = $APIUrl 111 | 112 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 113 | 114 | foreach ($CloudAccountName in $Name) { 115 | 116 | $CloudAccount = $Response.content | Where-Object {$_.name -eq $CloudAccountName} 117 | 118 | if (!$CloudAccount) { 119 | 120 | throw "Could not find Cloud Account with name: $($CloudAccountName)" 121 | 122 | } 123 | 124 | CalculateOutput $CloudAccount $Type 125 | } 126 | 127 | break 128 | } 129 | # --- No parameters passed so return all Cloud Accounts 130 | 'Standard' { 131 | 132 | $URI = $APIUrl 133 | 134 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 135 | 136 | foreach ($CloudAccount in $Response.content) { 137 | 138 | CalculateOutput $CloudAccount $Type 139 | } 140 | } 141 | } 142 | } 143 | catch [Exception]{ 144 | 145 | throw 146 | } 147 | } 148 | 149 | End { 150 | 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRACloudZone.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRACloudZone { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Cloud Zone 5 | 6 | .DESCRIPTION 7 | Get a vRA Cloud Zone 8 | 9 | .PARAMETER Id 10 | The ID of the Cloud Zone 11 | 12 | .PARAMETER Name 13 | The Name of the Cloud Zone 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRACloudZone 23 | 24 | .EXAMPLE 25 | Get-vRACloudZone -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRACloudZone -Name 'TestCloudZone' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/zones' 46 | 47 | function CalculateOutput([PSCustomObject]$CloudZone) { 48 | 49 | [PSCustomObject] @{ 50 | 51 | Name = $CloudZone.name 52 | Description = $CloudZone.description 53 | Id = $CloudZone.id 54 | PlacementPolicy = $CloudZone.placementPolicy 55 | Tags = $CloudZone.tags 56 | TagsToMatch = $CloudZone.tagsToMatch 57 | CustomProperties = $CloudZone.customProperties 58 | Folder = $CloudZone.folder 59 | OrganizationId = $CloudZone.organizationId 60 | Links = $CloudZone._links 61 | UpdatedAt = $CloudZone.updatedAt 62 | } 63 | } 64 | } 65 | 66 | process { 67 | 68 | try { 69 | 70 | switch ($PsCmdlet.ParameterSetName) { 71 | 72 | # --- Get Cloud Zone by Id 73 | 'ById' { 74 | 75 | foreach ($CloudZoneId in $Id){ 76 | 77 | $URI = "$($APIUrl)?`$filter=id eq '$($CloudZoneId)'" 78 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 79 | 80 | foreach ($CloudZone in $Response.content) { 81 | 82 | CalculateOutput $CloudZone 83 | } 84 | } 85 | 86 | break 87 | } 88 | # --- Get Cloud Zone by Name 89 | 'ByName' { 90 | 91 | foreach ($CloudZoneName in $Name){ 92 | 93 | $URI = "$($APIUrl)?`$filter=name eq '$($CloudZoneName)'" 94 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 95 | 96 | foreach ($CloudZone in $Response.content){ 97 | 98 | CalculateOutput $CloudZone 99 | } 100 | } 101 | 102 | break 103 | } 104 | # --- No parameters passed so return all Cloud Zones 105 | 'Standard' { 106 | 107 | $URI = $APIUrl 108 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 109 | 110 | foreach ($CloudZone in $Response.content){ 111 | 112 | CalculateOutput $CloudZone 113 | } 114 | } 115 | } 116 | } 117 | catch [Exception]{ 118 | 119 | throw 120 | } 121 | } 122 | 123 | end { 124 | 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAExternalNetworkIPRange.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAExternalNetworkIPRange { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA External Network IP Range 5 | 6 | .DESCRIPTION 7 | Get a vRA External Network IP Range 8 | 9 | .PARAMETER Id 10 | The ID of the vRA External Network IP Range 11 | 12 | .PARAMETER Name 13 | The Name of the vRA External Network IP Range 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAExternalNetworkIPRange 23 | 24 | .EXAMPLE 25 | Get-vRAExternalNetworkIPRange -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAExternalNetworkIPRange -Name 'TestExternalNetworkIPRange' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/external-network-ip-ranges' 46 | 47 | function CalculateOutput([PSCustomObject]$ExternalNetworkIPRange) { 48 | 49 | [PSCustomObject] @{ 50 | Owner = $ExternalNetworkIPRange.owner 51 | Description = $ExternalNetworkIPRange.description 52 | Tags = $ExternalNetworkIPRange.tags 53 | ExternalId = $ExternalNetworkIPRange.externalId 54 | SubnetPrefixLength = $ExternalNetworkIPRange.subnetPrefixLength 55 | Name = $ExternalNetworkIPRange.name 56 | Id = $ExternalNetworkIPRange.id 57 | CreatedAt = $ExternalNetworkIPRange.createdAt 58 | UpdatedAt = $ExternalNetworkIPRange.updatedAt 59 | OrganizationId = $ExternalNetworkIPRange.orgId 60 | StartIPAddress = $ExternalNetworkIPRange.startIPAddress 61 | EndIPAddress = $ExternalNetworkIPRange.endIPAddress 62 | IPVersion = $ExternalNetworkIPRange.ipVersion 63 | AddressSpaceId = $ExternalNetworkIPRange.addressSpaceId 64 | DNSServerAddresses = $ExternalNetworkIPRange.dnsServerAddresses 65 | DNSSearchDomains = $ExternalNetworkIPRange.dnsSearchDomains 66 | Domain = $ExternalNetworkIPRange.domain 67 | GatewayAddress = $ExternalNetworkIPRange.gatewayAddress 68 | Links = $ExternalNetworkIPRange._links 69 | } 70 | } 71 | } 72 | 73 | process { 74 | 75 | try { 76 | 77 | switch ($PsCmdlet.ParameterSetName) { 78 | 79 | # --- Get External Network IP Range by Id 80 | 'ById' { 81 | 82 | foreach ($ExternalNetworkIPRangeId in $Id){ 83 | 84 | $URI = "$($APIUrl)?`$filter=id eq '$($ExternalNetworkIPRangeId)'" 85 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 86 | 87 | foreach ($ExternalNetworkIPRange in $Response.content) { 88 | CalculateOutput $ExternalNetworkIPRange 89 | } 90 | } 91 | 92 | break 93 | } 94 | # --- Get External Network IP Range by Name 95 | 'ByName' { 96 | 97 | foreach ($ExternalNetworkIPRangeName in $Name){ 98 | 99 | $URI = "$($APIUrl)?`$filter=name eq '$($ExternalNetworkIPRangeName)'" 100 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 101 | 102 | foreach ($ExternalNetworkIPRange in $Response.content) { 103 | CalculateOutput $ExternalNetworkIPRange 104 | } 105 | } 106 | 107 | break 108 | } 109 | # --- No parameters passed so return all External Network IP Ranges 110 | 'Standard' { 111 | 112 | $URI = $APIUrl 113 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 114 | 115 | foreach ($ExternalNetworkIPRange in $Response.content) { 116 | CalculateOutput $ExternalNetworkIPRange 117 | } 118 | } 119 | } 120 | } 121 | catch [Exception]{ 122 | 123 | throw 124 | } 125 | } 126 | 127 | end { 128 | 129 | } 130 | } 131 | 132 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAFabricAWSVolumeType.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAFabricAWSVolumeType { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Fabric AWS Volume Types 5 | 6 | .DESCRIPTION 7 | Get a vRA Fabric AWS Volume Types 8 | 9 | .INPUTS 10 | None 11 | 12 | .OUTPUTS 13 | System.Management.Automation.PSObject 14 | 15 | .EXAMPLE 16 | Get-vRAFabricAWSVolumeTypes 17 | 18 | #> 19 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 20 | 21 | Param ( 22 | ) 23 | 24 | begin { 25 | $APIUrl = '/iaas/api/fabric-aws-volume-types' 26 | 27 | function CalculateOutput([PSCustomObject]$FabricAWSVolumeTypes) { 28 | 29 | [PSCustomObject] @{ 30 | VolumeTypes = $FabricAWSVolumeTypes.volumeTypes 31 | } 32 | } 33 | } 34 | 35 | process { 36 | 37 | try { 38 | 39 | switch ($PsCmdlet.ParameterSetName) { 40 | 41 | # --- Return all Fabric AWS Volume Types 42 | 'Standard' { 43 | 44 | $URI = $APIUrl 45 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 46 | 47 | foreach ($FabricAWSVolumeTypes in $Response.content) { 48 | CalculateOutput $FabricAWSVolumeTypes 49 | } 50 | } 51 | } 52 | } 53 | catch [Exception]{ 54 | 55 | throw 56 | } 57 | } 58 | 59 | end { 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAFabricAzureStorageAccount.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAFabricAzureStorageAccount { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Fabric Azure Storage Account 5 | 6 | .DESCRIPTION 7 | Get a vRA Fabric Azure Storage Account 8 | 9 | .PARAMETER Id 10 | The ID of the Fabric Azure Storage Account 11 | 12 | .PARAMETER Name 13 | The Name of the Fabric Azure Storage Account 14 | 15 | .INPUTS 16 | None 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAFabricAzureStorageAccounts 23 | 24 | .EXAMPLE 25 | Get-vRAFabricAzureStorageAccounts -Id 1c3a50ca-1c38-42a3-a572-209d5dfdecf7 26 | 27 | .EXAMPLE 28 | Get-vRAFabricAzureStorageAccounts -Name "test-Azure-Storage-Account" 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName = "Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = "ById")] 35 | [ValidateNotNullOrEmpty()] 36 | [String[]]$Id, 37 | 38 | [Parameter(Mandatory = $true, ParameterSetName = "ByName")] 39 | [ValidateNotNullOrEmpty()] 40 | [String[]]$Name 41 | ) 42 | 43 | begin { 44 | $APIUrl = '/iaas/api/fabric-azure-storage-accounts' 45 | 46 | function CalculateOutput([PSCustomObject]$FabricAzureStorageAccounts) { 47 | 48 | [PSCustomObject] @{ 49 | 50 | Type = $FabricAzureStorageAccounts.type 51 | ExternalRegionId = $FabricAzureStorageAccounts.externalRegionId 52 | Name = $FabricAzureStorageAccounts.name 53 | Id = $FabricAzureStorageAccounts.id 54 | OrganizationId = $FabricAzureStorageAccounts.organizationId 55 | CloudAccountIds = $FabricAzureStorageAccounts.cloudAccountIds 56 | Links = $FabricAzureStorageAccounts._links 57 | } 58 | } 59 | } 60 | 61 | process { 62 | 63 | try { 64 | 65 | switch ($PsCmdlet.ParameterSetName) { 66 | 67 | # --- Get Cloud Account by id 68 | 'ById' { 69 | 70 | foreach ($FabricAzureStorageAccountId in $Id) { 71 | 72 | $URI = "$APIUrl/$($FabricAzureStorageAccountId)" 73 | 74 | $FabricAzureStorageAccount = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 75 | 76 | CalculateOutput $FabricAzureStorageAccount 77 | } 78 | 79 | break 80 | } 81 | # --- Get Cloud Account by name 82 | 'ByName' { 83 | 84 | $URI = $APIUrl 85 | 86 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 87 | 88 | foreach ($FabricAzureStorageAccountName in $Name) { 89 | 90 | $FabricAzureStorageAccounts = $Response.content | Where-Object { $_.name -eq $FabricAzureStorageAccountName } 91 | 92 | if (!$FabricAzureStorageAccounts) { 93 | 94 | throw "Could not find Cloud Account with name: $($FabricAzureStorageAccounts)" 95 | 96 | } 97 | 98 | CalculateOutput $FabricAzureStorageAccounts 99 | } 100 | 101 | break 102 | } 103 | # --- Return all Fabric AWS Volume Types 104 | 'Standard' { 105 | 106 | $URI = $APIUrl 107 | 108 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 109 | 110 | foreach ($FabricAzureStorageAccounts in $Response.content) { 111 | 112 | CalculateOutput $FabricAzureStorageAccounts 113 | } 114 | } 115 | } 116 | } 117 | catch [Exception] { 118 | 119 | throw 120 | } 121 | } 122 | 123 | end { 124 | 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAFabricCompute.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAFabricCompute { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Fabric Compute 5 | 6 | .DESCRIPTION 7 | Get a vRA Fabric Compute 8 | 9 | .PARAMETER Id 10 | The ID of the Fabric Compute 11 | 12 | .PARAMETER Name 13 | The Name of the Fabric Compute 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAFabricCompute 23 | 24 | .EXAMPLE 25 | Get-vRAFabricCompute -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAFabricCompute -Name 'TestFabricCompute' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/deployment/api/fabric-computes' 46 | 47 | function CalculateOutput([PSCustomObject]$FabricCompute) { 48 | 49 | [PSCustomObject] @{ 50 | ExternalRegionId = $FabricCompute.externalRegionId 51 | Tags = $FabricCompute.tags 52 | Type = $FabricCompute.type 53 | CustomProperties = $FabricCompute.customProperties 54 | ExternalId = $FabricCompute.externalId 55 | Name = $FabricCompute.name 56 | Id = $FabricCompute.id 57 | CreatedAt = $FabricCompute.createdAt 58 | UpdatedAt = $FabricCompute.updatedAt 59 | OrganizationId = $FabricCompute.organizationId 60 | } 61 | } 62 | } 63 | 64 | process { 65 | 66 | try { 67 | 68 | switch ($PsCmdlet.ParameterSetName) { 69 | 70 | # --- Get FabricCompute by Id 71 | 'ById' { 72 | 73 | foreach ($FabricComputeId in $Id){ 74 | 75 | $URI = "$($APIUrl)?`$filter=id eq '$($FabricComputeId)'" 76 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 77 | 78 | foreach ($FabricCompute in $Response.content) { 79 | CalculateOutput $FabricCompute 80 | } 81 | } 82 | 83 | break 84 | } 85 | # --- Get FabricCompute by Name 86 | 'ByName' { 87 | 88 | foreach ($FabricComputeName in $Name){ 89 | 90 | $URI = "$($APIUrl)?`$filter=name eq '$($FabricComputeName)'" 91 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 92 | 93 | foreach ($FabricCompute in $Response.content) { 94 | CalculateOutput $FabricCompute 95 | } 96 | } 97 | 98 | break 99 | } 100 | # --- No parameters passed so return all FabricComputes 101 | 'Standard' { 102 | 103 | $URI = $APIUrl 104 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 105 | 106 | foreach ($FabricCompute in $Response.content) { 107 | CalculateOutput $FabricCompute 108 | } 109 | } 110 | } 111 | } 112 | catch [Exception]{ 113 | 114 | throw 115 | } 116 | } 117 | 118 | end { 119 | 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAFabricImage.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAFabricImage { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA FabricImages 5 | 6 | .DESCRIPTION 7 | Get a vRA FabricImages 8 | 9 | .PARAMETER Id 10 | The ID of the FabricImages 11 | 12 | .PARAMETER Name 13 | The Name of the FabricImages 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAFabricImages 23 | 24 | .EXAMPLE 25 | Get-vRAFabricImages -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAFabricImages -Name 'TestFabricImages' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/deployment/api/fabric-images' 46 | 47 | function CalculateOutput([PSCustomObject]$FabricImages) { 48 | 49 | [PSCustomObject] @{ 50 | OSFamily = $FabricImages.osFamily 51 | ExternalRegionId = $FabricImages.externalRegionId 52 | CustomProperties = $FabricImages.customProperties 53 | IsPrivate = $FabricImages.isPrivate 54 | ExternalId = $FabricImages.externalId 55 | Name = $FabricImages.name 56 | Description = $FabricImages.description 57 | Id = $FabricImages.id 58 | UpdatedAt = $FabricImages.updatedAt 59 | OrganizationId = $FabricImages.organizationId 60 | Links = $FabricImages._links 61 | } 62 | } 63 | } 64 | 65 | process { 66 | 67 | try { 68 | 69 | switch ($PsCmdlet.ParameterSetName) { 70 | 71 | # --- Get Fabric Image by Id 72 | 'ById' { 73 | 74 | foreach ($FabricImagesId in $Id){ 75 | 76 | $URI = "$($APIUrl)?`$filter=id eq '$($FabricImagesId)'" 77 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 78 | 79 | foreach ($FabricImages in $Response.content) { 80 | CalculateOutput $FabricImages 81 | } 82 | } 83 | 84 | break 85 | } 86 | # --- Get Fabric Image by Name 87 | 'ByName' { 88 | 89 | foreach ($FabricImagesName in $Name){ 90 | 91 | $URI = "$($APIUrl)?`$filter=name eq '$($FabricImagesName)'" 92 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 93 | 94 | foreach ($FabricImages in $Response.content) { 95 | CalculateOutput $FabricImages 96 | } 97 | } 98 | 99 | break 100 | } 101 | # --- No parameters passed so return all Fabric Images 102 | 'Standard' { 103 | 104 | $URI = $APIUrl 105 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 106 | 107 | foreach ($FabricImages in $Response.content) { 108 | CalculateOutput $FabricImages 109 | } 110 | } 111 | } 112 | } 113 | catch [Exception]{ 114 | 115 | throw 116 | } 117 | } 118 | 119 | end { 120 | 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAFabricNetwork.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAFabricNetwork { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Fabric Network 5 | 6 | .DESCRIPTION 7 | Get a vRA Fabric Network 8 | 9 | .PARAMETER Id 10 | The ID of the Fabric Network 11 | 12 | .PARAMETER Name 13 | The Name of the Fabric Network 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAFabricNetwork 23 | 24 | .EXAMPLE 25 | Get-vRAFabricNetwork -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAFabricNetwork -Name 'TestFabricNetwork' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/fabric-networks' 46 | 47 | function CalculateOutput([PSCustomObject]$FabricNetwork) { 48 | 49 | [PSCustomObject] @{ 50 | ExternalRegionId = $FabricNetwork.externalRegionId 51 | CloudAccountIds = $FabricNetwork.cloudAccountIds 52 | ExternalId = $FabricNetwork.externalId 53 | Name = $FabricNetwork.name 54 | Id = $FabricNetwork.id 55 | CreatedAt = $FabricNetwork.createdAt 56 | UpdatedAt = $FabricNetwork.updatedAt 57 | OrganizationId = $FabricNetwork.organizationId 58 | Links = $FabricNetwork._links 59 | } 60 | } 61 | } 62 | 63 | process { 64 | 65 | try { 66 | 67 | switch ($PsCmdlet.ParameterSetName) { 68 | 69 | # --- Get Fabric Network by Id 70 | 'ById' { 71 | 72 | foreach ($FabricNetworkId in $Id){ 73 | 74 | $URI = "$($APIUrl)?`$filter=id eq '$($FabricNetworkId)'" 75 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 76 | 77 | foreach ($FabricNetwork in $Response.content) { 78 | CalculateOutput $FabricNetwork 79 | } 80 | } 81 | 82 | break 83 | } 84 | # --- Get Fabric Network by Name 85 | 'ByName' { 86 | 87 | foreach ($FabricNetworkName in $Name){ 88 | 89 | $URI = "$($APIUrl)?`$filter=name eq '$($FabricNetworkName)'" 90 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 91 | 92 | foreach ($FabricNetwork in $Response.content) { 93 | CalculateOutput $FabricNetwork 94 | } 95 | } 96 | 97 | break 98 | } 99 | # --- No parameters passed so return all Fabric Networks 100 | 'Standard' { 101 | 102 | $URI = $APIUrl 103 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 104 | 105 | foreach ($FabricNetwork in $Response.content) { 106 | CalculateOutput $FabricNetwork 107 | } 108 | } 109 | } 110 | } 111 | catch [Exception]{ 112 | 113 | throw 114 | } 115 | } 116 | 117 | end { 118 | 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAFlavorProfile.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAFlavorProfile { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Flavor Profile 5 | 6 | .DESCRIPTION 7 | Get a vRA Flavor Profile 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Flavor Profile 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Flavor Profile 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAFlavorProfile 23 | 24 | .EXAMPLE 25 | Get-vRAFlavorProfile -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAFlavorProfile -Name 'TestFlavorProfile' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/flavor-profiles' 46 | 47 | function CalculateOutput([PSCustomObject]$FlavorProfile) { 48 | 49 | [PSCustomObject] @{ 50 | FlavorMappings = $FlavorProfile.flavorMappings 51 | ExternalRegionId = $FlavorProfile.externalRegionId 52 | Name = $FlavorProfile.name 53 | Id = $FlavorProfile.id 54 | UpdatedAt = $FlavorProfile.updatedAt 55 | OrganizationId = $FlavorProfile.organizationId 56 | Links = $FlavorProfile._links 57 | } 58 | } 59 | } 60 | 61 | process { 62 | 63 | try { 64 | 65 | switch ($PsCmdlet.ParameterSetName) { 66 | 67 | # --- Get Flavor Profile by Id 68 | 'ById' { 69 | 70 | foreach ($FlavorProfileId in $Id){ 71 | 72 | $URI = "$($APIUrl)?`$filter=id eq '$($FlavorProfileId)'" 73 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 74 | 75 | foreach ($FlavorProfile in $Response.content) { 76 | CalculateOutput $FlavorProfile 77 | } 78 | } 79 | 80 | break 81 | } 82 | # --- Get Flavor Profile by Name 83 | 'ByName' { 84 | 85 | foreach ($FlavorProfileName in $Name){ 86 | 87 | $URI = "$($APIUrl)?`$filter=name eq '$($FlavorProfileName)'" 88 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 89 | 90 | foreach ($FlavorProfile in $Response.content) { 91 | CalculateOutput $FlavorProfile 92 | } 93 | } 94 | 95 | break 96 | } 97 | # --- No parameters passed so return all Flavor Profiles 98 | 'Standard' { 99 | 100 | $URI = $APIUrl 101 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 102 | 103 | foreach ($FlavorProfile in $Response.content) { 104 | CalculateOutput $FlavorProfile 105 | } 106 | } 107 | } 108 | } 109 | catch [Exception]{ 110 | 111 | throw 112 | } 113 | } 114 | 115 | end { 116 | 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAImageProfile.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAImageProfile { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Image Profile 5 | 6 | .DESCRIPTION 7 | Get a vRA Image Profile 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Image Profile 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Image Profile 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAImageProfile 23 | 24 | .EXAMPLE 25 | Get-vRAImageProfile -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAImageProfile -Name 'TestImageProfile' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/image-profiles' 46 | 47 | function CalculateOutput([PSCustomObject]$ImageProfile) { 48 | 49 | [PSCustomObject] @{ 50 | ImageMappings = $ImageProfile.imageMappings.mapping ## Pull out mappings from nested JSON object 51 | ImageMapNames = ($ImageProfile.imageMappings.mapping | get-member -MemberType NoteProperty).Name ## List mappings by their key name for easier access 52 | ExternalRegionId = $ImageProfile.externalRegionId 53 | Name = $ImageProfile.name 54 | Id = $ImageProfile.id 55 | UpdatedAt = $ImageProfile.updatedAt 56 | OrgId = $ImageProfile.orgId 57 | Links = $ImageProfile._links 58 | } 59 | } 60 | } 61 | 62 | process { 63 | 64 | try { 65 | 66 | switch ($PsCmdlet.ParameterSetName) { 67 | 68 | # --- Get Image Profile by Id 69 | 'ById' { 70 | 71 | foreach ($ImageProfileId in $Id){ 72 | 73 | $URI = "$($APIUrl)?`$filter=id eq '$($ImageProfileId)'" 74 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 75 | 76 | foreach ($ImageProfile in $Response.content) { 77 | CalculateOutput $ImageProfile 78 | } 79 | } 80 | 81 | break 82 | } 83 | # --- Get Image Profile by Name 84 | 'ByName' { 85 | 86 | foreach ($ImageProfileName in $Name){ 87 | 88 | $URI = "$($APIUrl)?`$filter=name eq '$($ImageProfileName)'" 89 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 90 | 91 | foreach ($ImageProfile in $Response.content) { 92 | CalculateOutput $ImageProfile 93 | } 94 | } 95 | 96 | break 97 | } 98 | # --- No parameters passed so return all Image Profiles 99 | 'Standard' { 100 | 101 | $URI = $APIUrl 102 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 103 | 104 | foreach ($ImageProfile in $Response.content) { 105 | CalculateOutput $ImageProfile 106 | } 107 | } 108 | } 109 | } 110 | catch [Exception]{ 111 | 112 | throw 113 | } 114 | } 115 | 116 | end { 117 | 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRALoadBalancer.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRALoadBalancer { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Load Balancer 5 | 6 | .DESCRIPTION 7 | Get a vRA Load Balancer 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Load Balancer 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Load Balancer 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRALoadBalancer 23 | 24 | .EXAMPLE 25 | Get-vRALoadBalancer -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRALoadBalancer -Name 'TestLoadBalancer' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/load-balancers' 46 | 47 | function CalculateOutput([PSCustomObject]$LoadBalancer) { 48 | 49 | [PSCustomObject] @{ 50 | Address = $LoadBalancer.address 51 | Routes = $LoadBalancer.routes 52 | ExternalRegionId = $LoadBalancer.externalRegionId 53 | CloudAccountIds = $LoadBalancer.cloudAccountIds 54 | Tags = $LoadBalancer.tags 55 | CustomProperties = $LoadBalancer.customProperties 56 | ExternalId = $LoadBalancer.externalId 57 | Name = $LoadBalancer.name 58 | Id = $LoadBalancer.id 59 | UpdatedAt = $LoadBalancer.updatedAt 60 | OrgId = $LoadBalancer.orgId 61 | Links = $LoadBalancer._links 62 | } 63 | } 64 | } 65 | 66 | process { 67 | 68 | try { 69 | 70 | switch ($PsCmdlet.ParameterSetName) { 71 | 72 | # --- Get Load Balancer by Id 73 | 'ById' { 74 | 75 | foreach ($LoadBalancerId in $Id){ 76 | 77 | $URI = "$($APIUrl)?`$filter=id eq '$($LoadBalancerId)'" 78 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 79 | 80 | foreach ($LoadBalancer in $Response.content) { 81 | CalculateOutput $LoadBalancer 82 | } 83 | } 84 | 85 | break 86 | } 87 | # --- Get Load Balancer by Name 88 | 'ByName' { 89 | 90 | foreach ($LoadBalancerName in $Name){ 91 | 92 | $URI = "$($APIUrl)?`$filter=name eq '$($LoadBalancerName)'" 93 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 94 | 95 | foreach ($LoadBalancer in $Response.content) { 96 | CalculateOutput $LoadBalancer 97 | } 98 | } 99 | 100 | break 101 | } 102 | # --- No parameters passed so return all Load Balancers 103 | 'Standard' { 104 | 105 | $URI = $APIUrl 106 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 107 | 108 | foreach ($LoadBalancer in $Response.content) { 109 | CalculateOutput $LoadBalancer 110 | } 111 | } 112 | } 113 | } 114 | catch [Exception]{ 115 | 116 | throw 117 | } 118 | } 119 | 120 | end { 121 | 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAMachine.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAMachine { 2 | <# 3 | .SYNOPSIS 4 | Retrieve vRA Machine(s) depending on input 5 | 6 | .DESCRIPTION 7 | Retrieve a list of vRA Machines or a single machine depending on input 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Machine 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Machine 14 | 15 | .OUTPUTS 16 | System.Management.Automation.PSObject. 17 | 18 | .EXAMPLE 19 | Get-vRAMachine 20 | 21 | .EXAMPLE 22 | Get-vRAMachine -Id 'b1dd48e71d74267559bb930934470' 23 | 24 | .EXAMPLE 25 | Get-vRAMachine -Name 'iaas01' 26 | 27 | #> 28 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 29 | 30 | Param ( 31 | 32 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$Name 39 | 40 | ) 41 | Begin { 42 | 43 | $APIUrl = "/iaas/api/machines" 44 | 45 | function CalculateOutput([PSCustomObject]$Response) { 46 | 47 | foreach ($Record in $Response.content) { 48 | [PSCustomObject]@{ 49 | Name = $Record.name 50 | PowerState = $Record.powerState 51 | IPAddress = $Record.address 52 | ExternalRegionId = $Record.externalRegionId 53 | CloudAccountIDs = $Record.cloudAccountIds 54 | ExternalId = $Record.externalId 55 | Id = $Record.id 56 | DateCreated = $Record.createdAt 57 | LastUpdated = $Record.updatedAt 58 | OrganizationId = $Record.organizationId 59 | Properties = $Record.customProperties 60 | Tags = $Record.tags 61 | } 62 | } 63 | } 64 | } 65 | Process { 66 | 67 | try { 68 | 69 | switch ($PsCmdlet.ParameterSetName) { 70 | 71 | # --- Get Machine by its id 72 | 'ById' { 73 | foreach ($MachineId in $Id) { 74 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$MachineId'" -Method GET 75 | CalculateOutput $Response 76 | } 77 | 78 | break 79 | } 80 | 81 | # --- Get Machine by its name 82 | 'ByName' { 83 | foreach ($MachineName in $Name) { 84 | $Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$MachineName'" -Method GET 85 | CalculateOutput $Response 86 | } 87 | 88 | break 89 | } 90 | 91 | # --- No parameters passed so return all machines 92 | 'Standard' { 93 | $Response = Invoke-vRARestMethod -URI $APIUrl -Method GET 94 | CalculateOutput $Response 95 | } 96 | 97 | } 98 | 99 | 100 | } 101 | catch [Exception]{ 102 | 103 | throw 104 | } 105 | } 106 | End { 107 | 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAMachineDisk.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAMachineDisk { 2 | <# 3 | .SYNOPSIS 4 | Retrieve a vRA Machine's Disks 5 | 6 | .DESCRIPTION 7 | Retrieve the disks for a vRA Machine 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Machine 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Machine 14 | 15 | .PARAMETER DiskId 16 | The Id of the individual Disk to retrieve 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject. 20 | 21 | .EXAMPLE 22 | Get-vRAMachineDisk -Id 'b1dd48e71d74267559bb930934470' 23 | 24 | .EXAMPLE 25 | Get-vRAMachineDisk -Name 'iaas01' 26 | 27 | .EXAMPLE 28 | GET-vRAMachineDisk -Name 'iaas01' -DiskId b1dd48e71d74267559bb930919aa8,b1dd48e71d74267559bb930915840 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="ByName")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String]$Name, 42 | 43 | [Parameter(Mandatory=$false)] 44 | [ValidateNotNullOrEmpty()] 45 | [String[]]$DiskId 46 | 47 | ) 48 | Begin { 49 | 50 | $APIUrl = "/iaas/api/machines" 51 | 52 | function CalculateOutput([PSCustomObject]$Response) { 53 | 54 | # --- The output comes in two flavors, a list or a single item, we are checking for list here 55 | if ($Response.content) { 56 | foreach ($Record in $Response.content) { 57 | [PSCustomObject]@{ 58 | Name = $Record.name 59 | Status = $Record.status 60 | Owner = $Record.owner 61 | ExternalRegionId = $Record.externalRegionId 62 | ExternalZoneId = $Record.externalZoneId 63 | Description = $Record.description 64 | Tags = $Record.tags 65 | CapacityInGB = $Record.capacityInGB 66 | CloudAccountIDs = $Record.cloudAccountIds 67 | ExternalId = $Record.externalId 68 | Id = $Record.id 69 | DateCreated = $Record.createdAt 70 | LastUpdated = $Record.updatedAt 71 | OrganizationId = $Record.orgId 72 | Properties = $Record.customProperties 73 | ProjectId = $Record.projectId 74 | Persistent = $Record.persistent 75 | } 76 | } 77 | } else { 78 | [PSCustomObject]@{ 79 | Name = $Response.name 80 | Status = $Response.status 81 | Owner = $Response.owner 82 | ExternalRegionId = $Response.externalRegionId 83 | ExternalZoneId = $Response.externalZoneId 84 | Description = $Response.description 85 | Tags = $Response.tags 86 | CapacityInGB = $Response.capacityInGB 87 | CloudAccountIDs = $Response.cloudAccountIds 88 | ExternalId = $Response.externalId 89 | Id = $Response.id 90 | DateCreated = $Response.createdAt 91 | LastUpdated = $Response.updatedAt 92 | OrganizationId = $Response.orgId 93 | Properties = $Response.customProperties 94 | ProjectId = $Response.projectId 95 | Persistent = $Response.persistent 96 | } 97 | } 98 | 99 | } 100 | } 101 | Process { 102 | 103 | try { 104 | 105 | switch ($PsCmdlet.ParameterSetName) { 106 | 107 | # --- Get Machine Disk by its id 108 | 'ById' { 109 | 110 | # --- Check to see if the DiskId's were optionally present 111 | if ($DiskId) { 112 | 113 | foreach($Disk in $DiskId) { 114 | 115 | $Response = Invoke-vRARestMethod -URI "$APIUrl`/$Id`/disks`/$Disk" -Method GET 116 | 117 | CalculateOutput $Response 118 | 119 | } 120 | 121 | } else { 122 | 123 | $Response = Invoke-vRARestMethod -URI "$APIUrl`/$Id`/disks" -Method GET 124 | 125 | CalculateOutput $Response 126 | 127 | } 128 | 129 | break 130 | } 131 | 132 | # --- Get Machine Disk by its name 133 | # --- Will need to retrieve the machine first, then use ID to get final output 134 | 'ByName' { 135 | 136 | $MachineResponse = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$Name'`&`$select=id" -Method GET 137 | $MachineId = $MachineResponse.content[0].id 138 | 139 | # --- Check to see if the DiskId's were optionally present 140 | if ($DiskId) { 141 | 142 | foreach($Disk in $DiskId) { 143 | 144 | $Response = Invoke-vRARestMethod -URI "$APIUrl`/$MachineId`/disks`/$Disk" -Method GET 145 | 146 | CalculateOutput $Response 147 | 148 | } 149 | 150 | 151 | } else { 152 | 153 | $Response = Invoke-vRARestMethod -URI "$APIUrl`/$MachineId`/disks" -Method GET 154 | 155 | CalculateOutput $Response 156 | 157 | } 158 | 159 | 160 | break 161 | } 162 | 163 | } 164 | 165 | } 166 | catch [Exception]{ 167 | 168 | throw 169 | } 170 | } 171 | End { 172 | 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRANetwork.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRANetwork { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Network 5 | 6 | .DESCRIPTION 7 | Get a vRA Network 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Network 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Network 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRANetwork 23 | 24 | .EXAMPLE 25 | Get-vRANetwork -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRANetwork -Name 'TestNetwork' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/networks' 46 | 47 | function CalculateOutput([PSCustomObject]$Network) { 48 | 49 | [PSCustomObject] @{ 50 | Cidr = $Network.cidr 51 | ExternalZoneId = $Network.externalZoneId 52 | ExternalRegionId = $Network.externalRegionId 53 | CloudAccountIds = $Network.cloudAccountIds 54 | Tags = $Network.tags 55 | CustomProperties = $Network.customProperties 56 | ExternalId = $Network.externalId 57 | Name = $Network.name 58 | Id = $Network.id 59 | UpdatedAt = $Network.updatedAt 60 | OrganizationId = $Network.orgId 61 | Links = $Network._links 62 | } 63 | } 64 | } 65 | 66 | process { 67 | 68 | try { 69 | 70 | switch ($PsCmdlet.ParameterSetName) { 71 | 72 | # --- Get Network by Id 73 | 'ById' { 74 | 75 | foreach ($NetworkId in $Id){ 76 | 77 | $URI = "$($APIUrl)?`$filter=id eq '$($NetworkId)'" 78 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 79 | 80 | foreach ($Network in $Response.content) { 81 | CalculateOutput $Network 82 | } 83 | } 84 | 85 | break 86 | } 87 | # --- Get Network by Name 88 | 'ByName' { 89 | 90 | foreach ($NetworkName in $Name){ 91 | 92 | $URI = "$($APIUrl)?`$filter=name eq '$($NetworkName)'" 93 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 94 | 95 | foreach ($Network in $Response.content) { 96 | CalculateOutput $Network 97 | } 98 | } 99 | 100 | break 101 | } 102 | # --- No parameters passed so return all Networks 103 | 'Standard' { 104 | 105 | $URI = $APIUrl 106 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 107 | 108 | foreach ($Network in $Response.content) { 109 | CalculateOutput $Network 110 | } 111 | } 112 | } 113 | } 114 | catch [Exception]{ 115 | 116 | throw 117 | } 118 | } 119 | 120 | end { 121 | 122 | } 123 | } -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRANetworkDomain.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRANetworkDomain { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Network Domain 5 | 6 | .DESCRIPTION 7 | Get a vRA Network Domain 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Network Domain 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Network Domain 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRANetworkDomain 23 | 24 | .EXAMPLE 25 | Get-vRANetworkDomain -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRANetworkDomain -Name 'TestNetworkDomain' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/network-domains' 46 | 47 | function CalculateOutput([PSCustomObject]$NetworkDomain) { 48 | 49 | [PSCustomObject] @{ 50 | ExternalRegionId = $NetworkDomain.externalRegionId 51 | Tags = $NetworkDomain.tags 52 | CustomProperties = $NetworkDomain.customProperties 53 | CloudAccountIds = $NetworkDomain.cloudAccountIds 54 | ExternalId = $NetworkDomain.externalId 55 | Name = $NetworkDomain.name 56 | Id = $NetworkDomain.id 57 | CreatedAt = $NetworkDomain.createdAt 58 | UpdatedAt = $NetworkDomain.updatedAt 59 | OrganizationId = $NetworkDomain.orgId 60 | Links = $NetworkDomain._links 61 | } 62 | } 63 | } 64 | 65 | process { 66 | 67 | try { 68 | 69 | switch ($PsCmdlet.ParameterSetName) { 70 | 71 | # --- Get NetworkDomain by Id 72 | 'ById' { 73 | 74 | foreach ($NetworkDomainId in $Id){ 75 | 76 | $URI = "$($APIUrl)?`$filter=id eq '$($NetworkDomainId)'" 77 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 78 | 79 | foreach ($NetworkDomain in $Response.content) { 80 | CalculateOutput $NetworkDomain 81 | } 82 | } 83 | 84 | break 85 | } 86 | # --- Get NetworkDomain by Name 87 | 'ByName' { 88 | 89 | foreach ($NetworkDomainName in $Name){ 90 | 91 | $URI = "$($APIUrl)?`$filter=name eq '$($NetworkDomainName)'" 92 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 93 | 94 | foreach ($NetworkDomain in $Response.content) { 95 | CalculateOutput $NetworkDomain 96 | } 97 | } 98 | 99 | break 100 | } 101 | # --- No parameters passed so return all NetworkDomains 102 | 'Standard' { 103 | 104 | $URI = $APIUrl 105 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 106 | 107 | foreach ($NetworkDomain in $Response.content) { 108 | CalculateOutput $NetworkDomain 109 | } 110 | } 111 | } 112 | } 113 | catch [Exception]{ 114 | 115 | throw 116 | } 117 | } 118 | 119 | end { 120 | 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRANetworkIPRange.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRANetworkIPRange { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Network IP Ranges 5 | 6 | .DESCRIPTION 7 | Get a vRA Network IP Ranges 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Network IP Ranges 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Network IP Ranges 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRANetworkIPRange 23 | 24 | .EXAMPLE 25 | Get-vRANetworkIPRange -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRANetworkIPRange -Name 'TestNetworkIPRange' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/network-ip-ranges' 46 | 47 | function CalculateOutput([PSCustomObject]$NetworkIPRange) { 48 | 49 | [PSCustomObject] @{ 50 | Owner = $NetworkIPRange.owner 51 | Description = $NetworkIPRange.description 52 | Tags = $NetworkIPRange.tags 53 | ExternalId = $NetworkIPRange.externalId 54 | Name = $NetworkIPRange.name 55 | Id = $NetworkIPRange.id 56 | CreatedAt = $NetworkIPRange.createdAt 57 | UpdatedAt = $NetworkIPRange.updatedAt 58 | OrganizationId = $NetworkIPRange.orgId 59 | StartIPAddress = $NetworkIPRange.startIPAddress 60 | EndIPAddress = $NetworkIPRange.endIPAddress 61 | IPVersion = $NetworkIPRange.ipVersion 62 | Links = $NetworkIPRange._links 63 | } 64 | } 65 | } 66 | 67 | process { 68 | 69 | try { 70 | 71 | switch ($PsCmdlet.ParameterSetName) { 72 | 73 | # --- Get Network IP Range by Id 74 | 'ById' { 75 | 76 | foreach ($NetworkIPRangeId in $Id){ 77 | 78 | $URI = "$($APIUrl)?`$filter=id eq '$($NetworkIPRangeId)'" 79 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 80 | 81 | foreach ($NetworkIPRange in $Response.content) { 82 | CalculateOutput $NetworkIPRange 83 | } 84 | } 85 | 86 | break 87 | } 88 | # --- Get Network IP Range by Name 89 | 'ByName' { 90 | 91 | foreach ($NetworkIPRangeName in $Name){ 92 | 93 | $URI = "$($APIUrl)?`$filter=name eq '$($NetworkIPRangeName)'" 94 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 95 | 96 | foreach ($NetworkIPRange in $Response.content) { 97 | CalculateOutput $NetworkIPRange 98 | } 99 | } 100 | 101 | break 102 | } 103 | # --- No parameters passed so return all Network IP Ranges 104 | 'Standard' { 105 | 106 | $URI = $APIUrl 107 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 108 | 109 | foreach ($NetworkIPRange in $Response.content) { 110 | CalculateOutput $NetworkIPRange 111 | } 112 | } 113 | } 114 | } 115 | catch [Exception]{ 116 | 117 | throw 118 | } 119 | } 120 | 121 | end { 122 | 123 | } 124 | } -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRANetworkProfile.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRANetworkProfile { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Network Profile 5 | 6 | .DESCRIPTION 7 | Get a vRA Network Profile 8 | 9 | .PARAMETER Id 10 | The ID of the Network Profile 11 | 12 | .PARAMETER Name 13 | The Name of the Network Profile 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRANetworkProfile 23 | 24 | .EXAMPLE 25 | Get-vRANetworkProfile -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRANetworkProfile -Name 'TestNetworkProfile' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/network-profiles' 46 | 47 | function CalculateOutput([PSCustomObject]$NetworkProfile) { 48 | 49 | [PSCustomObject] @{ 50 | ExternalRegionId = $NetworkProfile.externalRegionId 51 | IsolationType = $NetworkProfile.isolationType 52 | CustomProperties = $NetworkProfile.customProperties 53 | Name = $NetworkProfile.name 54 | Id = $NetworkProfile.id 55 | UpdatedAt = $NetworkProfile.updatedAt 56 | OrganizationId = $NetworkProfile.organizationId 57 | Links = $NetworkProfile._links 58 | } 59 | } 60 | } 61 | 62 | process { 63 | 64 | try { 65 | 66 | switch ($PsCmdlet.ParameterSetName) { 67 | 68 | # --- Get Network Profile by Id 69 | 'ById' { 70 | 71 | foreach ($NetworkProfileId in $Id){ 72 | 73 | $URI = "$($APIUrl)?`$filter=id eq '$($NetworkProfileId)'" 74 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 75 | 76 | foreach ($NetworkProfile in $Response.content) { 77 | CalculateOutput $NetworkProfile 78 | } 79 | } 80 | 81 | break 82 | } 83 | # --- Get Network Profile by Name 84 | 'ByName' { 85 | 86 | foreach ($NetworkProfileName in $Name){ 87 | 88 | $URI = "$($APIUrl)?`$filter=name eq '$($NetworkProfileName)'" 89 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 90 | 91 | foreach ($NetworkProfile in $Response.content) { 92 | CalculateOutput $NetworkProfile 93 | } 94 | } 95 | 96 | break 97 | } 98 | # --- No parameters passed so return all Network Profiles 99 | 'Standard' { 100 | 101 | $URI = $APIUrl 102 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 103 | 104 | foreach ($NetworkProfile in $Response.content) { 105 | CalculateOutput $NetworkProfile 106 | } 107 | } 108 | } 109 | } 110 | catch [Exception]{ 111 | 112 | throw 113 | } 114 | } 115 | 116 | end { 117 | 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAProject.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAProject { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Project 5 | 6 | .DESCRIPTION 7 | Get a vRA Project 8 | 9 | .PARAMETER Id 10 | The ID of the Project 11 | 12 | .PARAMETER Name 13 | The Name of the Project 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAProject 23 | 24 | .EXAMPLE 25 | Get-vRAProject -Id '3492a6e8-4e70-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAProject -Name 'Test Project' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/projects' 46 | 47 | function CalculateOutput([PSCustomObject]$Project) { 48 | 49 | [PSCustomObject] @{ 50 | 51 | Name = $Project.name 52 | Description = $Project.description 53 | Id = $Project.id 54 | Administrators = $Project.administrators 55 | Members = $Project.members 56 | Viewers = $Project.viewers 57 | Zones = $Project.zones 58 | SharedResources = $Project.sharedResources 59 | OperationTimeout = $Project.operationTimeout 60 | PlacementPolicy = $Project.placementPolicy 61 | CustomProperties = $Project.customProperties 62 | OrganizationId = $Project.organizationId 63 | Links = $Project._links 64 | } 65 | } 66 | } 67 | 68 | process { 69 | 70 | try { 71 | 72 | switch ($PsCmdlet.ParameterSetName) { 73 | 74 | # --- Get Project by id 75 | 'ById' { 76 | 77 | foreach ($ProjectId in $Id){ 78 | 79 | $URI = "$($APIUrl)?`$filter=id eq '$($ProjectId)'" 80 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 81 | 82 | foreach ($Project in $Response.content) { 83 | 84 | CalculateOutput $Project 85 | } 86 | } 87 | 88 | break 89 | } 90 | # --- Get Project by name 91 | 'ByName' { 92 | 93 | foreach ($ProjectName in $Name){ 94 | 95 | $URI = "$($APIUrl)?`$filter=name eq '$($ProjectName)'" 96 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 97 | 98 | foreach ($Project in $Response.content){ 99 | 100 | CalculateOutput $Project 101 | } 102 | } 103 | 104 | break 105 | } 106 | # --- No parameters passed so return all Projects 107 | 'Standard' { 108 | 109 | $URI = $APIUrl 110 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 111 | 112 | foreach ($Project in $Response.content){ 113 | 114 | CalculateOutput $Project 115 | } 116 | } 117 | } 118 | } 119 | catch [Exception]{ 120 | 121 | throw 122 | } 123 | } 124 | 125 | end { 126 | 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRARegion.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRARegion { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Region 5 | 6 | .DESCRIPTION 7 | Get a vRA Region 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Region 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Region 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRARegion 23 | 24 | .EXAMPLE 25 | Get-vRARegion -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRARegion -Name 'TestRegion' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/regions' 46 | 47 | function CalculateOutput([PSCustomObject]$Region) { 48 | 49 | [PSCustomObject] @{ 50 | ExternalRegionId = $Region.externalRegionId 51 | Name = $Region.name 52 | CloudAccountId = $Region.cloudAccountId 53 | Id = $Region.id 54 | UpdatedAt = $Region.updatedAt 55 | OrgId = $Region.orgId 56 | Links = $Region._links 57 | } 58 | } 59 | } 60 | 61 | process { 62 | 63 | try { 64 | 65 | switch ($PsCmdlet.ParameterSetName) { 66 | 67 | # --- Get Region by Id 68 | 'ById' { 69 | 70 | foreach ($RegionId in $Id){ 71 | 72 | $URI = "$($APIUrl)?`$filter=id eq '$($RegionId)'" 73 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 74 | 75 | foreach ($Region in $Response.content) { 76 | CalculateOutput $Region 77 | } 78 | } 79 | 80 | break 81 | } 82 | # --- Get Region by Name 83 | 'ByName' { 84 | 85 | foreach ($RegionName in $Name){ 86 | 87 | $URI = "$($APIUrl)?`$filter=name eq '$($RegionName)'" 88 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 89 | 90 | foreach ($Region in $Response.content) { 91 | CalculateOutput $Region 92 | } 93 | } 94 | 95 | break 96 | } 97 | # --- No parameters passed so return all Regions 98 | 'Standard' { 99 | 100 | $URI = $APIUrl 101 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 102 | 103 | foreach ($Region in $Response.content) { 104 | CalculateOutput $Region 105 | } 106 | } 107 | } 108 | } 109 | catch [Exception]{ 110 | 111 | throw 112 | } 113 | } 114 | 115 | end { 116 | 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRARegionEnumerationvSphere.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRARegionEnumerationvSphere { 2 | <# 3 | .SYNOPSIS 4 | Retrieve the External Regions Ids for vSphere environment given 5 | 6 | .DESCRIPTION 7 | Retrieve the External Regions Ids for vSphere environment given 8 | 9 | .PARAMETER HostName 10 | vSphere hostname in which this cloud account is created from 11 | 12 | .PARAMETER Username 13 | Username to use when connecting to the vSphere host 14 | 15 | .PARAMETER Password 16 | Password to use when connecting to the vSphere host 17 | 18 | .PARAMETER Credential 19 | Credential object to connect to the vSphere host with 20 | For domain accounts ensure to specify the Username in the format username@domain, not Domain\Username 21 | 22 | .PARAMETER AcceptSelfSignedCertificate 23 | If set, a self-signed certificate will be accepted 24 | 25 | .INPUTS 26 | System.String 27 | System.Switch 28 | 29 | .OUTPUTS 30 | System.Management.Automation.PSObject 31 | 32 | .EXAMPLE 33 | Get-vRARegionEnumerationvSphere -HostName "vc.mycompany.com" -Username "administrator@mycompany.com" -Password ("cndhjslacd90ascdbasyoucbdh" | ConvertTo-SecureString -AsPlainText -Force) -AcceptSelfSignedCertificate 34 | 35 | .EXAMPLE 36 | Get-vRARegionEnumerationvSphere -HostName "vc.mycompany.com" -Credential (get-credential) -AcceptSelfSignedCertificate 37 | 38 | #> 39 | [CmdletBinding(DefaultParameterSetName = "Username")][OutputType('System.Management.Automation.PSObject')] 40 | 41 | Param ( 42 | 43 | [Parameter(Mandatory = $false, ParameterSetName = "Username")] 44 | [Parameter(Mandatory = $false, ParameterSetName = "Credential")] 45 | [ValidateNotNullOrEmpty()] 46 | [String]$HostName, 47 | 48 | [Parameter(Mandatory = $true, ParameterSetName = "Username")] 49 | [ValidateNotNullOrEmpty()] 50 | [String]$Username, 51 | 52 | [Parameter(Mandatory = $true, ParameterSetName = "Username")] 53 | [ValidateNotNullOrEmpty()] 54 | [SecureString]$Password, 55 | 56 | [Parameter(Mandatory=$true,ParameterSetName="Credential")] 57 | [ValidateNotNullOrEmpty()] 58 | [Management.Automation.PSCredential]$Credential, 59 | 60 | [Parameter(Mandatory = $false, ParameterSetName = "Username")] 61 | [Parameter(Mandatory = $false, ParameterSetName = "Credential")] 62 | [Switch]$AcceptSelfSignedCertificate 63 | 64 | ) 65 | 66 | begin { 67 | 68 | $APIUrl = "/iaas/api/cloud-accounts-vsphere/region-enumeration" 69 | 70 | if ($AcceptSelfSignedCertificate.IsPresent) { 71 | 72 | $AcceptSelfSignedCertificateStatus = 'true' 73 | } 74 | else { 75 | 76 | $AcceptSelfSignedCertificateStatus = 'false' 77 | } 78 | 79 | # --- Convert Secure Credentials to a format for sending in the JSON payload 80 | if ($PSBoundParameters.ContainsKey("Credential")){ 81 | 82 | $Username = $Credential.UserName 83 | $JSONPassword = $Credential.GetNetworkCredential().Password 84 | } 85 | 86 | if ($PSBoundParameters.ContainsKey("Password")){ 87 | 88 | $JSONPassword = (New-Object System.Management.Automation.PSCredential("username", $Password)).GetNetworkCredential().Password 89 | } 90 | 91 | } 92 | 93 | process { 94 | # --- Create new Azure Cloud Account 95 | try { 96 | 97 | $Body = @" 98 | { 99 | "hostName": "$($HostName)", 100 | "acceptSelfSignedCertificate": $($AcceptSelfSignedCertificateStatus), 101 | "password": "$($JSONPassword)", 102 | "username": "$($Username)" 103 | } 104 | "@ 105 | 106 | $Enumeration = Invoke-vRARestMethod -Method POST -URI $APIUrl -Body $Body -Verbose:$VerbosePreference 107 | 108 | if($null -ne $Enumeration -and $Enumeration.PSObject.Properties.name -match "externalRegionIds") { 109 | $Enumeration.externalRegionIds 110 | } else { 111 | return @() 112 | } 113 | } 114 | catch [Exception] { 115 | 116 | throw 117 | } 118 | } 119 | end { 120 | 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRARequest.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRARequest { 2 | <# 3 | .SYNOPSIS 4 | Retrieve a vRA Request 5 | 6 | .DESCRIPTION 7 | Retrieve a vRA Request or list of requests 8 | 9 | .PARAMETER RequestId 10 | Optional - the id of the request you would like to view the detials 11 | 12 | .OUTPUTS 13 | System.Management.Automation.PSObject. 14 | 15 | .EXAMPLE 16 | Get-vRARequest 17 | 18 | .EXAMPLE 19 | Get-vRARequest -RequestId '305337a3-bb92-4638-a618-bf31e8cd1785' 20 | 21 | #> 22 | [CmdletBinding()][OutputType('System.Management.Automation.PSObject')] 23 | 24 | Param ( 25 | 26 | [Parameter(Mandatory=$false, ParameterSetName="ById")] 27 | [ValidateNotNullOrEmpty()] 28 | [String[]]$RequestId 29 | 30 | ) 31 | Begin { 32 | 33 | $APIUrl = "/iaas/api/request-tracker" 34 | 35 | function CalculateOutput([PSCustomObject]$Response) { 36 | 37 | if ($Response.content) { 38 | foreach ($Record in $Response.content) { 39 | [PSCustomObject]@{ 40 | Name = $Record.name 41 | Progress = $Record.progress 42 | Id = $Record.id 43 | Status = $Record.status 44 | Message = $Record.message 45 | Resources = $Record.resources 46 | } 47 | } 48 | } else { 49 | [PSCustomObject]@{ 50 | Name = $Response.name 51 | Progress = $Response.progress 52 | Id = $Response.id 53 | Status = $Response.status 54 | Message = $Response.message 55 | Resources = $Response.resources 56 | } 57 | } 58 | } 59 | } 60 | Process { 61 | 62 | try { 63 | 64 | switch ($PsCmdlet.ParameterSetName) { 65 | 66 | # --- Get Request by its id 67 | 'ById' { 68 | 69 | # --- Check to see if the RequestIds's were optionally present 70 | $Response = Invoke-vRARestMethod -URI "$APIUrl/$RequestId" -Method GET 71 | 72 | CalculateOutput $Response 73 | 74 | break 75 | } 76 | 77 | default { 78 | # --- Check to see if the RequestId's were optionally present 79 | $Response = Invoke-vRARestMethod -URI "$APIUrl" -Method GET 80 | 81 | CalculateOutput $Response 82 | 83 | break 84 | } 85 | 86 | } 87 | } 88 | catch [Exception]{ 89 | 90 | throw 91 | } 92 | } 93 | End { 94 | 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRASecurityGroup.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRASecurityGroup { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Security Group 5 | 6 | .DESCRIPTION 7 | Get a vRA Security Group 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Security Group 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Security Group 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRASecurityGroup 23 | 24 | .EXAMPLE 25 | Get-vRASecurityGroup -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRASecurityGroup -Name 'TestSecurityGroup' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/security-groups' 46 | 47 | function CalculateOutput([PSCustomObject]$SecurityGroup) { 48 | 49 | [PSCustomObject] @{ 50 | Rules = $SecurityGroup.rules 51 | ExternalRegionId = $SecurityGroup.externalRegionId 52 | CloudAccountIds = $SecurityGroup.cloudAccountIds 53 | Tags = $SecurityGroup.tags 54 | CustomProperties = $SecurityGroup.customProperties 55 | ExternalId = $SecurityGroup.externalId 56 | Name = $SecurityGroup.name 57 | Id = $SecurityGroup.id 58 | CreatedAt = $SecurityGroup.createdAt 59 | UpdatedAt = $SecurityGroup.updatedAt 60 | organizationId = $SecurityGroup.orgId 61 | Links = $SecurityGroup._links 62 | } 63 | } 64 | } 65 | 66 | process { 67 | 68 | try { 69 | 70 | switch ($PsCmdlet.ParameterSetName) { 71 | 72 | # --- Get Security Group by Id 73 | 'ById' { 74 | 75 | foreach ($SecurityGroupId in $Id){ 76 | 77 | $URI = "$($APIUrl)?`$filter=id eq '$($SecurityGroupId)'" 78 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 79 | 80 | foreach ($SecurityGroup in $Response.content) { 81 | CalculateOutput $SecurityGroup 82 | } 83 | } 84 | 85 | break 86 | } 87 | # --- Get Security Group by Name 88 | 'ByName' { 89 | 90 | foreach ($SecurityGroupName in $Name){ 91 | 92 | $URI = "$($APIUrl)?`$filter=name eq '$($SecurityGroupName)'" 93 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 94 | 95 | foreach ($SecurityGroup in $Response.content) { 96 | CalculateOutput $SecurityGroup 97 | } 98 | } 99 | 100 | break 101 | } 102 | # --- No parameters passed so return all Security Groups 103 | 'Standard' { 104 | 105 | $URI = $APIUrl 106 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 107 | 108 | foreach ($SecurityGroup in $Response.content) { 109 | CalculateOutput $SecurityGroup 110 | } 111 | } 112 | } 113 | } 114 | catch [Exception]{ 115 | 116 | throw 117 | } 118 | } 119 | 120 | end { 121 | 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAStorageProfile.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAStorageProfile { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Storage Profile 5 | 6 | .DESCRIPTION 7 | Get a vRA Storage Profile 8 | 9 | .PARAMETER Id 10 | The ID of the vRA Storage Profile 11 | 12 | .PARAMETER Name 13 | The Name of the vRA Storage Profile 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAStorageProfile 23 | 24 | .EXAMPLE 25 | Get-vRAStorageProfile -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAStorageProfile -Name 'TestStorageProfile' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/storage-profiles' 46 | 47 | function CalculateOutput([PSCustomObject]$StorageProfile) { 48 | 49 | [PSCustomObject] @{ 50 | Owner = $StorageProfile.owner 51 | Links = $StorageProfile._links 52 | SupportsEncryption = $StorageProfile.supportsEncryption 53 | ExternalRegionId = $StorageProfile.externalRegionId 54 | Description = $StorageProfile.description 55 | OrganizationId = $StorageProfile.orgId 56 | Tags = $StorageProfile.tags 57 | CreatedAt = $StorageProfile.createdAt 58 | DiskProperties = $StorageProfile.diskProperties 59 | Name = $StorageProfile.name 60 | Id = $StorageProfile.id 61 | DefaultItem = $StorageProfile.defaultItem 62 | UpdatedAt = $StorageProfile.updatedAt 63 | } 64 | } 65 | } 66 | 67 | process { 68 | 69 | try { 70 | 71 | switch ($PsCmdlet.ParameterSetName) { 72 | 73 | # --- Get Storage Profile by Id 74 | 'ById' { 75 | 76 | foreach ($StorageProfileId in $Id){ 77 | 78 | $URI = "$($APIUrl)?`$filter=id eq '$($StorageProfileId)'" 79 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 80 | 81 | foreach ($StorageProfile in $Response.content) { 82 | CalculateOutput $StorageProfile 83 | } 84 | } 85 | 86 | break 87 | } 88 | # --- Get Storage Profile by Name 89 | 'ByName' { 90 | 91 | foreach ($StorageProfileName in $Name){ 92 | 93 | $URI = "$($APIUrl)?`$filter=name eq '$($StorageProfileName)'" 94 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 95 | 96 | foreach ($StorageProfile in $Response.content) { 97 | CalculateOutput $StorageProfile 98 | } 99 | } 100 | 101 | break 102 | } 103 | # --- No parameters passed so return all Storage Profiles 104 | 'Standard' { 105 | 106 | $URI = $APIUrl 107 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 108 | 109 | foreach ($StorageProfile in $Response.content) { 110 | CalculateOutput $StorageProfile 111 | } 112 | } 113 | } 114 | } 115 | catch [Exception]{ 116 | 117 | throw 118 | } 119 | } 120 | 121 | end { 122 | 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRATag.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRATag { 2 | <# 3 | .SYNOPSIS 4 | Get all vRA Tags 5 | 6 | .DESCRIPTION 7 | Get all vRA Tags 8 | 9 | .INPUTS 10 | System.String 11 | 12 | .OUTPUTS 13 | System.Management.Automation.PSObject 14 | 15 | .EXAMPLE 16 | Get-vRATag 17 | 18 | #> 19 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 20 | 21 | Param ( 22 | ) 23 | 24 | begin { 25 | $APIUrl = '/iaas/api/tags' 26 | 27 | function CalculateOutput([PSCustomObject]$Tag) { 28 | 29 | [PSCustomObject] @{ 30 | Key = $Tag.key 31 | Value = $Tag.value 32 | } 33 | } 34 | } 35 | 36 | process { 37 | 38 | try { 39 | 40 | switch ($PsCmdlet.ParameterSetName) { 41 | # --- No parameters passed so return all Tags 42 | 'Standard' { 43 | 44 | $URI = $APIUrl 45 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 46 | 47 | foreach ($Tag in $Response.content) { 48 | CalculateOutput $Tag 49 | } 50 | } 51 | } 52 | } 53 | catch [Exception]{ 54 | 55 | throw 56 | } 57 | } 58 | 59 | end { 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAvSphereFabricDatastore.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAvSphereFabricDatastore { 2 | <# 3 | .SYNOPSIS 4 | Get a only vSphere Fabric Datastore from vRA 5 | 6 | .DESCRIPTION 7 | Get a only vSphere Fabric Datastore from vRA 8 | 9 | .PARAMETER Id 10 | The ID of the vSphere Fabric Datastore 11 | 12 | .PARAMETER Name 13 | The Name of the vSphere Fabric Datastore 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAvSphereFabricDatastore 23 | 24 | .EXAMPLE 25 | Get-vRAvSphereFabricDatastore -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAvSphereFabricDatastore -Name 'TestFabricDatastore' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/fabric-vsphere-datastores' 46 | 47 | function CalculateOutput([PSCustomObject]$FabricDatastore) { 48 | 49 | [PSCustomObject] @{ 50 | Type = $FabricDatastore.type 51 | ExternalRegionId = $FabricDatastore.externalRegionId 52 | FreeSizeGB = $FabricDatastore.freeSizeGB 53 | CloudAccountIds = $FabricDatastore.cloudAccountIds 54 | ExternalId = $FabricDatastore.externalId 55 | Name = $FabricDatastore.name 56 | Id = $FabricDatastore.id 57 | CreatedAt = $FabricDatastore.createdAt 58 | UpdatedAt = $FabricDatastore.updatedAt 59 | OrganizationId = $FabricDatastore.organizationId 60 | Links = $FabricDatastore._links 61 | } 62 | } 63 | } 64 | 65 | process { 66 | 67 | try { 68 | 69 | switch ($PsCmdlet.ParameterSetName) { 70 | 71 | # --- Get Fabric Datastore by Id 72 | 'ById' { 73 | 74 | foreach ($FabricDatastoreId in $Id){ 75 | 76 | $URI = "$($APIUrl)?`$filter=id eq '$($FabricDatastoreId)'" 77 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 78 | 79 | foreach ($FabricDatastore in $Response.content) { 80 | CalculateOutput $FabricDatastore 81 | } 82 | } 83 | 84 | break 85 | } 86 | # --- Get Fabric Datastore by Name 87 | 'ByName' { 88 | 89 | foreach ($FabricDatastoreName in $Name){ 90 | 91 | $URI = "$($APIUrl)?`$filter=name eq '$($FabricDatastoreName)'" 92 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 93 | 94 | foreach ($FabricDatastore in $Response.content) { 95 | CalculateOutput $FabricDatastore 96 | } 97 | } 98 | 99 | break 100 | } 101 | # --- No parameters passed so return all Fabric Datastores 102 | 'Standard' { 103 | 104 | $URI = $APIUrl 105 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 106 | 107 | foreach ($FabricDatastore in $Response.content) { 108 | CalculateOutput $FabricDatastore 109 | } 110 | } 111 | } 112 | } 113 | catch [Exception]{ 114 | 115 | throw 116 | } 117 | } 118 | 119 | end { 120 | 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Get-vRAvSphereFabricStoragePolicy.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAvSphereFabricStoragePolicy { 2 | <# 3 | .SYNOPSIS 4 | Get a only vSphere Fabric Storage Policy from vRA 5 | 6 | .DESCRIPTION 7 | Get a only vSphere Fabric Storage Policy from vRA 8 | 9 | .PARAMETER Id 10 | The ID of the vSphere Fabric Storage Policy 11 | 12 | .PARAMETER Name 13 | The Name of the vSphere Fabric Storage Policy 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAvSphereFabricStoragePolicy 23 | 24 | .EXAMPLE 25 | Get-vRAvSphereFabricStoragePolicy -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' 26 | 27 | .EXAMPLE 28 | Get-vRAvSphereFabricStoragePolicy -Name 'TestFabricStoragePolicy' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/iaas/api/fabric-vsphere-storage-policies' 46 | 47 | function CalculateOutput([PSCustomObject]$FabricStoragePolicy) { 48 | 49 | [PSCustomObject] @{ 50 | ExternalRegionId = $FabricStoragePolicy.externalRegionId 51 | CloudAccountIds = $FabricStoragePolicy.cloudAccountIds 52 | ExternalId = $FabricStoragePolicy.externalId 53 | Name = $FabricStoragePolicy.name 54 | Description = $FabricStoragePolicy.description 55 | Id = $FabricStoragePolicy.id 56 | CreatedAt = $FabricStoragePolicy.createdAt 57 | UpdatedAt = $FabricStoragePolicy.updatedAt 58 | OrganizationId = $FabricStoragePolicy.organizationId 59 | Links = $FabricStoragePolicy._links 60 | } 61 | } 62 | } 63 | 64 | process { 65 | 66 | try { 67 | 68 | switch ($PsCmdlet.ParameterSetName) { 69 | 70 | # --- Get vSphere Fabric Storage Policy by Id 71 | 'ById' { 72 | 73 | foreach ($FabricStoragePolicyId in $Id){ 74 | 75 | $URI = "$($APIUrl)?`$filter=id eq '$($FabricStoragePolicyId)'" 76 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 77 | 78 | foreach ($FabricStoragePolicy in $Response.content) { 79 | CalculateOutput $FabricStoragePolicy 80 | } 81 | } 82 | 83 | break 84 | } 85 | # --- Get vSphere Fabric Storage Policy by Name 86 | 'ByName' { 87 | 88 | foreach ($FabricStoragePolicyName in $Name){ 89 | 90 | $URI = "$($APIUrl)?`$filter=name eq '$($FabricStoragePolicyName)'" 91 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 92 | 93 | foreach ($FabricStoragePolicy in $Response.content) { 94 | CalculateOutput $FabricStoragePolicy 95 | } 96 | } 97 | 98 | break 99 | } 100 | # --- No parameters passed so return all vSphere Fabric Storage Policies 101 | 'Standard' { 102 | 103 | $URI = $APIUrl 104 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 105 | 106 | foreach ($FabricStoragePolicy in $Response.content) { 107 | CalculateOutput $FabricStoragePolicy 108 | } 109 | } 110 | } 111 | } 112 | catch [Exception]{ 113 | 114 | throw 115 | } 116 | } 117 | 118 | end { 119 | 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/Functions/Public/iaas/New-vRACloudAccountAzure.ps1: -------------------------------------------------------------------------------- 1 | function New-vRACloudAccountAzure { 2 | <# 3 | .SYNOPSIS 4 | Create a vRA Cloud Account for Azure 5 | 6 | .DESCRIPTION 7 | Create a vRA Cloud Account for Azure 8 | 9 | .PARAMETER Name 10 | The name of the Cloud Account for Azure 11 | 12 | .PARAMETER Description 13 | A description of the Cloud Account for Azure 14 | 15 | .PARAMETER SubscriptionId 16 | Azure SubscriptionId 17 | 18 | .PARAMETER TenantId 19 | Azure TenantId 20 | 21 | .PARAMETER ClientApplicationId 22 | Azure ClientApplicationId 23 | 24 | .PARAMETER ClientApplicationSecretKey 25 | Azure ClientApplicationSecretKey 26 | 27 | .PARAMETER RegionIds 28 | Azure RegionIds to enable 29 | 30 | .PARAMETER CreateDefaultZones 31 | Enable CreateDefaultZones 32 | 33 | .PARAMETER JSON 34 | A JSON string with the body payload 35 | 36 | .INPUTS 37 | System.String 38 | System.Switch 39 | 40 | .OUTPUTS 41 | System.Management.Automation.PSObject 42 | 43 | .EXAMPLE 44 | New-vRACloudAccountAzure -Name "Azure Test" -SubscriptionId "7326edb0-1234-012e-22d8-76f9faf6982" -TenantId "e7c5cdf4-21d1-312e-bddb-8765949cfdab" -ClientApplicationId "123e710b-4e10-33dc-b9b2-de3d9b1fe234" -ClientApplicationSecretKey "X9Y;bYRpe:eds-TY[blCB1he6PmarC1W" -RegionIds "northeurope","japaneast" 45 | 46 | .EXAMPLE 47 | $JSON = @" 48 | 49 | { 50 | "name": "Azure Test", 51 | "description": "Azure Test", 52 | "subscriptionId": "7326edb0-1234-012e-22d8-76f9faf6982", 53 | "tenantId": "e7c5cdf4-21d1-312e-bddb-8765949cfdab", 54 | "clientApplicationId": "123e710b-4e10-33dc-b9b2-de3d9b1fe234", 55 | "clientApplicationSecretKey": "X8Y:bYRpe:wzW-FC[blCB1he7PmarC0W", 56 | "regionIds": [ "northeurope","japaneast" ], 57 | "createDefaultZones": false 58 | } 59 | "@ 60 | 61 | $JSON | New-vRACloudAccountAzure 62 | 63 | 64 | #> 65 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="Low",DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 66 | 67 | Param ( 68 | 69 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 70 | [ValidateNotNullOrEmpty()] 71 | [String]$Name, 72 | 73 | [Parameter(Mandatory=$false,ParameterSetName="Standard")] 74 | [ValidateNotNullOrEmpty()] 75 | [String]$Description, 76 | 77 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 78 | [ValidateNotNullOrEmpty()] 79 | [String]$SubscriptionId, 80 | 81 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 82 | [ValidateNotNullOrEmpty()] 83 | [String]$TenantId, 84 | 85 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 86 | [ValidateNotNullOrEmpty()] 87 | [String]$ClientApplicationId, 88 | 89 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 90 | [ValidateNotNullOrEmpty()] 91 | [String]$ClientApplicationSecretKey, 92 | 93 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 94 | [ValidateNotNullOrEmpty()] 95 | [String[]]$RegionIds, 96 | 97 | [Parameter(Mandatory=$false,ParameterSetName="Standard")] 98 | [Switch]$CreateDefaultZones, 99 | 100 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ParameterSetName="JSON")] 101 | [ValidateNotNullOrEmpty()] 102 | [String]$JSON 103 | 104 | ) 105 | 106 | begin { 107 | if ($CreateDefaultZones.IsPresent) { 108 | 109 | $CreateDefaultZonesStatus = 'true' 110 | } 111 | else { 112 | 113 | $CreateDefaultZonesStatus = 'false' 114 | } 115 | } 116 | 117 | process { 118 | 119 | if ($PSBoundParameters.ContainsKey("JSON")) { 120 | 121 | $Data = ($JSON | ConvertFrom-Json) 122 | 123 | $Body = $JSON 124 | $Name = $Data.name 125 | } 126 | else { 127 | 128 | # Format RegionIds with surrounding quotes and join into single string 129 | $RegionIdsAddQuotes = $RegionIDs | ForEach-Object {"`"$_`""} 130 | $RegionIdsFormatForBodyText = $RegionIdsAddQuotes -join "," 131 | 132 | $Body = @" 133 | { 134 | "name": "$($Name)", 135 | "description": "$($Description)", 136 | "subscriptionId": "$($SubscriptionId)", 137 | "tenantId": "$($TenantId)", 138 | "clientApplicationId": "$($ClientApplicationId)", 139 | "clientApplicationSecretKey": "$($ClientApplicationSecretKey)", 140 | "regionIds": [ $($RegionIdsFormatForBodyText) ], 141 | "createDefaultZones": $($CreateDefaultZonesStatus) 142 | } 143 | "@ 144 | } 145 | 146 | # --- Create new Azure Cloud Account 147 | try { 148 | if ($PSCmdlet.ShouldProcess($Name)){ 149 | 150 | $URI = "/iaas/api/cloud-accounts-azure" 151 | $CloudAccount = Invoke-vRARestMethod -Method POST -URI $URI -Body $Body -Verbose:$VerbosePreference 152 | 153 | [PSCustomObject] @{ 154 | 155 | Name = $CloudAccount.name 156 | Description = $CloudAccount.description 157 | Id = $CloudAccount.id 158 | CloudAccountType = 'azure' 159 | SubscriptionId = $CloudAccount.subscriptionId 160 | TenantId = $CloudAccount.tenantId 161 | ClientApplicationId = $CloudAccount.clientApplicationId 162 | EnabledRegionIds = $CloudAccount.enabledRegionIds 163 | CustomProperties = $CloudAccount.customProperties 164 | OrganizationId = $CloudAccount.organizationId 165 | Links = $CloudAccount._links 166 | } 167 | } 168 | } 169 | catch [Exception] { 170 | 171 | throw 172 | } 173 | } 174 | end { 175 | 176 | } 177 | } -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Remove-vRACloudAccount.ps1: -------------------------------------------------------------------------------- 1 | function Remove-vRACloudAccount { 2 | <# 3 | .SYNOPSIS 4 | Remove a Cloud Account 5 | 6 | .DESCRIPTION 7 | Remove a Cloud Account 8 | 9 | .PARAMETER Id 10 | The Id of the Cloud Account 11 | 12 | .PARAMETER Name 13 | The name of the Cloud Account 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .EXAMPLE 19 | Remove-vRACloudAccount -Name CloudAccount1 20 | 21 | .EXAMPLE 22 | Remove-vRACloudAccount -Id '4b3bd194-9b5f-40fd-9ed0-58d997237999' 23 | 24 | .EXAMPLE 25 | Get-vRACloudAccount -Name CloudAccount1 | Remove-vRACloudAccount 26 | 27 | #> 28 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ById")] 29 | 30 | Param ( 31 | 32 | [parameter(Mandatory=$true, ValueFromPipelineByPropertyName, ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [parameter(Mandatory=$true, ParameterSetName="ByName")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$Name 39 | 40 | ) 41 | 42 | begin {} 43 | 44 | process { 45 | 46 | try { 47 | 48 | switch ($PSCmdlet.ParameterSetName) { 49 | 50 | 'ById' { 51 | 52 | foreach ($CloudAccountId in $Id) { 53 | 54 | if ($PSCmdlet.ShouldProcess($CloudAccountId)){ 55 | 56 | $URI = "/iaas/api/cloud-accounts/$($CloudAccountId)" 57 | 58 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 59 | } 60 | } 61 | 62 | break 63 | } 64 | 65 | 'ByName' { 66 | 67 | foreach ($CloudAccountName in $Name) { 68 | 69 | if ($PSCmdlet.ShouldProcess($CloudAccountName)){ 70 | 71 | $CloudAccountId = (Get-vRACloudAccount -Name $CloudAccountName).id 72 | $URI = "/iaas/api/cloud-accounts/$($CloudAccountId)" 73 | 74 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 75 | } 76 | } 77 | 78 | break 79 | } 80 | } 81 | } 82 | catch [Exception]{ 83 | 84 | throw 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Remove-vRAProject.ps1: -------------------------------------------------------------------------------- 1 | function Remove-vRAProject { 2 | <# 3 | .SYNOPSIS 4 | Remove a Cloud Project 5 | 6 | .DESCRIPTION 7 | Remove a Cloud Project 8 | 9 | .PARAMETER Id 10 | The Id of the Cloud Project 11 | 12 | .PARAMETER Name 13 | The Name of the Cloud Project 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .EXAMPLE 19 | Remove-vRAProject -Name Project1 20 | 21 | .EXAMPLE 22 | Remove-vRAProject -Id '4b3bd194-9b5f-40fd-9ed0-58d997237999' 23 | 24 | .EXAMPLE 25 | Get-vRAProject -Name Project1 | Remove-vRAProject 26 | 27 | #> 28 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ById")] 29 | 30 | Param ( 31 | 32 | [parameter(Mandatory=$true, ValueFromPipelineByPropertyName, ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [parameter(Mandatory=$true, ParameterSetName="ByName")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$Name 39 | 40 | ) 41 | 42 | begin {} 43 | 44 | process { 45 | 46 | try { 47 | 48 | switch ($PSCmdlet.ParameterSetName) { 49 | 50 | 'ById' { 51 | 52 | foreach ($ProjectId in $Id) { 53 | 54 | if ($PSCmdlet.ShouldProcess($ProjectId)){ 55 | 56 | $URI = "/iaas/api/projects/$($ProjectId)" 57 | 58 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 59 | } 60 | } 61 | 62 | break 63 | } 64 | 65 | 'ByName' { 66 | 67 | foreach ($ProjectName in $Name) { 68 | 69 | if ($PSCmdlet.ShouldProcess($ProjectName)){ 70 | 71 | $ProjectId = (Get-vRAProject -Name $ProjectName).id 72 | $URI = "/iaas/api/projects/$($ProjectId)" 73 | 74 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 75 | } 76 | } 77 | 78 | break 79 | } 80 | } 81 | } 82 | catch [Exception]{ 83 | 84 | throw 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /src/Functions/Public/iaas/Update-vRAExternalNetworkIPRange.ps1: -------------------------------------------------------------------------------- 1 | function Update-vRAExternalNetworkIPRange { 2 | <# 3 | .SYNOPSIS 4 | Update the vRA External Network IP Range depending on input 5 | 6 | .DESCRIPTION 7 | Update the vRA External Network IP Range depending on input, only thing that can be updated is associated fabric at this time. 8 | 9 | .PARAMETER Id 10 | The ID of the vRA External Network IP Range 11 | 12 | .PARAMETER Name 13 | The Name of the vRA External Network IP Range 14 | 15 | .PARAMETER FabricId 16 | The id of the fabric network that this IP range should be associated with. 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject. 20 | 21 | .EXAMPLE 22 | Update-vRAExternalNetworkIPRange 23 | 24 | .EXAMPLE 25 | Update-vRAExternalNetworkIPRange -Id 'b1dd48e71d74267559bb930934470' -FabricId 'MyFabricNetworkId' 26 | 27 | .EXAMPLE 28 | Update-vRAExternalNetworkIPRange -Name 'my-external-network-name' -FabricId 'MyFabricNetworkId' 29 | 30 | #> 31 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="Low",DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name, 42 | 43 | [Parameter(Mandatory=$false,ParameterSetName="ByName")] 44 | [Parameter(Mandatory=$false,ParameterSetName="ById")] 45 | [String]$FabricId 46 | 47 | ) 48 | Begin { 49 | 50 | $APIUrl = "/iaas/api/external-network-ip-ranges" 51 | 52 | function CalculateOutput([PSCustomObject] $ExternalNetworkIPRange) { 53 | 54 | [PSCustomObject] @{ 55 | Owner = $ExternalNetworkIPRange.owner 56 | Description = $ExternalNetworkIPRange.description 57 | Tags = $ExternalNetworkIPRange.tags 58 | ExternalId = $ExternalNetworkIPRange.externalId 59 | SubnetPrefixLength = $ExternalNetworkIPRange.subnetPrefixLength 60 | Name = $ExternalNetworkIPRange.name 61 | Id = $ExternalNetworkIPRange.id 62 | CreatedAt = $ExternalNetworkIPRange.createdAt 63 | UpdatedAt = $ExternalNetworkIPRange.updatedAt 64 | OrganizationId = $ExternalNetworkIPRange.orgId 65 | StartIPAddress = $ExternalNetworkIPRange.startIPAddress 66 | EndIPAddress = $ExternalNetworkIPRange.endIPAddress 67 | IPVersion = $ExternalNetworkIPRange.ipVersion 68 | AddressSpaceId = $ExternalNetworkIPRange.addressSpaceId 69 | DNSServerAddresses = $ExternalNetworkIPRange.dnsServerAddresses 70 | DNSSearchDomains = $ExternalNetworkIPRange.dnsSearchDomains 71 | Domain = $ExternalNetworkIPRange.domain 72 | GatewayAddress = $ExternalNetworkIPRange.gatewayAddress 73 | Links = $ExternalNetworkIPRange._links 74 | } 75 | } 76 | } 77 | Process { 78 | 79 | try { 80 | 81 | $Body = @" 82 | { 83 | "fabricNetworkId": "$($FabricId)" 84 | } 85 | "@ 86 | 87 | switch ($PsCmdlet.ParameterSetName) { 88 | 89 | # --- Process by its id 90 | 'ById' { 91 | if ($PSCmdlet.ShouldProcess($Id)){ 92 | foreach ($networkId in $Id) { 93 | $Response = Invoke-vRARestMethod -URI "$APIUrl/$networkId" -Body $Body -Method PATCH 94 | CalculateOutput $Response 95 | } 96 | } 97 | break 98 | } 99 | 100 | # --- Process by its name 101 | 'ByName' { 102 | if ($PSCmdlet.ShouldProcess($Name)){ 103 | foreach ($networkName in $Name) { 104 | $network = Get-vRAExternalNetworkIPRange -name $networkName 105 | $Response = Invoke-vRARestMethod -URI "$APIUrl/$($network.Id)" -Body $Body -Method PATCH 106 | CalculateOutput $Response 107 | } 108 | } 109 | break 110 | } 111 | 112 | } 113 | 114 | 115 | } 116 | catch [Exception]{ 117 | 118 | throw 119 | } 120 | } 121 | End { 122 | 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/Functions/Public/relocation/Get-vRAOnboardingDeployment.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAOnboardingDeployment { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA OnboardingDeployment. 5 | 6 | .DESCRIPTION 7 | Get a vRA OnboardingDeployment. 8 | 9 | .PARAMETER Id 10 | The ID of the OnboardingDeployment 11 | 12 | .PARAMETER Name 13 | The Name of the OnboardingDeployment 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAOnboardingDeployment 23 | 24 | .EXAMPLE 25 | Get-vRAOnboardingDeployment -Id '247d9305a4231275581a098553c26' 26 | 27 | .EXAMPLE 28 | Get-vRAOnboardingDeployment -Name 'Test OnboardingDeployment' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | Begin { 45 | $APIUrl = '/relocation/onboarding/deployment' 46 | 47 | function CalculateOutput($ResponseObject) { 48 | 49 | $DocumentSelfLink = $ResponseObject.documentSelfLink 50 | $OnboardingDeploymentId = ($DocumentSelfLink -split "/")[-1] 51 | 52 | [PSCustomObject] @{ 53 | 54 | Name = $ResponseObject.name 55 | Id = $OnboardingDeploymentId 56 | PlanLink = $ResponseObject.planLink 57 | ConsumerDeploymentLink = $ResponseObject.consumerDeploymentLink 58 | DocumentSelfLink = $DocumentSelfLink 59 | } 60 | } 61 | } 62 | 63 | Process { 64 | 65 | try { 66 | 67 | switch ($PsCmdlet.ParameterSetName) { 68 | 69 | # --- Get Onboarding Deployment by id 70 | 'ById' { 71 | 72 | foreach ($OnboardingDeploymentId in $Id){ 73 | 74 | $URI = "$($APIUrl)/$($OnboardingDeploymentId)" 75 | 76 | $OnboardingDeployment= Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 77 | 78 | CalculateOutput $OnboardingDeployment 79 | } 80 | 81 | break 82 | } 83 | # --- Get Onboarding Deployment by name 84 | 'ByName' { 85 | 86 | $URI = "$($APIUrl)?`$expand=true" 87 | 88 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 89 | 90 | foreach ($OnboardingDeploymentName in $Name){ 91 | 92 | $MatchedOnboardingDeployment = $false 93 | 94 | foreach ($Document in $Response.documentLinks){ 95 | 96 | $OnboardingDeployment = $Response.documents.$document 97 | 98 | if ($OnboardingDeployment.name -eq $OnboardingDeploymentName){ 99 | 100 | $MatchedOnboardingDeployment = $true 101 | CalculateOutput $OnboardingDeployment 102 | } 103 | } 104 | 105 | if (!$MatchedOnboardingDeployment) { 106 | 107 | throw "Could not find Onboarding Deployment with name: $($OnboardingDeploymentName)" 108 | } 109 | } 110 | 111 | break 112 | } 113 | # --- No parameters passed so return all Onboarding Deployments 114 | 'Standard' { 115 | 116 | $URI = "$($APIUrl)?`$expand=true" 117 | 118 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 119 | 120 | foreach ($Document in $Response.documentLinks){ 121 | 122 | $OnboardingDeployment = $Response.documents.$document 123 | 124 | CalculateOutput $OnboardingDeployment 125 | } 126 | } 127 | } 128 | } 129 | catch [Exception]{ 130 | 131 | throw 132 | } 133 | } 134 | 135 | End { 136 | 137 | } 138 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/Get-vRAOnboardingPlan.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAOnboardingPlan { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA OnboardingPlan. 5 | 6 | .DESCRIPTION 7 | Get a vRA OnboardingPlan. 8 | 9 | .PARAMETER Id 10 | The ID of the OnboardingPlan 11 | 12 | .PARAMETER Name 13 | The Name of the OnboardingPlan 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAOnboardingPlan 23 | 24 | .EXAMPLE 25 | Get-vRAOnboardingPlan -Id '247d9305a4231275581a098553c26' 26 | 27 | .EXAMPLE 28 | Get-vRAOnboardingPlan -Name 'Test OnboardingPlan' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | Begin { 45 | $APIUrl = '/relocation/onboarding/plan' 46 | 47 | function CalculateOutput($ResponseObject) { 48 | 49 | $DocumentSelfLink = $ResponseObject.documentSelfLink 50 | $OnboardingPlanId = ($DocumentSelfLink -split "/")[-1] 51 | 52 | [PSCustomObject] @{ 53 | 54 | Name = $ResponseObject.name 55 | Id = $OnboardingPlanId 56 | Status = $ResponseObject.status 57 | EndpointName = $ResponseObject.endpointName 58 | EndpointId = $ResponseObject.endpointId 59 | EndpointIds = $ResponseObject.endpointIds 60 | ProjectName = $ResponseObject.projectName 61 | ProjectId = $ResponseObject.projectId 62 | CreatedBy = $ResponseObject.createdBy 63 | EnableExtensibilityEvents = $ResponseObject.enableExtensibilityEvents 64 | OrganizationId = $ResponseObject.organizationId 65 | LastRunTimeMicros = $ResponseObject.lastRunTimeMicros 66 | NextRefreshTimeMicros = $ResponseObject.nextRefreshTimeMicros 67 | RefreshIntervalMicros = $ResponseObject.refreshIntervalMicros 68 | DocumentSelfLink = $DocumentSelfLink 69 | } 70 | } 71 | } 72 | 73 | Process { 74 | 75 | try { 76 | 77 | switch ($PsCmdlet.ParameterSetName) { 78 | 79 | # --- Get Onboarding Plan by id 80 | 'ById' { 81 | 82 | foreach ($OnboardingPlanId in $Id){ 83 | 84 | $URI = "$($APIUrl)/$($OnboardingPlanId)" 85 | 86 | $OnboardingPlan= Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 87 | 88 | CalculateOutput $OnboardingPlan 89 | } 90 | 91 | break 92 | } 93 | # --- Get Onboarding Plan by name 94 | 'ByName' { 95 | 96 | $URI = "$($APIUrl)?`$expand=true" 97 | 98 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 99 | 100 | foreach ($OnboardingPlanName in $Name){ 101 | 102 | $MatchedOnboardingPlan = $false 103 | 104 | foreach ($Document in $Response.documentLinks){ 105 | 106 | $OnboardingPlan = $Response.documents.$document 107 | 108 | if ($OnboardingPlan.name -eq $OnboardingPlanName){ 109 | 110 | $MatchedOnboardingPlan = $true 111 | CalculateOutput $OnboardingPlan 112 | } 113 | } 114 | 115 | if (!$MatchedOnboardingPlan) { 116 | 117 | throw "Could not find Onboarding Plan with name: $($OnboardingPlanName)" 118 | } 119 | } 120 | 121 | break 122 | } 123 | # --- No parameters passed so return all Onboarding Plans 124 | 'Standard' { 125 | 126 | $URI = "$($APIUrl)?`$expand=true" 127 | 128 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 129 | 130 | foreach ($Document in $Response.documentLinks){ 131 | 132 | $OnboardingPlan = $Response.documents.$document 133 | 134 | CalculateOutput $OnboardingPlan 135 | } 136 | } 137 | } 138 | } 139 | catch [Exception]{ 140 | 141 | throw 142 | } 143 | } 144 | 145 | End { 146 | 147 | } 148 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/Get-vRAOnboardingPlanExecution.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAOnboardingPlanExecution { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA OnboardingPlanExecution 5 | 6 | .DESCRIPTION 7 | Get a vRA OnboardingPlanExecution 8 | 9 | .PARAMETER Id 10 | The ID of the OnboardingPlanExecution 11 | 12 | .PARAMETER ExecutionPlanLink 13 | The Execution Plan Link 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAOnboardingPlanExecution -Id 'ig885f86-0e2d-4157-r5d4-8cb42ce6dd84' 23 | 24 | .EXAMPLE 25 | Get-vRAOnboardingPlanExecution -ExecutionPlanLink '/relocation/api/wo/execute-plan/ig885f86-0e2d-4157-r5d4-8cb42ce6dd8' 26 | 27 | #> 28 | [CmdletBinding(DefaultParameterSetName="ById")][OutputType('System.Management.Automation.PSObject')] 29 | 30 | Param ( 31 | 32 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [Parameter(Mandatory=$true,ParameterSetName="ByExecutionPlanLink")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$ExecutionPlanLink 39 | ) 40 | 41 | begin { 42 | 43 | function CalculateOutput($ResponseObject) { 44 | 45 | [PSCustomObject] @{ 46 | 47 | ExecutionId = $ResponseObject.executionId 48 | DocumentSelfLink = $ResponseObject.documentSelfLink 49 | PlanLink = $ResponseObject.planLink 50 | TaskInfo = $ResponseObject.taskInfo 51 | SubStage = $ResponseObject.subStage 52 | PlanValidated = $ResponseObject.planValidated 53 | BlueprintsValidated = $ResponseObject.blueprintsValidated 54 | DeploymentsValidated = $ResponseObject.deploymentsValidated 55 | MachinesValidated = $ResponseObject.machinesValidated 56 | DeploymentCount = $ResponseObject.deploymentCount 57 | RetryCount = $ResponseObject.retryCount 58 | FailedDeploymentCount = $ResponseObject.failedDeploymentCount 59 | } 60 | } 61 | } 62 | 63 | process { 64 | 65 | try { 66 | 67 | switch ($PsCmdlet.ParameterSetName) { 68 | 69 | # --- Get Onboarding Plan Execution by Id 70 | 'ById' { 71 | 72 | foreach ($OnboardingPlanExecutionId in $Id){ 73 | 74 | $URI = "/relocation/api/wo/execute-plan/$($OnboardingPlanExecutionId)" 75 | 76 | $ExecuteOnboardingPlan = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 77 | 78 | CalculateOutput $ExecuteOnboardingPlan 79 | } 80 | 81 | break 82 | } 83 | # --- Get Onboarding Plan Execution by Name 84 | 'ByExecutionPlanLink' { 85 | 86 | foreach ($OnboardingPlanExecutionLink in $ExecutionPlanLink){ 87 | 88 | $ExecuteOnboardingPlan = Invoke-vRARestMethod -Method GET -URI $OnboardingPlanExecutionLink -Verbose:$VerbosePreference 89 | 90 | CalculateOutput $ExecuteOnboardingPlan 91 | } 92 | 93 | break 94 | } 95 | } 96 | } 97 | catch [Exception]{ 98 | 99 | throw 100 | } 101 | } 102 | end { 103 | 104 | } 105 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/Get-vRAOnboardingResource.ps1: -------------------------------------------------------------------------------- 1 | function Get-vRAOnboardingResource { 2 | <# 3 | .SYNOPSIS 4 | Get a vRA Onboarding Resource 5 | 6 | .DESCRIPTION 7 | Get a vRA Onboarding Resource 8 | 9 | .PARAMETER Id 10 | The ID of the Onboarding Resource 11 | 12 | .PARAMETER Name 13 | The Name of the Onboarding Resource 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .OUTPUTS 19 | System.Management.Automation.PSObject 20 | 21 | .EXAMPLE 22 | Get-vRAOnboardingResource 23 | 24 | .EXAMPLE 25 | Get-vRAOnboardingResource -Id '0b8c2def-b2bc-3fb1-a88f-0621dacdab71' 26 | 27 | .EXAMPLE 28 | Get-vRAOnboardingResource -Name 'Test OnboardingResource' 29 | 30 | #> 31 | [CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 32 | 33 | Param ( 34 | 35 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] 36 | [ValidateNotNullOrEmpty()] 37 | [String[]]$Id, 38 | 39 | [Parameter(Mandatory=$true,ParameterSetName="ByName")] 40 | [ValidateNotNullOrEmpty()] 41 | [String[]]$Name 42 | ) 43 | 44 | begin { 45 | $APIUrl = '/relocation/onboarding/resource' 46 | 47 | function CalculateOutput($ResponseObject) { 48 | 49 | $DocumentSelfLink = $ResponseObject.documentSelfLink 50 | $OnboardingResourceId = ($DocumentSelfLink -split "/")[-1] 51 | 52 | [PSCustomObject] @{ 53 | 54 | Name = $ResponseObject.resourceName 55 | Id = $OnboardingResourceId 56 | PlanLink = $ResponseObject.planLink 57 | ResourceLink = $ResponseObject.resourceLink 58 | DeploymentLink = $ResponseObject.deploymentLink 59 | TagLinks = $ResponseObject.tagLinks 60 | RuleLinks = $ResponseObject.ruleLinks 61 | CreatedTimeMicros = $ResponseObject.createdTimeMicros 62 | DocumentSelfLink = $DocumentSelfLink 63 | } 64 | } 65 | } 66 | 67 | process { 68 | 69 | try { 70 | 71 | switch ($PsCmdlet.ParameterSetName) { 72 | 73 | # --- Get Onboarding Resource by Id 74 | 'ById' { 75 | 76 | foreach ($OnboardingResourceId in $Id){ 77 | 78 | $URI = "$($APIUrl)/$($OnboardingResourceId)" 79 | $OnboardingResource= Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 80 | 81 | CalculateOutput $OnboardingResource 82 | } 83 | 84 | break 85 | } 86 | # --- Get Onboarding Resource by Name 87 | 'ByName' { 88 | 89 | $URI = "$($APIUrl)?`$expand=true" 90 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 91 | 92 | foreach ($OnboardingResourceName in $Name){ 93 | 94 | $MatchedOnboardingResource = $false 95 | 96 | foreach ($Document in $Response.documentLinks){ 97 | 98 | $OnboardingResource = $Response.documents.$document 99 | 100 | if ($OnboardingResource.resourceName -eq $OnboardingResourceName){ 101 | 102 | $MatchedOnboardingResource = $true 103 | CalculateOutput $OnboardingResource 104 | } 105 | } 106 | 107 | if (!$MatchedOnboardingResource) { 108 | 109 | throw "Could not find Onboarding Resource with name: $($OnboardingResourceName)" 110 | } 111 | } 112 | 113 | break 114 | } 115 | # --- No parameters passed so return all Onboarding Resources 116 | 'Standard' { 117 | 118 | $URI = "$($APIUrl)?`$expand=true" 119 | $Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference 120 | 121 | foreach ($Document in $Response.documentLinks){ 122 | 123 | $OnboardingResource = $Response.documents.$document 124 | 125 | CalculateOutput $OnboardingResource 126 | } 127 | } 128 | } 129 | } 130 | catch [Exception]{ 131 | 132 | throw 133 | } 134 | } 135 | end { 136 | 137 | } 138 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/New-vRAOnboardingDeployment.ps1: -------------------------------------------------------------------------------- 1 | function New-vRAOnboardingDeployment { 2 | <# 3 | .SYNOPSIS 4 | Create a vRA Onboarding Deployment 5 | 6 | .DESCRIPTION 7 | Create a vRA Onboarding Deployment 8 | 9 | .PARAMETER Name 10 | The name of the Onboarding Deployment 11 | 12 | .PARAMETER OnboardingPlanLink 13 | Link for the Onboarding Plan to associate with 14 | 15 | .PARAMETER JSON 16 | A JSON string with the body payload 17 | 18 | .INPUTS 19 | System.String 20 | 21 | .OUTPUTS 22 | System.Management.Automation.PSObject 23 | 24 | .EXAMPLE 25 | New-vRAOnboardingDeployment -Name "TestOnboardingDeployment" -OnboardingPlanLink "/relocation/onboarding/plan/282dd58e8dcfc7559a0d225680a7" 26 | 27 | .EXAMPLE 28 | $JSON = @" 29 | 30 | { 31 | "name": "TestOnboardingDeployment", 32 | "planLink": "/relocation/onboarding/plan/282dd58e8dcfc7559a0d225680a7" 33 | } 34 | "@ 35 | 36 | $JSON | New-vRAOnboardingDeployment 37 | 38 | 39 | #> 40 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="Low",DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 41 | 42 | Param ( 43 | 44 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 45 | [ValidateNotNullOrEmpty()] 46 | [String]$Name, 47 | 48 | [Parameter(Mandatory=$false,ParameterSetName="Standard")] 49 | [ValidateNotNullOrEmpty()] 50 | [String]$OnboardingPlanLink, 51 | 52 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ParameterSetName="JSON")] 53 | [ValidateNotNullOrEmpty()] 54 | [String]$JSON 55 | 56 | ) 57 | 58 | begin { 59 | function CalculateOutput($ResponseObject) { 60 | 61 | $DocumentSelfLink = $ResponseObject.documentSelfLink 62 | $OnboardingDeploymentId = ($DocumentSelfLink -split "/")[-1] 63 | 64 | [PSCustomObject] @{ 65 | 66 | Name = $ResponseObject.name 67 | Id = $OnboardingDeploymentId 68 | PlanLink = $ResponseObject.planLink 69 | DocumentSelfLink = $DocumentSelfLink 70 | } 71 | } 72 | } 73 | 74 | process { 75 | 76 | if ($PSBoundParameters.ContainsKey("JSON")) { 77 | 78 | $Data = ($JSON | ConvertFrom-Json) 79 | 80 | $Body = $JSON 81 | $Name = $Data.name 82 | } 83 | else { 84 | 85 | $Body = @" 86 | { 87 | "name": "$($Name)", 88 | "planLink": "$($OnboardingPlanLink)" 89 | } 90 | "@ 91 | } 92 | 93 | # --- Create new Onboarding Deployment 94 | try { 95 | if ($PSCmdlet.ShouldProcess($Name)){ 96 | 97 | $URI = "/relocation/onboarding/deployment" 98 | $OnboardingDeployment = Invoke-vRARestMethod -Method POST -URI $URI -Body $Body -Verbose:$VerbosePreference 99 | 100 | CalculateOutput $OnboardingDeployment 101 | } 102 | } 103 | catch [Exception] { 104 | 105 | throw 106 | } 107 | } 108 | 109 | end { 110 | 111 | } 112 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/New-vRAOnboardingPlan.ps1: -------------------------------------------------------------------------------- 1 | function New-vRAOnboardingPlan { 2 | <# 3 | .SYNOPSIS 4 | Create a vRA Onboarding Plan 5 | 6 | .DESCRIPTION 7 | Create a vRA Onboarding Plan 8 | 9 | .PARAMETER Name 10 | The name of the Onboarding Plan 11 | 12 | .PARAMETER CloudAccountId 13 | Cloud Account Id for the Onboarding Plan (Note: vRA Cloud API refers to it as endpointId) 14 | 15 | .PARAMETER ProjectId 16 | Project Id for the Onboarding Plan 17 | 18 | .PARAMETER JSON 19 | A JSON string with the body payload 20 | 21 | .INPUTS 22 | System.String 23 | 24 | .OUTPUTS 25 | System.Management.Automation.PSObject 26 | 27 | .EXAMPLE 28 | New-vRAOnboardingPlan -Name "TestOnboardingPlan" -CloudAccountId "42fe38765a63bd755921a88814a14" -ProjectId "9f732951-2279-422a-8045-9b254d427100" 29 | 30 | .EXAMPLE 31 | $JSON = @" 32 | 33 | { 34 | "name": "TestOnboardingPlan", 35 | "endpointId": "42fe38765a63bd755921a88814a14", 36 | "projectId": "9f732951-2279-422a-8045-9b254d427100" 37 | } 38 | "@ 39 | 40 | $JSON | New-vRAOnboardingPlan 41 | 42 | 43 | #> 44 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="Low",DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 45 | 46 | Param ( 47 | 48 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 49 | [ValidateNotNullOrEmpty()] 50 | [String]$Name, 51 | 52 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 53 | [ValidateNotNullOrEmpty()] 54 | [String]$CloudAccountId, 55 | 56 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 57 | [ValidateNotNullOrEmpty()] 58 | [String]$ProjectId, 59 | 60 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ParameterSetName="JSON")] 61 | [ValidateNotNullOrEmpty()] 62 | [String]$JSON 63 | 64 | ) 65 | 66 | Begin { 67 | function CalculateOutput($ResponseObject) { 68 | 69 | $DocumentSelfLink = $ResponseObject.documentSelfLink 70 | $OnboardingPlanId = ($DocumentSelfLink -split "/")[-1] 71 | 72 | [PSCustomObject] @{ 73 | 74 | Name = $ResponseObject.name 75 | Id = $OnboardingPlanId 76 | Status = $ResponseObject.status 77 | EndpointId = $ResponseObject.endpointId 78 | EndpointIds = $ResponseObject.endpointIds 79 | ProjectId = $ResponseObject.projectId 80 | CreatedBy = $ResponseObject.createdBy 81 | EnableExtensibilityEvents = $ResponseObject.enableExtensibilityEvents 82 | OrganizationId = $ResponseObject.organizationId 83 | DocumentSelfLink = $DocumentSelfLink 84 | } 85 | } 86 | } 87 | 88 | Process { 89 | 90 | if ($PSBoundParameters.ContainsKey("JSON")) { 91 | 92 | $Data = ($JSON | ConvertFrom-Json) 93 | 94 | $Body = $JSON 95 | $Name = $Data.name 96 | } 97 | else { 98 | 99 | $Body = @" 100 | { 101 | "name": "$($Name)", 102 | "endpointId": "$($CloudAccountId)", 103 | "projectId": "$($ProjectId)" 104 | } 105 | "@ 106 | } 107 | 108 | # --- Create new Onboarding Plan 109 | try { 110 | if ($PSCmdlet.ShouldProcess($Name)){ 111 | 112 | $URI = "/relocation/onboarding/plan" 113 | $OnboardingPlan = Invoke-vRARestMethod -Method POST -URI $URI -Body $Body -Verbose:$VerbosePreference 114 | 115 | CalculateOutput $OnboardingPlan 116 | } 117 | } 118 | catch [Exception] { 119 | 120 | throw 121 | } 122 | } 123 | 124 | End { 125 | 126 | } 127 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/New-vRAOnboardingResource.ps1: -------------------------------------------------------------------------------- 1 | function New-vRAOnboardingResource { 2 | <# 3 | .SYNOPSIS 4 | Create a vRA Onboarding Resource 5 | 6 | .DESCRIPTION 7 | Create a vRA Onboarding Resource 8 | 9 | .PARAMETER Name 10 | The name of the Onboarding Resource 11 | 12 | .PARAMETER VMId 13 | The Id of the IaaS VM to associate the Onboarding Resource with 14 | 15 | .PARAMETER DeploymentLink 16 | Link to the Onboarding Deployment to associate the Onboarding Resource with 17 | 18 | .PARAMETER PlanLink 19 | Link to the Onboarding Plan to associate the Onboarding Resource with 20 | 21 | .PARAMETER RuleLinks 22 | Link(s) to the Onboarding Rule(s) to associate the Onboarding Resource with 23 | 24 | .PARAMETER JSON 25 | A JSON string with the body payload 26 | 27 | .INPUTS 28 | System.String 29 | 30 | .OUTPUTS 31 | System.Management.Automation.PSObject 32 | 33 | .EXAMPLE 34 | $OnboardingResourceArguments = @{ 35 | 36 | Name = 'TestOnboardingResource' 37 | VMId = 'ee7eeed1-b4e4-4143-a437-d3c0622bf9df' 38 | DeploymentLink = '/relocation/onboarding/deployment/5bc7eb75-r2d2-4c24-93ac-8c3p0d02f7f1' 39 | PlanLink = '/relocation/onboarding/plan/ecaak2s0-r5d4-4a79-b17b-27f13c7d3ff7' 40 | RuleLinks = '/relocation/onboarding/rule/include' 41 | } 42 | 43 | New-vRAOnboardingResource @OnboardingResourceArguments 44 | 45 | .EXAMPLE 46 | $JSON = @" 47 | 48 | { 49 | "deploymentLink": "/relocation/onboarding/deployment/5bc7eb75-r2d2-4c24-93ac-8c3p0d02f7f1", 50 | "planLink": "/relocation/onboarding/plan/ecaak2s0-r5d4-4a79-b17b-27f13c7d3ff7", 51 | "resourceLink": "/resources/compute/ee7eeed1-b4e4-4143-a437-d3c0622bf9df", 52 | "resourceName": "TestOnboardingResource", 53 | "ruleLinks": [ 54 | "/relocation/onboarding/rule/include" 55 | ] 56 | } 57 | "@ 58 | 59 | $JSON | New-vRAOnboardingResource 60 | #> 61 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="Low",DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] 62 | 63 | Param ( 64 | 65 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 66 | [ValidateNotNullOrEmpty()] 67 | [String]$Name, 68 | 69 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 70 | [ValidateNotNullOrEmpty()] 71 | [String]$VMId, 72 | 73 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 74 | [ValidateNotNullOrEmpty()] 75 | [String]$DeploymentLink, 76 | 77 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 78 | [ValidateNotNullOrEmpty()] 79 | [String]$PlanLink, 80 | 81 | [Parameter(Mandatory=$true,ParameterSetName="Standard")] 82 | [ValidateNotNullOrEmpty()] 83 | [String[]]$RuleLinks, 84 | 85 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ParameterSetName="JSON")] 86 | [ValidateNotNullOrEmpty()] 87 | [String]$JSON 88 | 89 | ) 90 | 91 | begin { 92 | function CalculateOutput($ResponseObject) { 93 | 94 | $DocumentSelfLink = $ResponseObject.documentSelfLink 95 | $OnboardingResourceId = ($DocumentSelfLink -split "/")[-1] 96 | 97 | [PSCustomObject] @{ 98 | 99 | Name = $ResponseObject.resourceName 100 | Id = $OnboardingResourceId 101 | PlanLink = $ResponseObject.planLink 102 | ResourceLink = $ResponseObject.resourceLink 103 | DeploymentLink = $ResponseObject.deploymentLink 104 | RuleLinks = $ResponseObject.ruleLinks 105 | CreatedTimeMicros = $ResponseObject.createdTimeMicros 106 | DocumentSelfLink = $DocumentSelfLink 107 | } 108 | } 109 | } 110 | 111 | process { 112 | 113 | if ($PSBoundParameters.ContainsKey("JSON")) { 114 | 115 | $Data = ($JSON | ConvertFrom-Json) 116 | 117 | $Body = $JSON 118 | $Name = $Data.resourceName 119 | } 120 | else { 121 | 122 | # Format RuleLinks with surrounding quotes and join into single string 123 | $RuleLinksAddQuotes = $RuleLinks | ForEach-Object {"`"$_`""} 124 | $RuleLinksFormatForBodyText = $RuleLinksAddQuotes -join "," 125 | 126 | $Body = @" 127 | { 128 | "deploymentLink": "$($DeploymentLink)", 129 | "planLink": "$($PlanLink)", 130 | "resourceLink": "/resources/compute/$($VMId)", 131 | "resourceName": "$($Name)", 132 | "ruleLinks": [ $($RuleLinksFormatForBodyText) ] 133 | } 134 | "@ 135 | } 136 | 137 | # --- Create new Onboarding Resource 138 | try { 139 | if ($PSCmdlet.ShouldProcess($Name)){ 140 | 141 | $URI = "/relocation/onboarding/resource" 142 | $OnboardingResource = Invoke-vRARestMethod -Method POST -URI $URI -Body $Body -Verbose:$VerbosePreference 143 | 144 | CalculateOutput $OnboardingResource 145 | } 146 | } 147 | catch [Exception] { 148 | 149 | throw 150 | } 151 | } 152 | end { 153 | 154 | } 155 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/Remove-vRAOnboardingDeployment.ps1: -------------------------------------------------------------------------------- 1 | function Remove-vRAOnboardingDeployment { 2 | <# 3 | .SYNOPSIS 4 | Remove an Onboarding Deployment 5 | 6 | .DESCRIPTION 7 | Remove an Onboarding Deployment 8 | 9 | .PARAMETER Id 10 | The Id of the Onboarding Deployment 11 | 12 | .PARAMETER Name 13 | The name of the Onboarding Deployment 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .EXAMPLE 19 | Remove-vRAOnboardingDeployment -Name OnboardingDeployment1 20 | 21 | .EXAMPLE 22 | Remove-vRAOnboardingDeployment -Id 'b210b3044578447559e3b3bad52de' 23 | 24 | .EXAMPLE 25 | Get-vRAOnboardingDeployment -Name OnboardingDeployment1 | Remove-vRAOnboardingDeployment 26 | 27 | #> 28 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ById")] 29 | 30 | Param ( 31 | 32 | [parameter(Mandatory=$true, ValueFromPipelineByPropertyName, ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [parameter(Mandatory=$true, ParameterSetName="ByName")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$Name 39 | 40 | ) 41 | 42 | begin {} 43 | 44 | process { 45 | 46 | try { 47 | 48 | switch ($PSCmdlet.ParameterSetName) { 49 | 50 | 'ById' { 51 | 52 | foreach ($OnboardingDeploymentId in $Id) { 53 | 54 | if ($PSCmdlet.ShouldProcess($OnboardingDeploymentId)){ 55 | 56 | $URI = "/relocation/onboarding/deployment/$($OnboardingDeploymentId)" 57 | 58 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 59 | } 60 | } 61 | 62 | break 63 | } 64 | 65 | 'ByName' { 66 | 67 | foreach ($OnboardingDeploymentName in $Name) { 68 | 69 | if ($PSCmdlet.ShouldProcess($OnboardingDeploymentName)){ 70 | 71 | $OnboardingDeploymentId = (Get-vRAOnboardingDeployment -Name $OnboardingDeploymentName).id 72 | $URI = "/relocation/onboarding/deployment/$($OnboardingDeploymentId)" 73 | 74 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 75 | } 76 | } 77 | 78 | break 79 | } 80 | } 81 | } 82 | catch [Exception]{ 83 | 84 | throw 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/Remove-vRAOnboardingPlan.ps1: -------------------------------------------------------------------------------- 1 | function Remove-vRAOnboardingPlan { 2 | <# 3 | .SYNOPSIS 4 | Remove an Onboarding Plan 5 | 6 | .DESCRIPTION 7 | Remove an Onboarding Plan 8 | 9 | .PARAMETER Id 10 | The id of the Onboarding Plan 11 | 12 | .PARAMETER Name 13 | The name of the Onboarding Plan 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .EXAMPLE 19 | Remove-vRAOnboardingPlan -Name OnboardingPlan1 20 | 21 | .EXAMPLE 22 | Remove-vRAOnboardingPlan -Id 'b210b3044578447559e3b3bad52de' 23 | 24 | .EXAMPLE 25 | Get-vRAOnboardingPlan -Name OnboardingPlan1 | Remove-vRAOnboardingPlan 26 | 27 | #> 28 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ById")] 29 | 30 | Param ( 31 | 32 | [parameter(Mandatory=$true, ValueFromPipelineByPropertyName, ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [parameter(Mandatory=$true, ParameterSetName="ByName")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$Name 39 | 40 | ) 41 | 42 | begin {} 43 | 44 | process { 45 | 46 | try { 47 | 48 | switch ($PSCmdlet.ParameterSetName) { 49 | 50 | 'ById' { 51 | 52 | foreach ($OnboardingPlanId in $Id) { 53 | 54 | if ($PSCmdlet.ShouldProcess($OnboardingPlanId)){ 55 | 56 | $URI = "/relocation/onboarding/plan/$($OnboardingPlanId)" 57 | 58 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 59 | } 60 | } 61 | 62 | break 63 | } 64 | 65 | 'ByName' { 66 | 67 | foreach ($OnboardingPlanName in $Name) { 68 | 69 | if ($PSCmdlet.ShouldProcess($OnboardingPlanName)){ 70 | 71 | $OnboardingPlanId = (Get-vRAOnboardingPlan -Name $OnboardingPlanName).id 72 | $URI = "/relocation/onboarding/plan/$($OnboardingPlanId)" 73 | 74 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 75 | } 76 | } 77 | 78 | break 79 | } 80 | } 81 | } 82 | catch [Exception]{ 83 | 84 | throw 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /src/Functions/Public/relocation/Remove-vRAOnboardingResource.ps1: -------------------------------------------------------------------------------- 1 | function Remove-vRAOnboardingResource { 2 | <# 3 | .SYNOPSIS 4 | Remove a Onboarding Resource 5 | 6 | .DESCRIPTION 7 | Remove a Onboarding Resource 8 | 9 | .PARAMETER Id 10 | The Id of the Onboarding Resource 11 | 12 | .PARAMETER Name 13 | The Name of the Onboarding Resource 14 | 15 | .INPUTS 16 | System.String 17 | 18 | .EXAMPLE 19 | Remove-vRAOnboardingResource -Name OnboardingResource1 20 | 21 | .EXAMPLE 22 | Remove-vRAOnboardingResource -Id '81289f15-89e4-3580-k2s0-86cd3af25257' 23 | 24 | .EXAMPLE 25 | Get-vRAOnboardingResource -Name OnboardingResource1 | Remove-vRAOnboardingResource 26 | 27 | #> 28 | [CmdletBinding(SupportsShouldProcess,ConfirmImpact="High",DefaultParameterSetName="ById")] 29 | 30 | Param ( 31 | 32 | [parameter(Mandatory=$true, ValueFromPipelineByPropertyName, ParameterSetName="ById")] 33 | [ValidateNotNullOrEmpty()] 34 | [String[]]$Id, 35 | 36 | [parameter(Mandatory=$true, ParameterSetName="ByName")] 37 | [ValidateNotNullOrEmpty()] 38 | [String[]]$Name 39 | 40 | ) 41 | 42 | begin {} 43 | 44 | process { 45 | 46 | try { 47 | 48 | switch ($PSCmdlet.ParameterSetName) { 49 | 50 | 'ById' { 51 | 52 | foreach ($OnboardingResourceId in $Id) { 53 | 54 | if ($PSCmdlet.ShouldProcess($OnboardingResourceId)){ 55 | 56 | $URI = "/relocation/onboarding/resource/$($OnboardingResourceId)" 57 | 58 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 59 | } 60 | } 61 | 62 | break 63 | } 64 | 65 | 'ByName' { 66 | 67 | foreach ($OnboardingResourceName in $Name) { 68 | 69 | if ($PSCmdlet.ShouldProcess($OnboardingResourceName)){ 70 | 71 | $OnboardingResourceId = (Get-vRAOnboardingResource -Name $OnboardingResourceName).id 72 | $URI = "/relocation/onboarding/resource/$($OnboardingResourceId)" 73 | 74 | Invoke-vRARestMethod -Method DELETE -URI "$($URI)" -Verbose:$VerbosePreference | Out-Null 75 | } 76 | } 77 | 78 | break 79 | } 80 | } 81 | } 82 | catch [Exception]{ 83 | 84 | throw 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /src/PowervRA.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'PowervRA' 3 | # 4 | # Generated by: Jakku Labs 5 | # 6 | # Generated on: 07/01/2017 7 | # 8 | 9 | @{ 10 | 11 | # Script module or binary module file associated with this manifest. 12 | RootModule = 'PowervRA.psm1' 13 | 14 | # Version number of this module. 15 | ModuleVersion = '0.0.0' 16 | 17 | # Supported PSEditions 18 | CompatiblePSEditions = 'Desktop', 'Core' 19 | 20 | # ID used to uniquely identify this module 21 | GUID = 'bbe31f5e-6a10-4859-8b71-2aaef94a8be5' 22 | 23 | # Author of this module 24 | Author = 'Jakku Labs' 25 | 26 | # Company or vendor of this module 27 | CompanyName = 'Jakku Labs' 28 | 29 | # Copyright statement for this module 30 | Copyright = '(c) 2016 Jakku Labs. All rights reserved.' 31 | 32 | # Description of the functionality provided by this module 33 | Description = 'PowerShell Module for Managing VMware vRealize Automation' 34 | 35 | # Minimum version of the Windows PowerShell engine required by this module 36 | PowerShellVersion = '5.1' 37 | 38 | # Name of the Windows PowerShell host required by this module 39 | # PowerShellHostName = '' 40 | 41 | # Minimum version of the Windows PowerShell host required by this module 42 | # PowerShellHostVersion = '' 43 | 44 | # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 45 | # DotNetFrameworkVersion = '' 46 | 47 | # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 48 | # CLRVersion = '' 49 | 50 | # Processor architecture (None, X86, Amd64) required by this module 51 | # ProcessorArchitecture = '' 52 | 53 | # Modules that must be imported into the global environment prior to importing this module 54 | # RequiredModules = @() 55 | 56 | # Assemblies that must be loaded prior to importing this module 57 | # RequiredAssemblies = @() 58 | 59 | # Script files (.ps1) that are run in the caller's environment prior to importing this module. 60 | # ScriptsToProcess = @() 61 | 62 | # Type files (.ps1xml) to be loaded when importing this module 63 | # TypesToProcess = @() 64 | 65 | # Format files (.ps1xml) to be loaded when importing this module 66 | # FormatsToProcess = @() 67 | 68 | # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess 69 | # NestedModules = @() 70 | 71 | # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. 72 | FunctionsToExport = @('Connect-vRAServer','Disconnect-vRAServer','Get-vRAAPIVersion','Get-vRABlockDevice','Get-vRABlueprint','Get-vRABlueprintVersion','Get-vRACatalogItem','Get-vRACloudAccount','Get-vRACloudZone','Get-vRACodeStreamExecution','Get-vRACodeStreamPipeline','Get-vRACodeStreamVariable','Get-vRAContentSource','Get-vRADeployment','Get-vRAExternalNetworkIPRange','Get-vRAFabricAWSVolumeType','Get-vRAFabricAzureStorageAccount','Get-vRAFabricCompute','Get-vRAFabricImage','Get-vRAFabricNetwork','Get-vRAFlavorProfile','Get-vRAImageProfile','Get-vRALoadBalancer','Get-vRAMachine','Get-vRAMachineDisk','Get-vRANetwork','Get-vRANetworkDomain','Get-vRANetworkIPRange','Get-vRANetworkProfile','Get-vRAOnboardingDeployment','Get-vRAOnboardingPlan','Get-vRAOnboardingPlanExecution','Get-vRAOnboardingResource','Get-vRAProject','Get-vRARegion','Get-vRARegionEnumerationvSphere','Get-vRARequest','Get-vRASecurityGroup','Get-vRAStorageProfile','Get-vRATag','Get-vRAvSphereFabricDatastore','Get-vRAvSphereFabricNetwork','Get-vRAvSphereFabricStoragePolicy','Invoke-vRAOnboardingPlan','Invoke-vRARestMethod','New-vRACloudAccountAzure','New-vRACloudAccountGCP','New-vRACloudAccountvSphere','New-vRAMachineAttachedDisk','New-vRANetworkProfile','New-vRAOnboardingDeployment','New-vRAOnboardingPlan','New-vRAOnboardingResource','New-vRAProject','New-vRAVirtualDisk','Remove-vRACloudAccount','Remove-vRACodeStreamExecution','Remove-vRACodeStreamVariable','Remove-vRAOnboardingDeployment','Remove-vRAOnboardingPlan','Remove-vRAOnboardingResource','Remove-vRAProject','Resize-vRAMachine','Resize-vRAVirtualDisk','Restart-vRAMachine','Restart-vRAMachineGuestOS','Start-vRAMachine','Stop-vRAMachine','Stop-vRAMachineGuestOS','Suspend-vRAMachine','Update-vRACodeStreamVariable','Update-vRAExternalNetworkIPRange','Update-vRAProject','Update-vRAvSphereFabricNetwork') 73 | 74 | # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. 75 | CmdletsToExport = @() 76 | 77 | # Variables to export from this module 78 | VariablesToExport = @() 79 | 80 | # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. 81 | AliasesToExport = @() 82 | 83 | # DSC resources to export from this module 84 | # DscResourcesToExport = @() 85 | 86 | # List of all modules packaged with this module 87 | # ModuleList = @() 88 | 89 | # List of all files packaged with this module 90 | # FileList = @() 91 | 92 | # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 93 | PrivateData = @{ 94 | 95 | PSData = @{ 96 | 97 | # Tags applied to this module. These help with module discovery in online galleries. 98 | Tags = @('Automation', 'VMware', 'vRA', 'vRealize') 99 | 100 | # A URL to the license for this module. 101 | LicenseUri = 'https://raw.githubusercontent.com/jakkulabs/PowervRA/master/LICENSE' 102 | 103 | # A URL to the main website for this project. 104 | ProjectUri = 'https://github.com/jakkulabs/PowervRA' 105 | 106 | # A URL to an icon representing this module. 107 | IconUri = 'https://raw.githubusercontent.com/jakkulabs/PowervRA/master/media/PowervRA-icon.png' 108 | 109 | } # End of PSData hashtable 110 | 111 | } # End of PrivateData hashtable 112 | 113 | # HelpInfo URI of this module 114 | # HelpInfoURI = '' 115 | 116 | # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. 117 | # DefaultCommandPrefix = '' 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/PowervRA.psm1: -------------------------------------------------------------------------------- 1 | # --- Expose each Public and Private function as part of the module 2 | foreach ($PrivateFunction in Get-ChildItem -Path "$($PSScriptRoot)\Functions\Private\*.ps1" -Recurse -Verbose:$VerbosePreference) { 3 | 4 | . $PrivateFunction.FullName 5 | } 6 | 7 | foreach ($Publicfunction in Get-ChildItem -Path "$($PSScriptRoot)\Functions\Public\*.ps1" -Recurse -Verbose:$VerbosePreference) { 8 | 9 | . $PublicFunction.FullName 10 | 11 | $BaseName = [System.IO.Path]::GetFileNameWithoutExtension($PublicFunction) 12 | 13 | # --- Support DEPRECATED functions. Ensure that we are exporting only the function name 14 | $DepricatedKeyword = "DEPRECATED-" 15 | if ($BaseName.StartsWith($DepricatedKeyword)) { 16 | 17 | $BaseName = $BaseName.Trim($DepricatedKeyword) 18 | } 19 | 20 | Export-ModuleMember -Function ($BaseName) 21 | } 22 | 23 | # --- Clean up variables on module removal 24 | $ExecutionContext.SessionState.Module.OnRemove = { 25 | 26 | Remove-Variable -Name vRAConnection -Force -ErrorAction SilentlyContinue 27 | 28 | } --------------------------------------------------------------------------------