export function optionsToEndpoint()

in src/cloud-functions.ts [602:645]


export function optionsToEndpoint(
  options: DeploymentOptions
): ManifestEndpoint {
  const endpoint: ManifestEndpoint = {};
  copyIfPresent(
    endpoint,
    options,
    'minInstances',
    'maxInstances',
    'ingressSettings',
    'labels',
    'timeoutSeconds'
  );
  convertIfPresent(endpoint, options, 'region', 'regions');
  convertIfPresent(
    endpoint,
    options,
    'serviceAccountEmail',
    'serviceAccount',
    (sa) => sa
  );
  if (options?.vpcConnector) {
    endpoint.vpc = { connector: options.vpcConnector };
    convertIfPresent(
      endpoint.vpc,
      options,
      'egressSettings',
      'vpcConnectorEgressSettings'
    );
  }
  convertIfPresent(endpoint, options, 'availableMemoryMb', 'memory', (mem) => {
    const memoryLookup = {
      '128MB': 128,
      '256MB': 256,
      '512MB': 512,
      '1GB': 1024,
      '2GB': 2048,
      '4GB': 4096,
      '8GB': 8192,
    };
    return memoryLookup[mem];
  });
  return endpoint;
}