@gradientedge/cdk-utils 8.12.0 → 8.14.0
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.
|
@@ -52,8 +52,10 @@ export declare class ApiManager {
|
|
|
52
52
|
* @param {string[]?} allowedOrigins
|
|
53
53
|
* @param {string[]?} allowedMethods
|
|
54
54
|
* @param {string[]?} allowedHeaders
|
|
55
|
+
* @param {{}?} methodRequestParameters
|
|
56
|
+
* @param {apig.Integration} proxyIntegration
|
|
55
57
|
*/
|
|
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;
|
|
58
|
+
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[], methodRequestParameters?: {}, proxyIntegration?: apig.Integration): apig.Resource;
|
|
57
59
|
/**
|
|
58
60
|
* @summary Method to create an api deployment
|
|
59
61
|
* @param {string} id
|
|
@@ -77,6 +77,7 @@ class ApiManager {
|
|
|
77
77
|
methodOptions: props.deployOptions?.methodOptions,
|
|
78
78
|
loggingLevel: props.deployOptions?.loggingLevel,
|
|
79
79
|
dataTraceEnabled: props.deployOptions?.dataTraceEnabled,
|
|
80
|
+
cachingEnabled: props.deployOptions?.cachingEnabled,
|
|
80
81
|
},
|
|
81
82
|
retainDeployments: props.retainDeployments,
|
|
82
83
|
parameters: props.parameters,
|
|
@@ -127,8 +128,10 @@ class ApiManager {
|
|
|
127
128
|
* @param {string[]?} allowedOrigins
|
|
128
129
|
* @param {string[]?} allowedMethods
|
|
129
130
|
* @param {string[]?} allowedHeaders
|
|
131
|
+
* @param {{}?} methodRequestParameters
|
|
132
|
+
* @param {apig.Integration} proxyIntegration
|
|
130
133
|
*/
|
|
131
|
-
createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders) {
|
|
134
|
+
createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders, methodRequestParameters, proxyIntegration) {
|
|
132
135
|
const methods = allowedMethods ?? apig.Cors.ALL_METHODS;
|
|
133
136
|
const resource = parent.addResource(path, {
|
|
134
137
|
defaultCorsPreflightOptions: {
|
|
@@ -138,7 +141,7 @@ class ApiManager {
|
|
|
138
141
|
allowCredentials: true,
|
|
139
142
|
},
|
|
140
143
|
});
|
|
141
|
-
methods.forEach(method => resource.addMethod(method, integration, { authorizer }));
|
|
144
|
+
methods.forEach(method => resource.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters }));
|
|
142
145
|
utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId);
|
|
143
146
|
if (addProxy) {
|
|
144
147
|
const resourceProxy = resource.addResource(`{${path}+}`, {
|
|
@@ -149,7 +152,10 @@ class ApiManager {
|
|
|
149
152
|
allowCredentials: true,
|
|
150
153
|
},
|
|
151
154
|
});
|
|
152
|
-
methods.forEach(method => resourceProxy.addMethod(method, integration, {
|
|
155
|
+
methods.forEach(method => resourceProxy.addMethod(method, proxyIntegration ?? integration, {
|
|
156
|
+
authorizer,
|
|
157
|
+
requestParameters: methodRequestParameters,
|
|
158
|
+
}));
|
|
153
159
|
utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId);
|
|
154
160
|
}
|
|
155
161
|
return resource;
|
package/package.json
CHANGED
|
@@ -59,6 +59,7 @@ export class ApiManager {
|
|
|
59
59
|
methodOptions: props.deployOptions?.methodOptions,
|
|
60
60
|
loggingLevel: props.deployOptions?.loggingLevel,
|
|
61
61
|
dataTraceEnabled: props.deployOptions?.dataTraceEnabled,
|
|
62
|
+
cachingEnabled: props.deployOptions?.cachingEnabled,
|
|
62
63
|
},
|
|
63
64
|
retainDeployments: props.retainDeployments,
|
|
64
65
|
parameters: props.parameters,
|
|
@@ -115,6 +116,8 @@ export class ApiManager {
|
|
|
115
116
|
* @param {string[]?} allowedOrigins
|
|
116
117
|
* @param {string[]?} allowedMethods
|
|
117
118
|
* @param {string[]?} allowedHeaders
|
|
119
|
+
* @param {{}?} methodRequestParameters
|
|
120
|
+
* @param {apig.Integration} proxyIntegration
|
|
118
121
|
*/
|
|
119
122
|
public createApiResource(
|
|
120
123
|
id: string,
|
|
@@ -126,7 +129,9 @@ export class ApiManager {
|
|
|
126
129
|
authorizer?: apig.IAuthorizer,
|
|
127
130
|
allowedOrigins?: string[],
|
|
128
131
|
allowedMethods?: string[],
|
|
129
|
-
allowedHeaders?: string[]
|
|
132
|
+
allowedHeaders?: string[],
|
|
133
|
+
methodRequestParameters?: {},
|
|
134
|
+
proxyIntegration?: apig.Integration
|
|
130
135
|
) {
|
|
131
136
|
const methods = allowedMethods ?? apig.Cors.ALL_METHODS
|
|
132
137
|
const resource = parent.addResource(path, {
|
|
@@ -137,7 +142,9 @@ export class ApiManager {
|
|
|
137
142
|
allowCredentials: true,
|
|
138
143
|
},
|
|
139
144
|
})
|
|
140
|
-
methods.forEach(method =>
|
|
145
|
+
methods.forEach(method =>
|
|
146
|
+
resource.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters })
|
|
147
|
+
)
|
|
141
148
|
utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId)
|
|
142
149
|
|
|
143
150
|
if (addProxy) {
|
|
@@ -149,7 +156,12 @@ export class ApiManager {
|
|
|
149
156
|
allowCredentials: true,
|
|
150
157
|
},
|
|
151
158
|
})
|
|
152
|
-
methods.forEach(method =>
|
|
159
|
+
methods.forEach(method =>
|
|
160
|
+
resourceProxy.addMethod(method, proxyIntegration ?? integration, {
|
|
161
|
+
authorizer,
|
|
162
|
+
requestParameters: methodRequestParameters,
|
|
163
|
+
})
|
|
164
|
+
)
|
|
153
165
|
utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId)
|
|
154
166
|
}
|
|
155
167
|
|