Skip to content

Commit

Permalink
fix(lint): Fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-cottone committed Jul 28, 2018
1 parent 911d2df commit 0ef0852
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import _ from 'lodash';

import { formatLogGroup, formatFirehose, formatIamFirehoseRole } from './formatters';
import { formatFirehose, formatIamFirehoseRole, formatLogGroup } from './formatters';

// tslint:disable:no-var-requires
const cloudwatchLogGroupTemplate = require('../templates/cloudwatch-log-group.json');
const cloudwatchLogStreamEsTemplate = require('../templates/cloudwatch-log-stream-es.json');
const cloudwatchLogStreamS3Template = require('../templates/cloudwatch-log-stream-s3.json');
const firehoseTemplate = require('../templates/firehose.json');
const iamCloudwatchTemplate = require('../templates/iam-cloudwatch.json');
const iamFirehoseTemplate = require('../templates/iam-firehose.json');
const s3Template = require('../templates/s3.json');
// tslint:enable:no-var-requires

class ServerlessEsLogsPlugin {
private provider: any;
Expand Down Expand Up @@ -45,12 +47,12 @@ class ServerlessEsLogsPlugin {
const { stage, region } = this.options;
const template = this.serverless.service.provider.compiledCloudFormationTemplate;
const formatOpts = {
service: this.serverless.service.service,
stage,
region,
options: {
...this.custom.esLogs,
},
region,
service: this.serverless.service.service,
stage,
};

// Add cloudwatch subscriptions to existing functions
Expand All @@ -73,8 +75,8 @@ class ServerlessEsLogsPlugin {
...formatOpts,
template: firehoseTemplate,
}));
console.log(JSON.stringify(template, null, 2));

// console.log(JSON.stringify(template, null, 2));
}

private addCloudwatchSubscriptions(): void {
Expand All @@ -87,7 +89,10 @@ class ServerlessEsLogsPlugin {
const logGroupLogicalId = `${normalizedFunctionName}LogGroup`;
const logGroupName = template.Resources[logGroupLogicalId].Properties.LogGroupName;
subscriptionsTemplate[logicalId] = {
Type : 'AWS::Logs::SubscriptionFilter',
DependsOn: [
'ServerlessEsLogsFirehose',
'ServerlessEsLogsCWIAMRole',
],
Properties: {
DestinationArn: {
'Fn::GetAtt': [
Expand All @@ -104,10 +109,7 @@ class ServerlessEsLogsPlugin {
],
},
},
DependsOn: [
'ServerlessEsLogsFirehose',
'ServerlessEsLogsCWIAMRole',
],
Type : 'AWS::Logs::SubscriptionFilter',
};
});
_.merge(template.Resources, subscriptionsTemplate);
Expand Down

0 comments on commit 0ef0852

Please sign in to comment.