src/vpce.js
function buildEndpointServices(services = [], numZones = 0) {
  if (!Array.isArray(services) || services.length < 1) {
    return {};
  }
  if (numZones < 1) {
    return {};
  }

  const subnetIds = [];
  const routeTableIds = [];
  for (let i = 1; i <= numZones; i += 1) {
    subnetIds.push({ Ref: `${APP_SUBNET}Subnet${i}` });
    routeTableIds.push({ Ref: `${APP_SUBNET}RouteTable${i}` });
  }

  const resources = {};
  services.forEach(service => {
    Object.assign(resources, buildVPCEndpoint(service, { routeTableIds, subnetIds }));
  });

  return resources;
}
function buildEndpointServices(services = [], numZones = 0) {
  if (!Array.isArray(services) || services.length < 1) {
    return {};
  }
  if (numZones < 1) {
    return {};
  }

  const subnetIds = [];
  const routeTableIds = [];
  for (let i = 1; i <= numZones; i += 1) {
    subnetIds.push({ Ref: `${APP_SUBNET}Subnet${i}` });
    routeTableIds.push({ Ref: `${APP_SUBNET}RouteTable${i}` });
  }

  const resources = {};
  services.forEach(service => {
    Object.assign(resources, buildVPCEndpoint(service, { routeTableIds, subnetIds }));
  });

  return resources;
}
function buildEndpointServices ( services = [ ] , numZones = 0 ) { if ( ! Array . isArray ( services ) || services . length < 1 ) { return { } ; } if ( numZones < 1 ) { return { } ; } const subnetIds = [ ] ; const routeTableIds = [ ] ; for ( let i = 1 ; i <= numZones ; i += 1 ) { subnetIds . push ( { Ref : ` ${ APP_SUBNET } ${ i } ` } ) ; routeTableIds . push ( { Ref : ` ${ APP_SUBNET } ${ i } ` } ) ; } const resources = { } ; services . forEach ( service => { Object . assign ( resources , buildVPCEndpoint ( service , { routeTableIds , subnetIds } ) ) ; } ) ; return resources ; }
Build VPC endpoints for a given number of services and zones

@param {Array} services Array of VPC endpoint services
@param {Number} numZones Number of availability zones
@return {Object}
Build VPC endpoints for a given number of services and zones