<commit_before># This script deploys dual (east-west) Service Bus Premium namespaces, and pairs them

$primaryLocation = 'australiaeast'
$priLoc = 'aue'
$secondaryLocation = 'australiasoutheast'
$secLoc = 'ase'
$rg = 'servicebusha-rg'
$tags = 'project=servicebus-ha'
$primaryNamespace = "servicebusha-$priLoc"
$secondaryNamespace = "servicebusha-$secLoc"
$alias = 'servicebusha'


# Create Resource Group
az group create -n $rg --location $primaryLocation --tags $tags

# SERVICE BUS
# https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-geo-dr#setup
# https://docs.microsoft.com/en-us/cli/azure/servicebus/namespace?view=azure-cli-latest#az-servicebus-namespace-create

# Primary
az servicebus namespace create -g $rg -n $primaryNamespace --location $primaryLocation --tags $tags --sku Premium --capacity 1

# Secondary
az servicebus namespace create -g $rg -n $secondaryNamespace --location $secondaryLocation --tags $tags --sku Premium --capacity 1

# Set Alias and create Pair
az servicebus georecovery-alias set -g $rg --namespace-name $primaryNamespace --alias $alias --partner-namespace $secondaryNamespace

# Tear down
# az group delete -n $rg --yes<commit_msg>teardown switch<commit_after># This script deploys dual (east-west) Service Bus Premium namespaces, and pairs them
param (
    [Switch] $Teardown
)

$primaryLocation = 'australiaeast'
$priLoc = 'aue'
$secondaryLocation = 'australiasoutheast'
$secLoc = 'ase'
$rg = 'servicebusha-rg'
$tags = 'project=servicebus-ha'
$primaryNamespace = "servicebusha-$priLoc"
$secondaryNamespace = "servicebusha-$secLoc"
$alias = 'servicebusha'

if ($teardown) {
    # TEAR DOWN
    
    # Break pairing
    az servicebus georecovery-alias break-pair -g $rg --namespace-name $primaryNamespace --alias $alias
    
    # Delete RG
    az group delete -n $rg --yes

} else {
    # DEPLOY

    # Create Resource Group
    az group create -n $rg --location $primaryLocation --tags $tags

    # SERVICE BUS
    # https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-geo-dr#setup
    # https://docs.microsoft.com/en-us/cli/azure/servicebus/namespace?view=azure-cli-latest#az-servicebus-namespace-create

    # Primary
    az servicebus namespace create -g $rg -n $primaryNamespace --location $primaryLocation --tags $tags --sku Premium --capacity 1

    # Secondary
    az servicebus namespace create -g $rg -n $secondaryNamespace --location $secondaryLocation --tags $tags --sku Premium --capacity 1

    # Set Alias and create Pair
    az servicebus georecovery-alias set -g $rg --namespace-name $primaryNamespace --alias $alias --partner-namespace $secondaryNamespace

}
{'fraction_non_alphanumeric': 0.12156567557395559, 'fraction_numerical': 0.0015054572826496049, 'mean_word_length': 4.034090909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4299294', 'n_tokens_mistral': 847, 'n_tokens_neox': 810, 'n_words': 233}