async onGET()

in source/checksum/lib/api/index.js [184:229]


  async onGET() {
    const {
      operation,
    } = this.requestPathParameters || {};

    if (operation.toLowerCase() !== APIOP_FIXITY) {
      throw new InvalidArgumentError('invalid path parameter');
    }

    let {
      executionArn,
    } = this.requestQueryString || {};

    if (!executionArn) {
      throw new InvalidArgumentError('missing querystring');
    }
    executionArn = decodeURIComponent(executionArn);

    /* allow shorthand arn */
    if (executionArn.indexOf('arn:aws:states:') < 0) {
      executionArn = `arn:aws:states:${process.env.AWS_REGION}:${this.accountId}:execution:${process.env.ENV_STATE_MACHINE_NAME}:${executionArn}`;
    }

    /* validate input */
    if (!ApiRequest.Constants.Steps.Arn.Regex.test(executionArn)) {
      console.error(`invalid arn: ${executionArn}`);
      throw new InvalidArgumentError('invalid querystring');
    }

    const step = new AWS.StepFunctions({
      apiVersion: '2016-11-23',
      customUserAgent: process.env.ENV_CUSTOM_USER_AGENT,
    });

    const response = await step.describeExecution({
      executionArn,
    }).promise();

    const responseData = {
      statusCode: 200,
      headers: this.getCORS(),
      body: JSON.stringify(response),
    };
    process.env.ENV_QUIET || console.log(`onGET.responseData = ${JSON.stringify(responseData, null, 2)}`);
    return responseData;
  }