Skip to content

Commit

Permalink
add import ssh key for specific project
Browse files Browse the repository at this point in the history
  • Loading branch information
james03160927 committed Dec 20, 2024
1 parent 7b44595 commit 2b8231f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions modules/gcp/oslogin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ func ImportSSHKey(t testing.TestingT, user, key string) {
require.NoErrorf(t, ImportSSHKeyE(t, user, key), "Could not add SSH Key to user %s", user)
}

// ImportSSHKey will import an SSH key to GCP under the provided user identity.
// ImportSSHKeyE will import an SSH key to GCP under the provided user identity.
// The `user` parameter should be the email address of the user.
// The `key` parameter should be the public key of the SSH key being uploaded.
// The `projectID` parameter should be the choosen project ID.
// This will fail the test if there is an error.
func ImportProjectSSHKey(t testing.TestingT, user, key, projectID string) {
require.NoErrorf(t, ImportProjectSSHKeyE(t, user, key, projectID), "Could not add SSH Key to user %s", user)
func ImportSSHKeyE(t testing.TestingT, user, key string) error {
return importProjectSSHKeyE(t, user, key, nil)
}

// ImportSSHKeyE will import an SSH key to GCP under the provided user identity.
// ImportProjectSSHKey will import an SSH key to GCP under the provided user identity.
// The `user` parameter should be the email address of the user.
// The `key` parameter should be the public key of the SSH key being uploaded.
func ImportSSHKeyE(t testing.TestingT, user, key string) error {
return importProjectSSHKeyE(t, user, key, nil)
// The `projectID` parameter should be the chosen project ID.
// This will fail the test if there is an error.
func ImportProjectSSHKey(t testing.TestingT, user, key, projectID string) {
require.NoErrorf(t, ImportProjectSSHKeyE(t, user, key, projectID), "Could not add SSH Key to user %s", user)
}

// ImportProjectSSHKeyE will import an SSH key to GCP under the provided user identity.
// The `user` parameter should be the email address of the user.
// The `key` parameter should be the public key of the SSH key being uploaded.
// The `projectID` parameter should be the choosen project ID.
// The `projectID` parameter should be the chosen project ID.
func ImportProjectSSHKeyE(t testing.TestingT, user, key, projectID string) error {
return importProjectSSHKeyE(t, user, key, &projectID)
}
Expand Down

0 comments on commit 2b8231f

Please sign in to comment.