@gradientedge/cdk-utils 4.9.1 → 4.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -48,11 +48,12 @@ export declare class ApiManager {
|
|
|
48
48
|
* @param {string} path
|
|
49
49
|
* @param {apig.Integration} integration
|
|
50
50
|
* @param {boolean} addProxy
|
|
51
|
+
* @param {apig.IAuthorizer} authorizer
|
|
51
52
|
* @param {string[]?} allowedOrigins
|
|
52
53
|
* @param {string[]?} allowedMethods
|
|
53
54
|
* @param {string[]?} allowedHeaders
|
|
54
55
|
*/
|
|
55
|
-
createApiResource(id: string, scope: common.CommonConstruct, parent: apig.IResource, path: string, integration: apig.Integration, addProxy: boolean, allowedOrigins?: string[], allowedMethods?: string[], allowedHeaders?: string[]): apig.Resource;
|
|
56
|
+
createApiResource(id: string, scope: common.CommonConstruct, parent: apig.IResource, path: string, integration: apig.Integration, addProxy: boolean, authorizer?: apig.IAuthorizer, allowedOrigins?: string[], allowedMethods?: string[], allowedHeaders?: string[]): apig.Resource;
|
|
56
57
|
/**
|
|
57
58
|
* @summary Method to create an api deployment
|
|
58
59
|
* @param {string} id
|
|
@@ -115,11 +115,12 @@ class ApiManager {
|
|
|
115
115
|
* @param {string} path
|
|
116
116
|
* @param {apig.Integration} integration
|
|
117
117
|
* @param {boolean} addProxy
|
|
118
|
+
* @param {apig.IAuthorizer} authorizer
|
|
118
119
|
* @param {string[]?} allowedOrigins
|
|
119
120
|
* @param {string[]?} allowedMethods
|
|
120
121
|
* @param {string[]?} allowedHeaders
|
|
121
122
|
*/
|
|
122
|
-
createApiResource(id, scope, parent, path, integration, addProxy, allowedOrigins, allowedMethods, allowedHeaders) {
|
|
123
|
+
createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders) {
|
|
123
124
|
const methods = allowedMethods ?? apig.Cors.ALL_METHODS;
|
|
124
125
|
const resource = parent.addResource(path, {
|
|
125
126
|
defaultCorsPreflightOptions: {
|
|
@@ -129,7 +130,7 @@ class ApiManager {
|
|
|
129
130
|
allowCredentials: true,
|
|
130
131
|
},
|
|
131
132
|
});
|
|
132
|
-
methods.forEach(method => resource.addMethod(method, integration));
|
|
133
|
+
methods.forEach(method => resource.addMethod(method, integration, { authorizer }));
|
|
133
134
|
utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId);
|
|
134
135
|
if (addProxy) {
|
|
135
136
|
const resourceProxy = resource.addResource(`{${path}+}`, {
|
|
@@ -140,7 +141,7 @@ class ApiManager {
|
|
|
140
141
|
allowCredentials: true,
|
|
141
142
|
},
|
|
142
143
|
});
|
|
143
|
-
methods.forEach(method => resourceProxy.addMethod(method, integration));
|
|
144
|
+
methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer }));
|
|
144
145
|
utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId);
|
|
145
146
|
}
|
|
146
147
|
return resource;
|
package/package.json
CHANGED
|
@@ -108,6 +108,7 @@ export class ApiManager {
|
|
|
108
108
|
* @param {string} path
|
|
109
109
|
* @param {apig.Integration} integration
|
|
110
110
|
* @param {boolean} addProxy
|
|
111
|
+
* @param {apig.IAuthorizer} authorizer
|
|
111
112
|
* @param {string[]?} allowedOrigins
|
|
112
113
|
* @param {string[]?} allowedMethods
|
|
113
114
|
* @param {string[]?} allowedHeaders
|
|
@@ -119,6 +120,7 @@ export class ApiManager {
|
|
|
119
120
|
path: string,
|
|
120
121
|
integration: apig.Integration,
|
|
121
122
|
addProxy: boolean,
|
|
123
|
+
authorizer?: apig.IAuthorizer,
|
|
122
124
|
allowedOrigins?: string[],
|
|
123
125
|
allowedMethods?: string[],
|
|
124
126
|
allowedHeaders?: string[]
|
|
@@ -132,7 +134,7 @@ export class ApiManager {
|
|
|
132
134
|
allowCredentials: true,
|
|
133
135
|
},
|
|
134
136
|
})
|
|
135
|
-
methods.forEach(method => resource.addMethod(method, integration))
|
|
137
|
+
methods.forEach(method => resource.addMethod(method, integration, { authorizer }))
|
|
136
138
|
utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId)
|
|
137
139
|
|
|
138
140
|
if (addProxy) {
|
|
@@ -144,7 +146,7 @@ export class ApiManager {
|
|
|
144
146
|
allowCredentials: true,
|
|
145
147
|
},
|
|
146
148
|
})
|
|
147
|
-
methods.forEach(method => resourceProxy.addMethod(method, integration))
|
|
149
|
+
methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer }))
|
|
148
150
|
utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId)
|
|
149
151
|
}
|
|
150
152
|
|