lib/plugins/platform/platform.js/Platform/getApigSubscription
class Platform:  getApigSubscription(event, fn) {
    const apiId = this.serverless.service.deployment.apiId;
    const provider = this.data.service.provider;
    const subscription = {
      functionId: this.serverless.service.getFunction(fn).name,
      type: 'aws.apigateway.http',
      details: {
        function: this.serverless.service.getFunction(fn).name,
        type: 'http',
        source: 'AWS::APIGateway::http',
        apiId,
      },
      provider,
      permissions: {
        type: 'aws IAM',
        action: 'lambda:InvokeFunction',
        sourceAccount: 'Amazon',
      },
    };

    if (typeof event === 'string') {
      subscription.details.method = event.split(' ')[0];
      subscription.details.path = event.split(' ')[1];
      subscription.permissions.sourceArn = this.provider
        .getMethodArn(provider.accountId, apiId, event.split(' ')[0], event.split(' ')[1]);
      subscription.details.cors = false;
      subscription.details.lambdaProxy = true;
    } else if (typeof event === 'object') {
      subscription.details.method = event.method;
      subscription.details.path = event.path;
      subscription.permissions.sourceArn = this.provider
        .getMethodArn(provider.accountId, apiId, event.method, event.path);
      if (typeof event.cors === 'boolean' || typeof event.cors === 'object') {
        subscription.details.cors = true;
      } else {
        subscription.details.cors = false;
      }
      if (event.integration === 'AWS') {
        subscription.details.lambdaProxy = false;
      } else {
        subscription.details.lambdaProxy = true;
      }
    }
    subscription.event = event;

    // the aws package plugin strips trailing and leading slashes per CF needs.
    if (subscription.details.path === '') subscription.details.path = '/';
    if (subscription.event.path === '') subscription.event.path = '/';

    // in case of AWS integration, the aws package plugin adds
    // request/response objects that we need to stringify
    if (!subscription.details.lambdaProxy) {
      subscription.event.request = JSON.stringify(subscription.event.request);
      subscription.event.response = JSON.stringify(subscription.event.response);
    }

    return subscription;
  }