#!/bin/bash

function plugin_help () {
    echo "
###############################################
### azvm-deploy.sh plugin 'vnet-append' v2505.1 ###

Don't create a new vnet. Add VM into existing vnet instead.

Conflict: Please include this plugin **after** 'secured'
"
}

function plugin_before_vnet_creat () {
    az network vnet show --name "${vnetname}" --resource-group "${resgrp}" --query "name" --output tsv >/dev/null 2>&1 || ! echo_warn "[vnet-append] Error: To use this plugin, vnet $vnetname must already exists in $resgrp." || exit 1
    vmname="${vmname}_ex$(head -c3 /dev/urandom | base64 -w0 | tr -d =/+)"

    vnet_create_xtra_arg+=(--wrong-plugin-usage please_include_vnet-append_before_secured)
    explicit_vnet_create=0
}
