@@ -3,30 +3,33 @@ const CFError = require('cf-errors');
3
3
const cmd = require ( '../base.cmd' ) ;
4
4
const { sdk } = require ( '../../../../../../../logic' ) ;
5
5
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
+ } ;
8
11
if ( token ) {
9
- return { type : 'token' , token, ...mountPoint } ;
12
+ return { type : 'token' , token, ...baseAuth } ;
10
13
}
11
14
12
15
if ( username && password ) {
13
- return { type : 'userpass' , username, password, ...mountPoint } ;
16
+ return { type : 'userpass' , username, password, ...baseAuth } ;
14
17
}
15
18
16
19
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 } ;
18
21
}
19
22
20
23
if ( gcpRole ) {
21
- return { type : 'gcp' , roleType : 'gce' , role : gcpRole , ...mountPoint } ;
24
+ return { type : 'gcp' , roleType : 'gce' , role : gcpRole , ...baseAuth } ;
22
25
}
23
26
24
27
if ( kubernetesRole ) {
25
28
return {
26
29
type : 'kubernetes' ,
27
30
role : kubernetesRole ,
28
31
...( kubernetesJwt && { jwt : kubernetesJwt } ) ,
29
- ...mountPoint ,
32
+ ...baseAuth ,
30
33
} ;
31
34
}
32
35
@@ -61,6 +64,11 @@ const command = new Command({
61
64
describe : 'Path for given auth method. Leave out to use the default path for the type.' ,
62
65
type : 'string' ,
63
66
} )
67
+ . option ( 'namespace' , {
68
+ alias : 'n' ,
69
+ describe : 'Namespace is only valid for Vault Enterprise instances' ,
70
+ type : 'string' ,
71
+ } )
64
72
. option ( 'token' , {
65
73
alias : 't' ,
66
74
describe : 'Token' ,
0 commit comments