Skip to content

Commit c34c0fd

Browse files
author
toshke
committed
treat skip update as string
1 parent 532b95e commit c34c0fd

File tree

2 files changed

+81
-81
lines changed

2 files changed

+81
-81
lines changed

cognito-user-pool-client/index.js

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -4,96 +4,96 @@
44
**/
55

66
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+
});
1111

1212
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+
}),
2828

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({
3069
api: CognitoApi,
31-
method: 'updateUserPoolClient',
70+
method: 'describeUserPoolClient',
3271
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'
3776
],
3877
physicalIdAs: 'ClientId',
3978
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+
]
8282
}),
8383

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+
};
9191

9292
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']
9999
});

cognito-user-pool-client/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"type":"string"
5252
},
5353
"SkipUpdate":{
54-
"type":"boolean"
54+
"type":"string"
5555
}
5656
}
5757
}

0 commit comments

Comments
 (0)