Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 1x 4x 4x 4x 4x 4x 4x 4x 3x 2x 1x 1x 1x 1x 1x 1x 4x 4x 4x | import { Handler } from "aws-lambda"; import { send, SUCCESS, FAILED } from "cfn-response-async"; type ResponseStatus = typeof SUCCESS | typeof FAILED; import * as os from "./../libs/opensearch-lib"; export const handler: Handler = async (event, context, callback) => { console.log("request:", JSON.stringify(event, undefined, 2)); const responseData: any = {}; let responseStatus: ResponseStatus = SUCCESS; const response = { statusCode: 200, }; let errorResponse = null; try { if (event.RequestType == "Create" || event.RequestType == "Update") { const reply = await os.mapRole( event.ResourceProperties.OsDomain, event.ResourceProperties.MasterRoleToAssume, event.ResourceProperties.OsRoleName, event.ResourceProperties.IamRoleName, ); console.log(reply); E} else if (event.RequestType == "Delete") { console.log("This resource does nothing on delete"); } } catch (error) { console.log(error); responseStatus = FAILED; response.statusCode = 500; errorResponse = error; } try { await send(event, context, responseStatus, responseData, "static"); } catch (error) { response.statusCode = 500; errorResponse = error; } finally { callback(errorResponse, response); } }; |