Skip to content

Commit

Permalink
Merge branch 'complete-iaas-uris'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpuckett159 committed Sep 5, 2020
2 parents 6f360e6 + dd93639 commit c6ee4f6
Show file tree
Hide file tree
Showing 20 changed files with 2,158 additions and 1 deletion.
131 changes: 131 additions & 0 deletions src/Functions/Public/iaas/Get-vRAExternalNetworkIPRange.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
function Get-vRAExternalNetworkIPRange {
<#
.SYNOPSIS
Get a vRA External Network IP Range
.DESCRIPTION
Get a vRA External Network IP Range
.PARAMETER Id
The ID of the vRA External Network IP Range
.PARAMETER Name
The Name of the vRA External Network IP Range
.INPUTS
System.String
.OUTPUTS
System.Management.Automation.PSObject
.EXAMPLE
Get-vRAExternalNetworkIPRange
.EXAMPLE
Get-vRAExternalNetworkIPRange -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9'
.EXAMPLE
Get-vRAExternalNetworkIPRange -Name 'TestExternalNetworkIPRange'
#>
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')]

Param (

[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")]
[ValidateNotNullOrEmpty()]
[String[]]$Id,

[Parameter(Mandatory=$true,ParameterSetName="ByName")]
[ValidateNotNullOrEmpty()]
[String[]]$Name
)

begin {
$APIUrl = '/iaas/api/external-network-ip-ranges'

function CalculateOutput([PSCustomObject]$ExternalNetworkIPRange) {

[PSCustomObject] @{
Owner = $ExternalNetworkIPRange.owner
Description = $ExternalNetworkIPRange.description
Tags = $ExternalNetworkIPRange.tags
ExternalId = $ExternalNetworkIPRange.externalId
SubnetPrefixLength = $ExternalNetworkIPRange.subnetPrefixLength
Name = $ExternalNetworkIPRange.name
Id = $ExternalNetworkIPRange.id
CreatedAt = $ExternalNetworkIPRange.createdAt
UpdatedAt = $ExternalNetworkIPRange.updatedAt
OrganizationId = $ExternalNetworkIPRange.orgId
StartIPAddress = $ExternalNetworkIPRange.startIPAddress
EndIPAddress = $ExternalNetworkIPRange.endIPAddress
IPVersion = $ExternalNetworkIPRange.ipVersion
AddressSpaceId = $ExternalNetworkIPRange.addressSpaceId
DNSServerAddresses = $ExternalNetworkIPRange.dnsServerAddresses
DNSSearchDomains = $ExternalNetworkIPRange.dnsSearchDomains
Domain = $ExternalNetworkIPRange.domain
GatewayAddress = $ExternalNetworkIPRange.gatewayAddress
Links = $ExternalNetworkIPRange._links
}
}
}

process {

try {

switch ($PsCmdlet.ParameterSetName) {

# --- Get External Network IP Range by Id
'ById' {

foreach ($ExternalNetworkIPRangeId in $Id){

$URI = "$($APIUrl)?`$filter=id eq '$($ExternalNetworkIPRangeId)'"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($ExternalNetworkIPRange in $Response.content) {
CalculateOutput $ExternalNetworkIPRange
}
}

break
}
# --- Get External Network IP Range by Name
'ByName' {

foreach ($ExternalNetworkIPRangeName in $Name){

$URI = "$($APIUrl)?`$filter=name eq '$($ExternalNetworkIPRangeName)'"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($ExternalNetworkIPRange in $Response.content) {
CalculateOutput $ExternalNetworkIPRange
}
}

break
}
# --- No parameters passed so return all External Network IP Ranges
'Standard' {

$URI = $APIUrl
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($ExternalNetworkIPRange in $Response.content) {
CalculateOutput $ExternalNetworkIPRange
}
}
}
}
catch [Exception]{

throw
}
}

end {

}
}

63 changes: 63 additions & 0 deletions src/Functions/Public/iaas/Get-vRAFabricAWSVolumeType.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
function Get-vRAFabricAWSVolumeType {
<#
.SYNOPSIS
Get a vRA Fabric AWS Volume Types
.DESCRIPTION
Get a vRA Fabric AWS Volume Types
.INPUTS
None
.OUTPUTS
System.Management.Automation.PSObject
.EXAMPLE
Get-vRAFabricAWSVolumeTypes
#>
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')]

Param (
)

begin {
$APIUrl = '/iaas/api/fabric-aws-volume-types'

function CalculateOutput([PSCustomObject]$FabricAWSVolumeTypes) {

[PSCustomObject] @{
VolumeTypes = $FabricAWSVolumeTypes.volumeTypes
}
}
}

process {

try {

switch ($PsCmdlet.ParameterSetName) {

# --- Return all Fabric AWS Volume Types
'Standard' {

$URI = $APIUrl
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($FabricAWSVolumeTypes in $Response.content) {
CalculateOutput $FabricAWSVolumeTypes
}
}
}
}
catch [Exception]{

throw
}
}

end {

}
}

66 changes: 66 additions & 0 deletions src/Functions/Public/iaas/Get-vRAFabricAzureStorageAccount.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
function Get-vRAFabricAzureStorageAccount {
<#
.SYNOPSIS
Get a vRA Fabric Azure Storage Accounts
.DESCRIPTION
Get a vRA Fabric Azure Storage Accounts
.INPUTS
None
.OUTPUTS
System.Management.Automation.PSObject
.EXAMPLE
Get-vRAFabricAzureStorageAccounts
#>
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')]

Param (
)

begin {
$APIUrl = '/iaas/api/fabric-azure-storage-accounts'

function CalculateOutput([PSCustomObject]$FabricAzureStorageAccounts) {

# Don't have any Azure accounts so not sure what this is supposed to look like, will test later
# TODO find examples of what these objects look like

[PSCustomObject] @{
FabricAzureStorageAccount = $FabricAzureStorageAccounts
}
}
}

process {

try {

switch ($PsCmdlet.ParameterSetName) {

# --- Return all Fabric AWS Volume Types
'Standard' {

$URI = $APIUrl
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($FabricAzureStorageAccounts in $Response.content) {
CalculateOutput $FabricAzureStorageAccounts
}
}
}
}
catch [Exception]{

throw
}
}

end {

}
}

122 changes: 122 additions & 0 deletions src/Functions/Public/iaas/Get-vRAFabricCompute.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
function Get-vRAFabricCompute {
<#
.SYNOPSIS
Get a vRA Fabric Compute
.DESCRIPTION
Get a vRA Fabric Compute
.PARAMETER Id
The ID of the Fabric Compute
.PARAMETER Name
The Name of the Fabric Compute
.INPUTS
System.String
.OUTPUTS
System.Management.Automation.PSObject
.EXAMPLE
Get-vRAFabricCompute
.EXAMPLE
Get-vRAFabricCompute -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9'
.EXAMPLE
Get-vRAFabricCompute -Name 'TestFabricCompute'
#>
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')]

Param (

[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")]
[ValidateNotNullOrEmpty()]
[String[]]$Id,

[Parameter(Mandatory=$true,ParameterSetName="ByName")]
[ValidateNotNullOrEmpty()]
[String[]]$Name
)

begin {
$APIUrl = '/deployment/api/fabric-computes'

function CalculateOutput([PSCustomObject]$FabricCompute) {

[PSCustomObject] @{
ExternalRegionId = $FabricCompute.externalRegionId
Tags = $FabricCompute.tags
Type = $FabricCompute.type
CustomProperties = $FabricCompute.customProperties
ExternalId = $FabricCompute.externalId
Name = $FabricCompute.name
Id = $FabricCompute.id
CreatedAt = $FabricCompute.createdAt
UpdatedAt = $FabricCompute.updatedAt
OrganizationId = $FabricCompute.organizationId
}
}
}

process {

try {

switch ($PsCmdlet.ParameterSetName) {

# --- Get FabricCompute by Id
'ById' {

foreach ($FabricComputeId in $Id){

$URI = "$($APIUrl)?`$filter=id eq '$($FabricComputeId)'"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($FabricCompute in $Response.content) {
CalculateOutput $FabricCompute
}
}

break
}
# --- Get FabricCompute by Name
'ByName' {

foreach ($FabricComputeName in $Name){

$URI = "$($APIUrl)?`$filter=name eq '$($FabricComputeName)'"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($FabricCompute in $Response.content) {
CalculateOutput $FabricCompute
}
}

break
}
# --- No parameters passed so return all FabricComputes
'Standard' {

$URI = $APIUrl
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($FabricCompute in $Response.content) {
CalculateOutput $FabricCompute
}
}
}
}
catch [Exception]{

throw
}
}

end {

}
}

Loading

0 comments on commit c6ee4f6

Please sign in to comment.