Migration/AZURE/AZUREUtil.psm1

Import-Module -Name @(Join-Path $PSScriptRoot .. | Join-Path -ChildPath .. | Join-Path -ChildPath Common | Join-Path -ChildPath Wrappers | Join-Path -ChildPath Wrappers)

function Read-RMSecurityGroup{
    param (
       [System.Object] $CloudAttribute
    )

    while ($true) {
        $ReadValue =  Read-RMString -UserMessage "Enter security group name" -ParameterName "Security group name" `
            -IsRequired $true
    
        if ($CloudAttribute.properties.subscriptions.regions.security_groups.name -notcontains $ReadValue) {
            Write-RMError -Message "Security group '$ReadValue' does not exists."
            continue
        }
        return $ReadValue
    }
}

function Read-RMResourceGroupRegion {
    param (
        [System.Object] $CloudAttributeSummary
    )

    while ($true) {
        $ReadValue = Read-RMString -UserMessage "Enter the region name where the resource group will be created, e.g. East US" `
            -ParameterName "Resource group region name" -IsRequired $true -Options  $ResrouceGroupRegionOption
    
        if ($CloudAttributeSummary.properties.subscriptions.regions.label -notcontains $ReadValue) {
            Write-RMError -Message "Resource group region name '$ReadValue' does not exists."
            continue
        }
        return $ReadValue
    }
    
}