constructor()

in source/custom-resources/lib/sns/sns.js [26:48]


  constructor(event, context) {
    super(event, context);
    const {
      ResourceProperties = {},
    } = event || {};
    /* sanity check */
    const missing = REQUIRED_PROPERTIES.filter(x =>
      ResourceProperties[x] === undefined);

    if (missing.length) {
      throw new Error(`event.ResourceProperties missing ${missing.join(', ')}`);
    }

    const {
      TopicArn,
      EmailList,
    } = ResourceProperties;
    /* create unique email list */
    const list = EmailList.split(',').filter(x => x).map(x => x.trim());
    this.$emailList = Array.from(new Set(list));
    /* topic to subscribe */
    this.$topicArn = TopicArn;
  }