File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ const compileKinesisServiceProxy = require('./package/kinesis/compileKinesisServ
19
19
// SQS
20
20
const compileMethodsToSqs = require ( './package/sqs/compileMethodsToSqs' )
21
21
const compileIamRoleToSqs = require ( './package/sqs/compileIamRoleToSqs' )
22
- // const validateKinesisServiceProxy = require('./package/sqs/validateKinesisServiceProxy ')
22
+ const validateSqsServiceProxy = require ( './package/sqs/validateSqsServiceProxy ' )
23
23
const compileSqsServiceProxy = require ( './package/sqs/compileSqsServiceProxy' )
24
24
25
25
class ServerlessApigatewayServiceProxy {
@@ -44,6 +44,7 @@ class ServerlessApigatewayServiceProxy {
44
44
compileMethodsToSqs ,
45
45
compileIamRoleToSqs ,
46
46
compileSqsServiceProxy ,
47
+ validateSqsServiceProxy ,
47
48
getStackInfo ,
48
49
validate ,
49
50
methods ,
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
module . exports = {
3
3
async compileSqsServiceProxy ( ) {
4
- // await this.validateKinesisServiceProxy ()
4
+ await this . validateSqsServiceProxy ( )
5
5
await this . compileIamRoleToSqs ( )
6
6
await this . compileMethodsToSqs ( )
7
7
}
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const BbPromise = require ( 'bluebird' )
4
+ const _ = require ( 'lodash' )
5
+
6
+ module . exports = {
7
+ async validateSqsServiceProxy ( ) {
8
+ await BbPromise . all (
9
+ this . validated . events . map ( async ( serviceProxy ) => {
10
+ if ( serviceProxy . functionName == 'sqs' ) {
11
+ if ( ! _ . has ( serviceProxy . http , 'queueName' ) ) {
12
+ return BbPromise . reject (
13
+ new this . serverless . classes . Error ( 'Missing "queueName" property in SQS Service Proxy' )
14
+ )
15
+ }
16
+
17
+ if (
18
+ typeof serviceProxy . http . queueName != 'object' &&
19
+ typeof serviceProxy . http . queueName != 'string'
20
+ ) {
21
+ const errorMessage = [
22
+ 'You can only set "string" or the AWS "Fn::GetAtt" intrinsic function' ,
23
+ ' like { Fn::GetAtt: [ "SQSQueueResourceId", "QueueName" ] }}' ,
24
+ ' as a queueName property'
25
+ ] . join ( '' )
26
+ return BbPromise . reject ( new this . serverless . classes . Error ( errorMessage ) )
27
+ }
28
+
29
+ if (
30
+ typeof serviceProxy . http . queueName == 'object' &&
31
+ ! _ . has ( serviceProxy . http . queueName , 'Fn::GetAtt' )
32
+ ) {
33
+ const errorMessage = [
34
+ 'You can only set "string" or the AWS "Fn::GetAtt" intrinsic function' ,
35
+ ' like { Fn::GetAtt: [ "SQSQueueResourceId", "QueueName" ] }}' ,
36
+ ' as a queueName property'
37
+ ] . join ( '' )
38
+ return BbPromise . reject ( new this . serverless . classes . Error ( errorMessage ) )
39
+ }
40
+ }
41
+ } )
42
+ )
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments