| 32 | ]; |
| 33 | |
| 34 | function evalAuthInfo(authInfo, canonicalID, action) { |
| 35 | let accountId = authInfo.getCanonicalID(); |
| 36 | let userId = authInfo.isRequesterAnIAMUser() ? |
| 37 | authInfo.getShortid() : undefined; |
| 38 | // If action impacts 'numberOfObjectsStored' or 'storageUtilized' metric |
| 39 | // only the bucket owner account's metrics should be updated |
| 40 | const canonicalIdMatch = authInfo.getCanonicalID() === canonicalID; |
| 41 | if (bucketOwnerMetrics.includes(action) && !canonicalIdMatch) { |
| 42 | accountId = canonicalID; |
| 43 | userId = undefined; |
| 44 | } |
| 45 | return { |
| 46 | accountId, |
| 47 | userId, |
| 48 | }; |
| 49 | } |
| 50 | |
| 51 | function _listMetrics(host, |
| 52 | port, |