|
4 | 4 | **/
|
5 | 5 |
|
6 | 6 | let AWS = require('aws-sdk'),
|
7 |
| - CfnLambda = require('cfn-lambda'), |
8 |
| - CognitoApi = new AWS.CognitoIdentityServiceProvider({ |
9 |
| - apiVersion: '2016-04-18' |
10 |
| - }); |
| 7 | + CfnLambda = require('cfn-lambda'), |
| 8 | + CognitoApi = new AWS.CognitoIdentityServiceProvider({ |
| 9 | + apiVersion: '2016-04-18' |
| 10 | + }); |
11 | 11 |
|
12 | 12 | let logic = {
|
13 |
| - Create: CfnLambda.SDKAlias({ |
14 |
| - api: CognitoApi, |
15 |
| - method: 'createUserPoolClient', |
16 |
| - forceBools: [ |
17 |
| - 'GenerateSecret', |
18 |
| - 'AllowedOAuthFlowsUserPoolClient' |
19 |
| - ], |
20 |
| - returnAttrs: [ |
21 |
| - 'UserPoolClient.ClientId', |
22 |
| - 'UserPoolClient.CreationDate', |
23 |
| - 'UserPoolClient.LastModifiedDate', |
24 |
| - 'UserPoolClient.ClientSecret' |
25 |
| - ], |
26 |
| - returnPhysicalId: 'UserPoolClient.ClientId' |
27 |
| - }), |
| 13 | + Create: CfnLambda.SDKAlias({ |
| 14 | + api: CognitoApi, |
| 15 | + method: 'createUserPoolClient', |
| 16 | + forceBools: [ |
| 17 | + 'GenerateSecret', |
| 18 | + 'AllowedOAuthFlowsUserPoolClient' |
| 19 | + ], |
| 20 | + returnAttrs: [ |
| 21 | + 'UserPoolClient.ClientId', |
| 22 | + 'UserPoolClient.CreationDate', |
| 23 | + 'UserPoolClient.LastModifiedDate', |
| 24 | + 'UserPoolClient.ClientSecret' |
| 25 | + ], |
| 26 | + returnPhysicalId: 'UserPoolClient.ClientId' |
| 27 | + }), |
28 | 28 |
|
29 |
| - DoUpdate: CfnLambda.SDKAlias({ |
| 29 | + DoUpdate: CfnLambda.SDKAlias({ |
| 30 | + api: CognitoApi, |
| 31 | + method: 'updateUserPoolClient', |
| 32 | + returnAttrs: [ |
| 33 | + 'UserPoolClient.ClientId', |
| 34 | + 'UserPoolClient.CreationDate', |
| 35 | + 'UserPoolClient.LastModifiedDate', |
| 36 | + 'UserPoolClient.ClientSecret' |
| 37 | + ], |
| 38 | + physicalIdAs: 'ClientId', |
| 39 | + keys: [ |
| 40 | + 'UserPoolId', |
| 41 | + 'AllowedOAuthFlows', |
| 42 | + 'AllowedOAuthFlowsUserPoolClient', |
| 43 | + 'AllowedOAuthScopes', |
| 44 | + 'CallbackURLs', |
| 45 | + 'ClientName', |
| 46 | + 'DefaultRedirectURI', |
| 47 | + 'ExplicitAuthFlows', |
| 48 | + 'LogoutURLs', |
| 49 | + 'ReadAttributes', |
| 50 | + 'RefreshTokenValidity', |
| 51 | + 'SupportedIdentityProviders', |
| 52 | + 'WriteAttributes', |
| 53 | + 'ClientId' |
| 54 | + ], |
| 55 | + forceBools: [ |
| 56 | + 'AllowedOAuthFlowsUserPoolClient' |
| 57 | + ], |
| 58 | + }), |
| 59 | + |
| 60 | + Delete: CfnLambda.SDKAlias({ |
| 61 | + api: CognitoApi, |
| 62 | + method: 'deleteUserPoolClient', |
| 63 | + keys: ['UserPoolId', 'ClientId'], |
| 64 | + physicalIdAs: 'ClientId' |
| 65 | + }) |
| 66 | +}; |
| 67 | + |
| 68 | +logic.NoUpdate = CfnLambda.SDKAlias({ |
30 | 69 | api: CognitoApi,
|
31 |
| - method: 'updateUserPoolClient', |
| 70 | + method: 'describeUserPoolClient', |
32 | 71 | returnAttrs: [
|
33 |
| - 'UserPoolClient.ClientId', |
34 |
| - 'UserPoolClient.CreationDate', |
35 |
| - 'UserPoolClient.LastModifiedDate', |
36 |
| - 'UserPoolClient.ClientSecret' |
| 72 | + 'UserPoolClient.ClientId', |
| 73 | + 'UserPoolClient.CreationDate', |
| 74 | + 'UserPoolClient.LastModifiedDate', |
| 75 | + 'UserPoolClient.ClientSecret' |
37 | 76 | ],
|
38 | 77 | physicalIdAs: 'ClientId',
|
39 | 78 | keys: [
|
40 |
| - 'UserPoolId', |
41 |
| - 'AllowedOAuthFlows', |
42 |
| - 'AllowedOAuthFlowsUserPoolClient', |
43 |
| - 'AllowedOAuthScopes', |
44 |
| - 'CallbackURLs', |
45 |
| - 'ClientName', |
46 |
| - 'DefaultRedirectURI', |
47 |
| - 'ExplicitAuthFlows', |
48 |
| - 'LogoutURLs', |
49 |
| - 'ReadAttributes', |
50 |
| - 'RefreshTokenValidity', |
51 |
| - 'SupportedIdentityProviders', |
52 |
| - 'WriteAttributes', |
53 |
| - 'ClientId' |
54 |
| - ], |
55 |
| - forceBools: [ |
56 |
| - 'AllowedOAuthFlowsUserPoolClient' |
57 |
| - ], |
58 |
| - }), |
59 |
| - |
60 |
| - Delete: CfnLambda.SDKAlias({ |
61 |
| - api: CognitoApi, |
62 |
| - method: 'deleteUserPoolClient', |
63 |
| - keys: ['UserPoolId','ClientId'], |
64 |
| - physicalIdAs: 'ClientId' |
65 |
| - }) |
66 |
| -}; |
67 |
| - |
68 |
| -logic.NoUpdate = CfnLambda.SDKAlias({ |
69 |
| - api: CognitoApi, |
70 |
| - method: 'describeUserPoolClient', |
71 |
| - returnAttrs: [ |
72 |
| - 'UserPoolClient.ClientId', |
73 |
| - 'UserPoolClient.CreationDate', |
74 |
| - 'UserPoolClient.LastModifiedDate', |
75 |
| - 'UserPoolClient.ClientSecret' |
76 |
| - ], |
77 |
| - physicalIdAs: 'ClientId', |
78 |
| - keys: [ |
79 |
| - 'UserPoolId', |
80 |
| - 'ClientId' |
81 |
| - ] |
| 79 | + 'UserPoolId', |
| 80 | + 'ClientId' |
| 81 | + ] |
82 | 82 | }),
|
83 | 83 |
|
84 |
| -logic.Update = function(physicalId, params, oldParams, callback) { |
85 |
| - if(params.SkipUpdate) { |
86 |
| - return logic.NoUpdate(physicalId, params, callback); |
87 |
| - } else { |
88 |
| - return logic.DoUpdate(physicalId, params, oldParams, callback); |
89 |
| - } |
90 |
| -}; |
| 84 | + logic.Update = function (physicalId, params, oldParams, callback) { |
| 85 | + if (params.SkipUpdate == 'true') { |
| 86 | + return logic.NoUpdate(physicalId, params, callback); |
| 87 | + } else { |
| 88 | + return logic.DoUpdate(physicalId, params, oldParams, callback); |
| 89 | + } |
| 90 | + }; |
91 | 91 |
|
92 | 92 | exports.handler = CfnLambda({
|
93 |
| - Create: logic.Create, |
94 |
| - Update: logic.Update, |
95 |
| - Delete: logic.Delete, |
96 |
| - NoUpdate: logic.NoUpdate, |
97 |
| - TriggersReplacement: ['UserPoolId'], |
98 |
| - SchemaPath: [__dirname, 'schema.json'] |
| 93 | + Create: logic.Create, |
| 94 | + Update: logic.Update, |
| 95 | + Delete: logic.Delete, |
| 96 | + NoUpdate: logic.NoUpdate, |
| 97 | + TriggersReplacement: ['UserPoolId'], |
| 98 | + SchemaPath: [__dirname, 'schema.json'] |
99 | 99 | });
|
0 commit comments