Skip to content

Commit 11368ae

Browse files
committed
feat(members): add utils for retrieving team members
1 parent d432024 commit 11368ae

12 files changed

+362
-229
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,19 @@ The command line modes and parameters map directly to the functions exposed for
8383
| toggleFeatureFlag | projectKey, featureFlagKey, environmentKeyQuery, enabled |
8484
| migrateFeatureFlag | projectKey, featureFlagKey, fromEnv, toEnv, includeState |
8585

86-
> migrateFeatureFlag mode is used to copy flag attributes between environments. This covers: targets, rules, fallthrough, offVariation, prerequisites and optionally the flag on/off state.
86+
- `migrateFeatureFlag` mode is used to copy flag attributes between environments. This covers: targets, rules, fallthrough, offVariation, prerequisites and optionally the flag on/off state. eg. to migrate a flag from dev to test env.
87+
88+
```
89+
ldutils migrateFeatureFlag my-project my-flag dev test
90+
```
8791

8892
### Custom roles
8993

9094
| Mode | parameters |
9195
| ---- | ---------- |
9296
| getCustomRoles | none |
9397
| getCustomRole | customRoleKey |
98+
| getCustomRoleById | customRoleId |
9499
| createCustomRole | customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription(optional) |
95100
| updateCustomRole | customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription(optional) |
96101
| upsertCustomRole | customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription(optional) |
@@ -102,6 +107,15 @@ The command line modes and parameters map directly to the functions exposed for
102107

103108
```
104109
ldutils bulkUpsertCustomRoles ./exampleRoleBulkLoad.json
110+
ldutils bulkUpsertCustomRoleFolder ./companyRoles
105111
```
106112

107-
For details on role policy object structures, please see: https://docs.launchdarkly.com/docs/custom-roles
113+
For details on role policy object structures, please see: https://docs.launchdarkly.com/docs/custom-roles
114+
115+
### Team members
116+
117+
| Mode | parameters |
118+
| ---- | ---------- |
119+
| getTeamMembers | none |
120+
| getTeamMember | memberId |
121+
| getTeamMemberByEmail | emailAddress |

ldutils

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ new LaunchDarklyUtils().create(process.env.LAUNCHDARKLY_API_TOKEN, log).then(fun
8888
});
8989
});
9090

91+
program
92+
.command('getCustomRoleById <customRoleId>')
93+
.description('get custom role by id')
94+
.action(function(customRoleId) {
95+
ldUtils.roles.getCustomRoleById(customRoleId).then(function(response) {
96+
console.log(json.plain(response));
97+
});
98+
});
99+
91100
program
92101
.command(`createCustomRole <customRoleKey> <customRoleName> <customRolePolicyArray> [customRoleDescription]`)
93102
.description('create custom role')
@@ -136,6 +145,33 @@ new LaunchDarklyUtils().create(process.env.LAUNCHDARKLY_API_TOKEN, log).then(fun
136145
});
137146
});
138147

148+
program
149+
.command('getTeamMembers')
150+
.description('list all team members in account')
151+
.action(function() {
152+
ldUtils.members.getTeamMembers().then(function(response) {
153+
console.log(json.plain(response));
154+
});
155+
});
156+
157+
program
158+
.command('getTeamMember <memberId>')
159+
.description('list all team members in account')
160+
.action(function(memberId) {
161+
ldUtils.members.getTeamMember(memberId).then(function(response) {
162+
console.log(json.plain(response));
163+
});
164+
});
165+
166+
program
167+
.command('getTeamMemberByEmail <emailAddress>')
168+
.description('list all team members in account')
169+
.action(function(emailAddress) {
170+
ldUtils.members.getTeamMemberByEmail(emailAddress).then(function(response) {
171+
console.log(json.plain(response));
172+
});
173+
});
174+
139175
if (process.argv.length < 3) {
140176
program.help();
141177
process.exit(1);

0 commit comments

Comments
 (0)