Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions lib/src/wso2/wso2-api/handler/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ describe('wso2 custom resource lambda', () => {
return {
...commonEvt,
RequestType: 'Create',
ResourceProperties: { ...baseProperties, ServiceToken: 'arn:somelambdatest' },
ResourceProperties: {
...baseProperties,
ServiceToken: 'arn:somelambdatest',
disableDeployment: 'false',
},
};
};
const testCFNEventDelete = (
Expand All @@ -530,7 +534,11 @@ describe('wso2 custom resource lambda', () => {
return {
...commonEvt,
RequestType: 'Delete',
ResourceProperties: { ...baseProperties, ServiceToken: 'arn:somelambdatest' },
ResourceProperties: {
...baseProperties,
ServiceToken: 'arn:somelambdatest',
disableDeployment: 'false',
},
PhysicalResourceId,
};
};
Expand All @@ -542,7 +550,11 @@ describe('wso2 custom resource lambda', () => {
return {
...commonEvt,
RequestType: 'Update',
ResourceProperties: { ...baseProperties, ServiceToken: 'arn:somelambdatest' },
ResourceProperties: {
...baseProperties,
ServiceToken: 'arn:somelambdatest',
disableDeployment: 'false',
},
PhysicalResourceId,
OldResourceProperties: oldResourceProperties,
};
Expand Down
10 changes: 9 additions & 1 deletion lib/src/wso2/wso2-api/handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import {
} from './wso2-v1';

export type Wso2ApiCustomResourceEvent = CdkCustomResourceEvent & {
ResourceProperties: Wso2ApiCustomResourceProperties;
ResourceProperties: Omit<Wso2ApiCustomResourceProperties, 'disableDeployment'> & {
disableDeployment: 'false' | 'true';
};
};

export type Wso2ApiCustomResourceResponse = CdkCustomResourceResponse & {
Expand Down Expand Up @@ -47,6 +49,12 @@ export const handler = async (
LogicalResourceId: event.LogicalResourceId,
};

if (event.ResourceProperties.disableDeployment === 'true') {
console.log(`>>> WSO2 API deployment disabled...`);
response.Status = 'SUCCESS';
return response;
}

try {
console.log('>>> Prepare WSO2 API client...');
const wso2Axios = await prepareAxiosForWso2Calls(event.ResourceProperties.wso2Config);
Expand Down
4 changes: 4 additions & 0 deletions lib/src/wso2/wso2-api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ export type Wso2ApiProps = Wso2BaseProperties & {
* as the workflow might take a long time to complete.
*/
lifecycleStatus?: 'CREATED' | 'PUBLISHED' | 'DEPRECATED' | 'BLOCKED' | 'RETIRED' | 'PROTOTYPED';
/**
* Flag to either enable or disable deployment for the WSO2 API.
*/
disableDeployment?: boolean;
};
1 change: 1 addition & 0 deletions lib/src/wso2/wso2-api/wso2-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class Wso2Api extends Construct {
openapiDocument: props.openapiDocument,
retryOptions: props.retryOptions,
lifecycleStatus: props.lifecycleStatus,
disableDeployment: props.disableDeployment ?? false,
} satisfies Wso2ApiCustomResourceProperties,
resourceType: 'Custom::Wso2Api',
removalPolicy: props.removalPolicy ?? RemovalPolicy.RETAIN,
Expand Down
Loading