File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,11 @@ cloudsql_create_superuser() {
38
38
local hostspec=" ${4:-% } "
39
39
40
40
if [[ -z " ${project} " ]] || [[ -z " ${instance} " ]] || [[ -z " ${username} " ]]; then
41
+ echo
42
+ echo " WARNING: This will create a very privileged user."
41
43
echo
42
44
echo " Usage: cloudsql_create_user <project> <instance> <username> [hostspec]"
43
- echo " Default hostspec = %"
45
+ echo " Default: %"
44
46
echo
45
47
fi
46
48
@@ -51,4 +53,25 @@ cloudsql_create_superuser() {
51
53
else
52
54
echo " User creation failed."
53
55
fi
56
+ }
57
+
58
+ cloudsql_delete_user () {
59
+ local project=" ${1} "
60
+ local instance=" ${2} "
61
+ local username=" ${3} "
62
+
63
+ if [[ -z " ${project} " ]] || [[ -z " ${instance} " ]] || [[ -z " ${username} " ]]; then
64
+ echo
65
+ echo " Usage: cloudsql_delete_user <project> <instance> <user>"
66
+ echo
67
+ exit 1
68
+ fi
69
+
70
+ gcloud sql users delete " ${username} " --instance=" ${instance} " --project=" ${project} " --no-user-output-enabled & > /dev/null
71
+
72
+ if [[ $? -eq 0 ]]; then
73
+ echo " User deleted successfully."
74
+ else
75
+ echo " User deletion failed."
76
+ fi
54
77
}
You can’t perform that action at this time.
0 commit comments