Update vps_manager.sh

This commit is contained in:
Lsmoisu 2025-05-18 17:08:20 +08:00 committed by GitHub
parent 0a2d167926
commit 8a00a37627
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,10 +20,11 @@ show_menu() {
echo "13. 配置防火墙"
echo "14. 查看防火墙规则"
echo "15. 删除防火墙规则"
echo "16. 查看所有可用的结算账号"
echo "0. 退出脚本"
echo "====================================="
echo "请输入选项0-13"
echo "请输入选项0-16"
}
# 获取当前日期,格式为 YYYYMMDD
@ -440,6 +441,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
2)
echo "正在删除账号..."
account_data=$(get_account_list)
@ -526,6 +540,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
3)
echo "正在查看所有账号..."
account_data=$(get_account_list)
@ -538,6 +565,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
4)
echo "正在切换默认账号..."
account_data=$(get_account_list)
@ -576,6 +616,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
5)
echo "正在添加项目 (并关联结算账号)..."
echo "请输入项目 ID6-30 个字符,小写字母开头,可包含小写字母、数字或连字符,例如 my-project-123"
@ -712,6 +765,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
6)
echo "正在删除项目..."
project_data=$(get_project_list)
@ -798,6 +864,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
7)
echo "正在查看所有项目..."
project_data=$(get_project_list)
@ -810,6 +889,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
8)
echo "正在切换默认项目..."
project_data=$(get_project_list)
@ -848,6 +940,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
9)
echo "正在查看虚拟机列表..."
current_project=$(gcloud config get-value project)
@ -868,6 +973,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
10)
echo "正在创建虚拟机..."
current_project=$(gcloud config get-value project)
@ -1182,6 +1300,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
11)
echo "正在删除虚拟机..."
current_project=$(gcloud config get-value project)
@ -1287,6 +1418,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
12)
echo "正在查看当前项目下所有实例的 socks5 配置..."
current_project=$(gcloud config get-value project)
@ -1388,6 +1532,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
13)
echo "正在配置防火墙规则..."
current_project=$(gcloud config get-value project)
@ -1592,6 +1749,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
15)
echo "正在准备删除防火墙规则..."
current_project=$(gcloud config get-value project)
@ -1644,6 +1814,19 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
0)
echo "退出脚本..."
@ -1654,5 +1837,18 @@ while true; do
echo "按任意键返回菜单..."
read -e -r -n 1
;;
16)
echo "正在查看所有可用的结算账号..."
if get_billing_accounts; then
echo "可用的结算账号列表:"
for item in "${billing_account_array_display[@]}"; do
echo "$item"
done
else
echo "无法获取结算账号列表。"
fi
echo "按任意键返回菜单..."
read -e -r -n 1
;;
esac
done