-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for service account impersonation (#192)
This is a port of GoogleCloudPlatform/cloud-sql-proxy#1460.
- Loading branch information
Showing
9 changed files
with
140 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,7 @@ export ALLOYDB_PASS="postgres-password" | |
export ALLOYDB_DB="postgres-db-name" | ||
|
||
export GOOGLE_APPLICATION_CREDENTIALS="path/to/credentials" | ||
|
||
# Requires the impersonating IAM principal to have | ||
# roles/iam.serviceAccountTokenCreator | ||
export IMPERSONATED_USER="[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,6 +221,19 @@ func TestNewCommandArguments(t *testing.T) { | |
CredentialsJSON: `{"json":"goes-here"}`, | ||
}), | ||
}, | ||
{ | ||
desc: "", | ||
args: []string{"--impersonate-service-account", | ||
"[email protected],[email protected],[email protected]", | ||
"projects/proj/locations/region/clusters/clust/instances/inst"}, | ||
want: withDefaults(&proxy.Config{ | ||
ImpersonateTarget: "[email protected]", | ||
ImpersonateDelegates: []string{ | ||
"[email protected]", | ||
"[email protected]", | ||
}, | ||
}), | ||
}, | ||
} | ||
|
||
for _, tc := range tcs { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters