@@ -2,30 +2,27 @@ const http = require('http');
22const https = require ( 'https' ) ;
33const commander = require ( 'commander' ) ;
44const { auth } = require ( 'arsenal' ) ;
5- // TODO CLDSRV-610 re-enable utapi
6- /* eslint-disable */
7- // const { UtapiClient, utapiVersion } = require('utapi');
5+ const { UtapiClient, utapiVersion } = require ( 'utapi' ) ;
86const logger = require ( '../utilities/logger' ) ;
97const _config = require ( '../Config' ) . config ;
108const { suppressedUtapiEventFields : suppressedEventFields } = require ( '../../constants' ) ;
119// setup utapi client
1210let utapiConfig ;
1311
14- // TODO CLDSRV-610 re-enable utapi
15- // if (utapiVersion === 1 && _config.utapi) {
16- // if (_config.utapi.redis === undefined) {
17- // utapiConfig = Object.assign({}, _config.utapi, { redis: _config.redis });
18- // } else {
19- // utapiConfig = Object.assign({}, _config.utapi);
20- // }
21- // } else if (utapiVersion === 2) {
22- // utapiConfig = Object.assign({
23- // tls: _config.https,
24- // suppressedEventFields,
25- // }, _config.utapi || {});
26- // }
12+ if ( utapiVersion === 1 && _config . utapi ) {
13+ if ( _config . utapi . redis === undefined ) {
14+ utapiConfig = Object . assign ( { } , _config . utapi , { redis : _config . redis } ) ;
15+ } else {
16+ utapiConfig = Object . assign ( { } , _config . utapi ) ;
17+ }
18+ } else if ( utapiVersion === 2 ) {
19+ utapiConfig = Object . assign ( {
20+ tls : _config . https ,
21+ suppressedEventFields,
22+ } , _config . utapi || { } ) ;
23+ }
2724
28- // const utapi = new UtapiClient(utapiConfig);
25+ const utapi = new UtapiClient ( utapiConfig ) ;
2926
3027const bucketOwnerMetrics = [
3128 'completeMultipartUpload' ,
@@ -260,8 +257,6 @@ function listMetrics(metricType) {
260257 * filtered out and not pushed to utapi.
261258 */
262259function pushMetric ( action , log , metricObj ) {
263- // TODO CLDSRV-610 re-enable utapi
264- return ;
265260 const {
266261 bucket,
267262 keys,
@@ -360,8 +355,6 @@ function pushMetric(action, log, metricObj) {
360355 * @return {string } - location unique ID
361356 */
362357function _getLocationId ( location ) {
363- // TODO CLDSRV-610 re-enable utapi
364- return ;
365358 return _config . locationConstraints [ location ] . objectId ;
366359}
367360
@@ -374,8 +367,6 @@ function _getLocationId(location) {
374367 * @return {function } - `utapi.getLocationMetric`
375368 */
376369function getLocationMetric ( location , log , cb ) {
377- // TODO CLDSRV-610 re-enable utapi
378- return ;
379370 const locationId = _getLocationId ( location ) ;
380371 return utapi . getLocationMetric ( locationId , log . getSerializedUids ( ) , cb ) ;
381372}
@@ -390,8 +381,6 @@ function getLocationMetric(location, log, cb) {
390381 * @return {function } - `utapi.pushLocationMetric`
391382 */
392383function pushLocationMetric ( location , byteLength , log , cb ) {
393- // TODO CLDSRV-610 re-enable utapi
394- return ;
395384 const locationId = _getLocationId ( location ) ;
396385 return utapi . pushLocationMetric ( locationId , byteLength ,
397386 log . getSerializedUids ( ) , cb ) ;
0 commit comments