Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

Commit

Permalink
Minor formatting fixes for Increase/DecreaseStreamRetentionPeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
mhart committed Jan 5, 2016
1 parent 3e38b50 commit 8b976e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions actions/decreaseStreamRetentionPeriod.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ module.exports = function decreaseStreamRetentionPeriod(store, data, cb) {
store.getStream(data.StreamName, function(err, stream) {
if (err) return cb(err)

if(data.RetentionPeriodHours < 24) {
if (data.RetentionPeriodHours < 24) {
return cb(db.clientError('InvalidArgumentException',
'Minimum allowed retention period is 24 hours. Requested retention period (' + data.RetentionPeriodHours +
' hours) is too short.'))
}

if(data.RetentionPeriodHours > 168) {
if (data.RetentionPeriodHours > 168) {
return cb(db.clientError('InvalidArgumentException',
'Maximum allowed retention period is 168 hours. Requested retention period (' + data.RetentionPeriodHours +
' hours) is too long.'))
}

if(stream.RetentionPeriodHours < data.RetentionPeriodHours) {
if (stream.RetentionPeriodHours < data.RetentionPeriodHours) {
return cb(db.clientError('InvalidArgumentException',
'Requested retention period (' + data.RetentionPeriodHours +
' hours) for stream ' + data.StreamName +
' can not be longer than existing retention period (' + stream.RetentionPeriodHours +
' hours). Use IncreaseRetentionPeriod API.'))
}

stream.RetentionPeriodHours = data.RetentionPeriodHours;
stream.RetentionPeriodHours = data.RetentionPeriodHours

metaDb.put(data.StreamName, stream, function(err) {
if (err) return cb(err)
Expand Down
6 changes: 3 additions & 3 deletions actions/increaseStreamRetentionPeriod.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ module.exports = function increaseStreamRetentionPeriod(store, data, cb) {
store.getStream(data.StreamName, function(err, stream) {
if (err) return cb(err)

if(data.RetentionPeriodHours < 24) {
if (data.RetentionPeriodHours < 24) {
return cb(db.clientError('InvalidArgumentException',
'Minimum allowed retention period is 24 hours. Requested retention period (' + data.RetentionPeriodHours +
' hours) is too short.'))
}

if(data.RetentionPeriodHours > 168) {
if (data.RetentionPeriodHours > 168) {
return cb(db.clientError('InvalidArgumentException',
'Maximum allowed retention period is 168 hours. Requested retention period (' + data.RetentionPeriodHours +
' hours) is too long.'))
}

if(stream.RetentionPeriodHours > data.RetentionPeriodHours) {
if (stream.RetentionPeriodHours > data.RetentionPeriodHours) {
return cb(db.clientError('InvalidArgumentException',
'Requested retention period (' + data.RetentionPeriodHours +
' hours) for stream ' + data.StreamName +
Expand Down
8 changes: 4 additions & 4 deletions test/decreaseStreamRetentionPeriod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var helpers = require('./helpers')

require('should');
require('should')

var target = 'DecreaseStreamRetentionPeriod',
request = helpers.request,
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('decreaseStreamRetentionPeriod', function() {

it('should return ResourceNotFoundException if stream does not exist', function(done) {
var name1 = randomName()
assertNotFound({StreamName: name1, RetentionPeriodHours: 25 },
assertNotFound({StreamName: name1, RetentionPeriodHours: 25},
'Stream ' + name1 + ' under account ' + helpers.awsAccountId + ' not found.', done)
})
})
Expand All @@ -85,7 +85,7 @@ describe('decreaseStreamRetentionPeriod', function() {
var hours = 24
request(opts({
StreamName: helpers.testStream,
RetentionPeriodHours: hours
RetentionPeriodHours: hours,
}), function(err, res) {
if (err) return done(err)
res.statusCode.should.equal(200)
Expand All @@ -98,7 +98,7 @@ describe('decreaseStreamRetentionPeriod', function() {

res.body.StreamDescription.RetentionPeriodHours.should.eql(hours)

done();
done()
})
})
})
Expand Down
6 changes: 3 additions & 3 deletions test/increaseStreamRetentionPeriod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var helpers = require('./helpers')

require('should');
require('should')

var target = 'IncreaseStreamRetentionPeriod',
request = helpers.request,
Expand Down Expand Up @@ -75,7 +75,7 @@ describe('increaseStreamRetentionPeriod', function() {

it('should return ResourceNotFoundException if stream does not exist', function(done) {
var name1 = randomName()
assertNotFound({StreamName: name1, RetentionPeriodHours: 25 },
assertNotFound({StreamName: name1, RetentionPeriodHours: 25},
'Stream ' + name1 + ' under account ' + helpers.awsAccountId + ' not found.', done)
})
})
Expand All @@ -99,7 +99,7 @@ describe('increaseStreamRetentionPeriod', function() {

res.body.StreamDescription.RetentionPeriodHours.should.eql(hours)

done();
done()
})
})
})
Expand Down

0 comments on commit 8b976e0

Please sign in to comment.