Skip to content

Commit f7433bc

Browse files
committed
refactor(iamUser/Role/Policy): Change name of promise resolution clbk
1 parent 9c7bd36 commit f7433bc

3 files changed

Lines changed: 27 additions & 27 deletions

File tree

src/services/iamPolicy/data.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const tagsByPolicyArn = async (
4747
iam: IAM,
4848
{ Arn }: Policy
4949
): Promise<{ Arn: string; Tags: TagMap }> =>
50-
new Promise(resolveUserPolicies => {
50+
new Promise(resolve => {
5151
iam.listPolicyTags(
5252
{ PolicyArn: Arn },
5353
(err: AWSError, data: ListPolicyTagsResponse) => {
@@ -60,13 +60,13 @@ const tagsByPolicyArn = async (
6060

6161
if (!isEmpty(data)) {
6262
const { Tags: tags = [] } = data
63-
resolveUserPolicies({
63+
resolve({
6464
Arn,
6565
Tags: convertAwsTagsToTagMap(tags),
6666
})
6767
}
6868

69-
resolveUserPolicies(null)
69+
resolve(null)
7070
}
7171
)
7272
})
@@ -75,7 +75,7 @@ const policyVersionByPolicyArn = async (
7575
iam: IAM,
7676
{ Arn, DefaultVersionId }: Policy
7777
): Promise<{ Arn: string; Content: string }> =>
78-
new Promise(resolveUserPolicies => {
78+
new Promise(resolve => {
7979
iam.getPolicyVersion(
8080
{ PolicyArn: Arn, VersionId: DefaultVersionId },
8181
(err: AWSError, data: GetPolicyVersionResponse) => {
@@ -88,13 +88,13 @@ const policyVersionByPolicyArn = async (
8888

8989
if (!isEmpty(data)) {
9090
const { PolicyVersion = { Document: '' } } = data
91-
resolveUserPolicies({
91+
resolve({
9292
Arn,
9393
Content: decodeURIComponent(PolicyVersion.Document),
9494
})
9595
}
9696

97-
resolveUserPolicies(null)
97+
resolve(null)
9898
}
9999
)
100100
})

src/services/iamRole/data.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const tagsByRoleName = async (
7676
iam: IAM,
7777
{ RoleName }: Role
7878
): Promise<{ RoleName: string; Tags: TagMap }> =>
79-
new Promise(resolveUserPolicies => {
79+
new Promise(resolve => {
8080
iam.listRoleTags(
8181
{ RoleName },
8282
(err: AWSError, data: ListRoleTagsResponse) => {
@@ -90,13 +90,13 @@ const tagsByRoleName = async (
9090
if (!isEmpty(data)) {
9191
const { Tags: tags = [] } = data
9292

93-
resolveUserPolicies({
93+
resolve({
9494
RoleName,
9595
Tags: convertAwsTagsToTagMap(tags),
9696
})
9797
}
9898

99-
resolveUserPolicies(null)
99+
resolve(null)
100100
}
101101
)
102102
})
@@ -105,7 +105,7 @@ const policiesByRoleName = async (
105105
iam: IAM,
106106
{ RoleName }: Role
107107
): Promise<{ RoleName: string; Policies: string[] }> =>
108-
new Promise(resolveUserPolicies => {
108+
new Promise(resolve => {
109109
iam.listRolePolicies(
110110
{ RoleName },
111111
(err: AWSError, data: ListRolePoliciesResponse) => {
@@ -119,10 +119,10 @@ const policiesByRoleName = async (
119119
if (!isEmpty(data)) {
120120
const { PolicyNames = [] } = data
121121

122-
resolveUserPolicies({ RoleName, Policies: PolicyNames })
122+
resolve({ RoleName, Policies: PolicyNames })
123123
}
124124

125-
resolveUserPolicies(null)
125+
resolve(null)
126126
}
127127
)
128128
})
@@ -131,7 +131,7 @@ const managedPoliciesByRoleName = async (
131131
iam: IAM,
132132
{ RoleName }: Role
133133
): Promise<{ RoleName: string; ManagedPolicies: AttachedPolicy[] }> =>
134-
new Promise(resolveUserPolicies => {
134+
new Promise(resolve => {
135135
iam.listAttachedRolePolicies(
136136
{ RoleName },
137137
(err: AWSError, data: ListAttachedRolePoliciesResponse) => {
@@ -145,13 +145,13 @@ const managedPoliciesByRoleName = async (
145145
if (!isEmpty(data)) {
146146
const { AttachedPolicies = [] } = data
147147

148-
resolveUserPolicies({
148+
resolve({
149149
RoleName,
150150
ManagedPolicies: AttachedPolicies,
151151
})
152152
}
153153

154-
resolveUserPolicies(null)
154+
resolve(null)
155155
}
156156
)
157157
})

src/services/iamUser/data.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const tagsByUsername = async (
9191
iam: IAM,
9292
{ UserName }: User
9393
): Promise<{ UserName: string; Tags: TagMap }> =>
94-
new Promise(resolveUserPolicies => {
94+
new Promise(resolve => {
9595
iam.listUserTags(
9696
{ UserName },
9797
(err: AWSError, data: ListUserTagsResponse) => {
@@ -105,10 +105,10 @@ const tagsByUsername = async (
105105
if (!isEmpty(data)) {
106106
const { Tags: tags = [] } = data
107107

108-
resolveUserPolicies({ UserName, Tags: convertAwsTagsToTagMap(tags) })
108+
resolve({ UserName, Tags: convertAwsTagsToTagMap(tags) })
109109
}
110110

111-
resolveUserPolicies(null)
111+
resolve(null)
112112
}
113113
)
114114
})
@@ -117,7 +117,7 @@ const groupsByUsername = async (
117117
iam: IAM,
118118
{ UserName }: User
119119
): Promise<{ UserName: string; Groups: string[] }> =>
120-
new Promise(resolveUserGroups => {
120+
new Promise(resolve => {
121121
iam.listGroupsForUser(
122122
{ UserName },
123123
(err: AWSError, data: ListGroupsForUserResponse) => {
@@ -133,10 +133,10 @@ const groupsByUsername = async (
133133

134134
const userGroups = Groups.map(({ GroupId }) => GroupId)
135135

136-
resolveUserGroups({ UserName, Groups: userGroups })
136+
resolve({ UserName, Groups: userGroups })
137137
}
138138

139-
resolveUserGroups(null)
139+
resolve(null)
140140
}
141141
)
142142
})
@@ -145,7 +145,7 @@ const policiesByUsername = async (
145145
iam: IAM,
146146
{ UserName }: User
147147
): Promise<{ UserName: string; Policies: string[] }> =>
148-
new Promise(resolveUserPolicies => {
148+
new Promise(resolve => {
149149
iam.listUserPolicies(
150150
{ UserName },
151151
(err: AWSError, data: ListUserPoliciesResponse) => {
@@ -159,10 +159,10 @@ const policiesByUsername = async (
159159
if (!isEmpty(data)) {
160160
const { PolicyNames = [] } = data
161161

162-
resolveUserPolicies({ UserName, Policies: PolicyNames })
162+
resolve({ UserName, Policies: PolicyNames })
163163
}
164164

165-
resolveUserPolicies(null)
165+
resolve(null)
166166
}
167167
)
168168
})
@@ -171,7 +171,7 @@ const managedPoliciesByUsername = async (
171171
iam: IAM,
172172
{ UserName }: User
173173
): Promise<{ UserName: string; ManagedPolicies: AttachedPolicy[] }> =>
174-
new Promise(resolveUserPolicies => {
174+
new Promise(resolve => {
175175
iam.listAttachedUserPolicies(
176176
{ UserName },
177177
(err: AWSError, data: ListAttachedUserPoliciesResponse) => {
@@ -185,13 +185,13 @@ const managedPoliciesByUsername = async (
185185
if (!isEmpty(data)) {
186186
const { AttachedPolicies = [] } = data
187187

188-
resolveUserPolicies({
188+
resolve({
189189
UserName,
190190
ManagedPolicies: AttachedPolicies,
191191
})
192192
}
193193

194-
resolveUserPolicies(null)
194+
resolve(null)
195195
}
196196
)
197197
})

0 commit comments

Comments
 (0)