async create()

in provider-utils/awscloudformation/cloudformation-templates/livestream-helpers/LambdaFunctions/psdemo-js-live-workflow_v0.4.0/lib/flagfish.js [488:539]


  async create() {
    let response;
    /* First, create security group */
    response = await this.createInputSecurityGroup(this.inputSecurityGroup);
    const {
      SecurityGroup: { Id: securityGroupId },
    } = response;
    this.storeResponseData('InputSecurityGroupId', securityGroupId);

    /* Next, create input */
    response = await this.createInput(securityGroupId);
    const {
      Input: {
        Id: InputId,
        Name: InputName,
        Type: InputType,
        Destinations,
      },
    } = response;
    this.storeResponseData('InputId', InputId);
    this.storeResponseData('InputName', InputName);
    this.storeResponseData('InputType', InputType);
    if (this.ingestType === "MP4_FILE") {
      this.storeResponseData('PrimaryIngestUrl', this.mp4URL);
      this.storeResponseData('BackupIngestUrl', this.mp4URL);
    } else { 
      this.storeResponseData('PrimaryIngestUrl', Destinations[0].Url);
      this.storeResponseData('BackupIngestUrl', Destinations[1].Url);
    }

    /* Next, create channel */
    response = await this.createChannel(InputId);
    const {
      Channel: {
        Id: ChannelId,
        Name: ChannelName,
      },
    } = response;
    this.storeResponseData('ChannelId', ChannelId);
    this.storeResponseData('ChannelName', ChannelName);
    if (this.primaryMediaStoreEgressUrl) {
      this.storeResponseData('PrimaryMediaStoreEgressUrl', this.primaryMediaStoreEgressUrl);
    }
    if (this.backupMediaStoreEgressUrl) {
      this.storeResponseData('BackupMediaStoreEgressUrl', this.backupMediaStoreEgressUrl);
    }
    /* At last, start the channel */
    await this.startChannel(ChannelId);

    console.log(JSON.stringify(this.responseData, null, 2));
    return this.responseData;
  }