Functions/Public/iaas-proxy-provider/New-vRANetworkProfileIPRangeDefinition.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function New-vRANetworkProfileIPRangeDefinition {
<#
    .SYNOPSIS
    Creates a new network profile ip range definition
        
    .DESCRIPTION
    Creates a new network profile ip range definition

    .PARAMETER Name
    The name of the network profile ip range

    .PARAMETER Description
    A description of the network profile ip range

    .PARAMETER StartIPv4Address
    The start IPv4 address

    .PARAMETER EndIPv4Address
    The end IPv4 address

    .INPUTS
    System.String.

    .OUTPUTS
    System.Management.Automation.PSObject

    .EXAMPLE
    New-vRANetworkProfileIPRangeDefinition -Name "External-Range-01" -Description "Example" -StartIPv4Address "10.20.1.2" -EndIPv4Address "10.20.1.5"

#>

[CmdletBinding(SupportsShouldProcess,ConfirmImpact="Low",DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')]

    Param (

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

        [Parameter(Mandatory=$false)]
        [ValidateNotNullOrEmpty()]
        [String]$Description,

        [Parameter(Mandatory=$true)]
        [ValidateScript({$_ -match [IPAddress]$_ })]  
        [String]$StartIPv4Address,
        
        [Parameter(Mandatory=$true)]
        [ValidateScript({$_ -match [IPAddress]$_ })]  
        [String]$EndIPv4Address

    )

    if ($PSCmdlet.ShouldProcess($Name)){

        # --- Define ip address range
        $IPAddressRange = [PSCustomObject] @{

                name = $Name
                description = $Description
                beginIPv4Address = $StartIPv4Address
                endIPv4Address = $EndIPv4Address
                state = "UNALLOCATED"
                createdDate = $null
                lastModifiedDate = $null
                definedAddresses = $null

            }

        # --- Return the new ip address range
        $IPAddressRange
        
    }

}