@@ -3,30 +3,33 @@ const CFError = require('cf-errors');
33const cmd = require ( '../base.cmd' ) ;
44const { sdk } = require ( '../../../../../../../logic' ) ;
55
6- function buildAuthObject ( { token, username, password, roleId, secretId, loginPath, gcpRole, kubernetesRole, kubernetesJwt } ) {
7- const mountPoint = loginPath ? { mount_point : loginPath } : { } ;
6+ function buildAuthObject ( { loginPath, namespace, token, username, password, roleId, secretId, gcpRole, kubernetesRole, kubernetesJwt } ) {
7+ const baseAuth = {
8+ ...( loginPath && { mount_point : loginPath } ) ,
9+ ...( namespace && { namespace } ) ,
10+ } ;
811 if ( token ) {
9- return { type : 'token' , token, ...mountPoint } ;
12+ return { type : 'token' , token, ...baseAuth } ;
1013 }
1114
1215 if ( username && password ) {
13- return { type : 'userpass' , username, password, ...mountPoint } ;
16+ return { type : 'userpass' , username, password, ...baseAuth } ;
1417 }
1518
1619 if ( roleId && secretId ) {
17- return { type : 'approle' , role_id : roleId , secret_id : secretId , ...mountPoint } ;
20+ return { type : 'approle' , role_id : roleId , secret_id : secretId , ...baseAuth } ;
1821 }
1922
2023 if ( gcpRole ) {
21- return { type : 'gcp' , roleType : 'gce' , role : gcpRole , ...mountPoint } ;
24+ return { type : 'gcp' , roleType : 'gce' , role : gcpRole , ...baseAuth } ;
2225 }
2326
2427 if ( kubernetesRole ) {
2528 return {
2629 type : 'kubernetes' ,
2730 role : kubernetesRole ,
2831 ...( kubernetesJwt && { jwt : kubernetesJwt } ) ,
29- ...mountPoint ,
32+ ...baseAuth ,
3033 } ;
3134 }
3235
@@ -61,6 +64,11 @@ const command = new Command({
6164 describe : 'Path for given auth method. Leave out to use the default path for the type.' ,
6265 type : 'string' ,
6366 } )
67+ . option ( 'namespace' , {
68+ alias : 'n' ,
69+ describe : 'Namespace is only valid for Vault Enterprise instances' ,
70+ type : 'string' ,
71+ } )
6472 . option ( 'token' , {
6573 alias : 't' ,
6674 describe : 'Token' ,
0 commit comments