MCPcopy Index your code
hub / github.com/scality/cloudserver / deleteServiceUser

Function deleteServiceUser

tests/functional/scripts/ensureServiceUser.js:65–99  ·  view source on GitHub ↗
(userName)

Source from the content-addressed store, hash-verified

63// the cleanup runs whatever state the test left behind, so every
64// deletion has to tolerate resources that were never created
65async function deleteServiceUser(userName) {
66 const keys = await ignoreNoSuchEntity(
67 iamClient.send(
68 new ListAccessKeysCommand({
69 UserName: userName,
70 MaxItems: 100,
71 }),
72 ),
73 );
74 for (const key of keys ? keys.AccessKeyMetadata : []) {
75 await ignoreNoSuchEntity(
76 iamClient.send(
77 new DeleteAccessKeyCommand({
78 UserName: userName,
79 AccessKeyId: key.AccessKeyId,
80 }),
81 ),
82 );
83 }
84 await ignoreNoSuchEntity(
85 iamClient.send(
86 new DeleteUserPolicyCommand({
87 UserName: userName,
88 PolicyName: userName,
89 }),
90 ),
91 );
92 await ignoreNoSuchEntity(
93 iamClient.send(
94 new DeleteUserCommand({
95 UserName: userName,
96 }),
97 ),
98 );
99}
100
101describe('ensureServiceUser script', () => {
102 let userName;

Callers 1

Calls 2

ignoreNoSuchEntityFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected